[Yt-svn] commit/yt: MatthewTurk: Commits to reason! Adding a button to execute code, a button to copy code back

Bitbucket commits-noreply at bitbucket.org
Sat Jun 11 21:59:19 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/e0df94fc90f2/
changeset:   e0df94fc90f2
branch:      yt
user:        MatthewTurk
date:        2011-06-12 06:59:10
summary:     Commits to reason!  Adding a button to execute code, a button to copy code back
to the cell to evaluate it, and firing the contextmenu even when nodes in the
tree are double clicked.  Also fixed grid data view and disabled the WebGL
stuff.
affected #:  3 files (1.8 KB)

--- a/yt/gui/reason/extdirect_repl.py	Fri Jun 10 18:09:50 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py	Sat Jun 11 21:59:10 2011 -0700
@@ -139,7 +139,9 @@
         self.repl.payload_handler.add_payload(
             {'type': 'cell_results',
              'output': result,
-             'input': highlighter(code)})
+             'input': highlighter(code),
+             'raw_input': code},
+            )
 
 def deliver_image(im):
     if hasattr(im, 'read'):
@@ -546,6 +548,7 @@
         """ % dict(pfname = pfname)
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
         self.execute(funccall, hide = True)
+        self.execution_thread.queue.join()
         pf = self.locals['_tpf']
         levels = pf.h.grid_levels
         left_edge = pf.h.grid_left_edge
@@ -579,6 +582,7 @@
         """ % dict(pfname = pfname)
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
         self.execute(funccall, hide = True)
+        self.execution_thread.queue.join()
         pf = self.locals['_tpf']
         corners = pf.h.grid_corners
         levels = pf.h.grid_levels


--- a/yt/gui/reason/html/js/functions.js	Fri Jun 10 18:09:50 2011 -0700
+++ b/yt/gui/reason/html/js/functions.js	Sat Jun 11 21:59:10 2011 -0700
@@ -54,7 +54,7 @@
         } else if (payload['type'] == 'cell_results') {
             text = "<pre>"+payload['output']+"</pre>";
             formatted_input = payload['input']
-            cell = new_cell(formatted_input, text);
+            cell = new_cell(formatted_input, text, payload['raw_input']);
             OutputContainer.add(cell);
             OutputContainer.doLayout();
             notebook.doLayout();
@@ -154,23 +154,47 @@
     });
 }
 
-function new_cell(input, result) {
+function new_cell(input, result, raw_input) {
     var name = "cell_" + cell_count;
     var CellPanel = new Ext.Panel(
         { 
             id: name, 
             //title: "Cell " + cell_count,
             items: [
-                new Ext.Panel({
-                    id:name+"_input",
-                    html:input,
-                }),
-                new Ext.Panel({
-                    id:name+"_result",
-                    autoScroll:true,
-                    width: "100%",
-                    html:result,
-                })
+                { xtype:'panel',
+                  layout: 'hbox',
+                  id:name+"_input",
+                  items: [
+                    { xtype:'panel',
+                      html:input,
+                      flex:1,
+                      boxMinHeight: 40,
+                    },
+                    { xtype: 'button',
+                      width: 24,
+                      height: 24,
+                      iconCls: 'doubleuparrow',
+                      tooltip: 'Copy into current cell',
+                      listeners: {
+                          click: function(f, e) {
+                            repl_input.get('input_line').setValue(raw_input);
+                          }
+                      },
+                    },
+                  ],
+                },
+                { xtype:'panel',
+                  layout: 'hbox',
+                  items: [
+                    { xtype:'panel',
+                      id:name+"_result",
+                      autoScroll:true,
+                      flex: 1,
+                      html:result,
+                      boxMinHeight: 40,
+                    },
+                  ],
+                },
             ]
         }
     );


--- a/yt/gui/reason/html/js/reason.js	Fri Jun 10 18:09:50 2011 -0700
+++ b/yt/gui/reason/html/js/reason.js	Sat Jun 11 21:59:10 2011 -0700
@@ -55,11 +55,11 @@
 }
 
 var repl_input = new Ext.FormPanel({
-    title: 'YT Input',
     url: 'push',
-    flex: 0.2,
     layout: 'fit',
     padding: 5,
+    height: '100%',
+    flex: 1.0,
     items: [{
         id: 'input_line',
         xtype: 'textarea',
@@ -103,14 +103,37 @@
 });
 
 
-
+var CellInputContainer = new Ext.Panel({
+    title: 'YT Input',
+    flex: 0.3,
+    layout: {type: 'hbox',
+             pack: 'start',
+             align: 'stretch',
+             },
+    items: [ repl_input,
+            { xtype: 'button',
+              width: 24,
+              height: 24,
+              iconCls: 'doubledownarrow',
+              tooltip: 'Execute Cell',
+              listeners: {
+                  click: function(f, e) {
+                    disable_input();
+                    yt_rpc.ExtDirectREPL.execute({
+                        code:repl_input.get('input_line').getValue()},
+                    handle_result);
+                  }
+              },
+            }
+           ]
+});
 
 
 var OutputContainer = new Ext.Panel({
     title: 'YT Output',
     id: 'output_container',
     autoScroll: true,
-    flex: 0.8,
+    flex: 0.7,
     items: []
 });
 
@@ -141,6 +164,11 @@
                 null, {preventDefault: true});
             }
         },
+        dblclick: {
+            fn: function(node, e) {
+                treePanel.fireEvent("contextmenu", node, e);
+            }
+        },
         contextmenu: {
             fn: function(node, event){
                 var rightclickMenu;
@@ -156,10 +184,10 @@
                 } else if (node.attributes.objdata.type == 'pf') {
                   rightClickMenu = new Ext.menu.Menu({
                       items: [
-                          {
+                          /*{
                               text: 'View Grids',
                               handler: getGridViewerHandler(node),
-                          }, {
+                          },*/ {
                               text: 'View Grid Data',
                               handler: getGridDataViewerHandler(node),
                           }, {
@@ -171,10 +199,10 @@
                           /*}, {
                               text: 'Create Sphere',
                               handler: getSphereCreator(node), */
-                          }, {
+                          }, /*{
                               text: 'View Streamlines',
                               handler: getStreamlineViewerHandler(node),
-                          }
+                          }, */
                       ]
                   });
                 }
@@ -263,7 +291,7 @@
                         closable: false,
                         autoScroll: false,
                         iconCls: 'console',
-                        items: [repl_input, OutputContainer]
+                        items: [CellInputContainer, OutputContainer]
                     }, 
                 ]
             }

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