[Yt-svn] commit/yt: MatthewTurk: Adding a 'hide' option to keep some executed commands from displaying, although

Bitbucket commits-noreply at bitbucket.org
Fri Apr 15 13:12:24 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/34ea486c4b6f/
changeset:   r4140:34ea486c4b6f
branch:      yt
user:        MatthewTurk
date:        2011-04-15 22:12:12
summary:     Adding a 'hide' option to keep some executed commands from displaying, although
they are still displayed in the downloaded scripts.
affected #:  2 files (996 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Fri Apr 15 15:59:38 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Fri Apr 15 16:12:12 2011 -0400
@@ -126,7 +126,7 @@
         # Now we load up all the yt.mods stuff, but only after we've finished
         # setting up.
         self.execute("from yt.mods import *")
-        self.execute("from yt.data_objects.static_output import _cached_pfs")
+        self.execute("from yt.data_objects.static_output import _cached_pfs", hide = True)
         self.locals['load_script'] = ext_load_script
         self.locals['_widgets'] = {}
         self._setup_logging_handlers()
@@ -210,10 +210,11 @@
         return highlighter_css
 
     @lockit
-    def execute(self, code):
+    def execute(self, code, hide = False):
         self.executed_cell_texts.append(code)
 
         result = ProgrammaticREPL.execute(self, code)
+        if hide: return
         self.payload_handler.add_payload(
             {'type': 'cell_results',
              'output': result,
@@ -333,8 +334,8 @@
                    field=field)
         # There is a call to do this, but I have forgotten it ...
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
-        self.execute(funccall)
-        self.execute(self._add_widget('_tpw', '_twidget_data'))
+        self.execute(funccall, hide = True)
+        self.execute(self._add_widget('_tpw', '_twidget_data'), hide = True)
 
     @lockit
     def create_slice(self, pfname, center, axis, field, onmax):
@@ -369,14 +370,26 @@
                    field=field)
         # There is a call to do this, but I have forgotten it ...
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
-        self.execute(funccall)
-        self.execute(self._add_widget('_tpw', '_twidget_data'))
+        self.execute(funccall, hide = True)
+        self.execute(self._add_widget('_tpw', '_twidget_data'), hide = True)
 
-    def _test_widget(self):
-        class tt(object):
-            _widget_name = "plot_window"
-        mm = tt()
-        return mm
+    @lockit
+    def create_grid_viewer(self, pfname):
+        pf = self.locals[pfname]
+        corners = pf.h.grid_corners
+        vertices = []
+
+        trans  = [0, 1, 2, 7, 5, 6, 3, 4]
+        order  = [0, 1, 1, 2, 2, 3, 3, 0]
+        order += [4, 5, 5, 6, 6, 7, 7, 4]
+        order += [0, 4, 1, 5, 2, 6, 3, 7]
+
+        for g in xrange(corners.shape[2]):
+            for c in order:
+                ci = trans[c]
+                vertices.append(corners[ci,:,g])
+        vertices = na.concatenate(vertices).tolist()
+        return {'vertices': vertices}
 
 class ExtDirectParameterFileList(BottleDirectRouter):
     my_name = "ExtDirectParameterFileList"


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Fri Apr 15 15:59:38 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Fri Apr 15 16:12:12 2011 -0400
@@ -36,7 +36,8 @@
     this.widget_data = widget_data;
     this.print_python = function(b, e) {
         yt_rpc.ExtDirectREPL.execute(
-            {code:'print "' + python_varname + '"'},
+            {code:'print "' + python_varname + '"',
+             hide:true},
             function(f, a) {alert(a.result['output']);}
         );
     }
@@ -75,7 +76,7 @@
                     handler: function(b,e) {
                         cc = python_varname + '.pan_rel((0.0, -0.1))'
                         yt_rpc.ExtDirectREPL.execute(
-                        {code:cc}, cell_finished); 
+                        {code:cc, hide:true}, cell_finished); 
                     }
                 }, {
                     xtype:'button',
@@ -85,7 +86,8 @@
                     y : 30,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((0.1, 0.0))'},
+                            {code:python_varname + '.pan_rel((0.1, 0.0))',
+                             hide:true},
                         cell_finished); 
                     }
                 }, {
@@ -96,7 +98,8 @@
                     y: 50,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((0.0, 0.1))'},
+                            {code:python_varname + '.pan_rel((0.0, 0.1))',
+                             hide:true},
                         cell_finished); 
                     }
                 }, {
@@ -107,7 +110,8 @@
                     y: 30,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((-0.1, 0.0))'},
+                            {code:python_varname + '.pan_rel((-0.1, 0.0))',
+                             hide:true},
                         cell_finished); 
                     }
                 }, 
@@ -121,7 +125,7 @@
                     handler: function(b,e) {
                         cc = python_varname + '.pan_rel((0.0, -0.5))'
                         yt_rpc.ExtDirectREPL.execute(
-                        {code:cc}, cell_finished); 
+                        {code:cc, hide:true}, cell_finished); 
                     }
                 }, {
                     xtype:'button',
@@ -131,7 +135,8 @@
                     y : 100,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((0.5, 0.0))'},
+                            {code:python_varname + '.pan_rel((0.5, 0.0))',
+                             hide:true},
                         cell_finished); 
                     }
                 }, {
@@ -142,7 +147,8 @@
                     y: 120,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((0.0, 0.5))'},
+                            {code:python_varname + '.pan_rel((0.0, 0.5))',
+                             hide:true},
                         cell_finished); 
                     }
                 }, {
@@ -153,7 +159,8 @@
                     y: 100,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.pan_rel((-0.5, 0.0))'},
+                            {code:python_varname + '.pan_rel((-0.5, 0.0))',
+                             hide:true},
                         cell_finished); 
                     }
                 },
@@ -166,7 +173,8 @@
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.zoom(10.0)'},
+                            {code:python_varname + '.zoom(10.0)',
+                             hide:true},
                         cell_finished); 
                     }
                 },{
@@ -177,7 +185,8 @@
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.zoom(2.0)'},
+                            {code:python_varname + '.zoom(2.0)',
+                             hide:true},
                         cell_finished); 
                     }
                 },{
@@ -188,7 +197,8 @@
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.zoom(0.5)'},
+                            {code:python_varname + '.zoom(0.5)',
+                             hide:true},
                         cell_finished); 
                     }
                 },{
@@ -199,7 +209,8 @@
                     width: 80,
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
-                            {code:python_varname + '.zoom(0.1)'},
+                            {code:python_varname + '.zoom(0.1)',
+                             hide:true},
                         cell_finished); 
                     }
                 },{
@@ -240,7 +251,7 @@
                         alert(newValue);
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.set_current_field("' +
-                                newValue + '")'},
+                                newValue + '")', hide:true},
                             cell_finished);
                     }}
                 }
@@ -260,7 +271,7 @@
     }
 
     yt_rpc.ExtDirectREPL.execute(
-        {code:python_varname + '.zoom(1.0)'},
+        {code:python_varname + '.zoom(1.0)', hide:true},
         cell_finished);
 }

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list