[Yt-svn] commit/yt: 3 new changesets

Bitbucket commits-noreply at bitbucket.org
Fri Apr 1 10:10:38 PDT 2011


3 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/f29ac6d562e0/
changeset:   r4058:f29ac6d562e0
branch:      yt
user:        MatthewTurk
date:        2011-04-01 05:03:43
summary:     Implemented simple heartbeep for server.  Currently disabled, waiting on a UI.
affected #:  2 files (560 bytes)

--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 11:25:21 2011 -0700
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 23:03:43 2011 -0400
@@ -114,6 +114,9 @@
         vals = open(os.path.join(local_dir, "html/index.html")).read()
         return vals
 
+    def heartbeep(self):
+        return {'alive': True}
+
     def _help_html(self):
         vals = open(os.path.join(local_dir, "html/help.html")).read()
         return vals
@@ -217,6 +220,7 @@
 
     @append_payloads
     def create_proj(self, pfname, axis, field, weight):
+        if weight == "None": weight = None
         funccall = """
         _tpf = %(pfname)s
         _taxis = %(axis)s
@@ -238,6 +242,7 @@
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
         rv = self.execute(funccall)
         return rv
+
     @append_payloads
     def create_slice(self, pfname, center, axis, field):
         funccall = """


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 11:25:21 2011 -0700
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 23:03:43 2011 -0400
@@ -298,8 +298,12 @@
         reader: new Ext.data.ArrayReader({}, [{name: 'record'}]),
     });
 
+    var heartbeep_request = false;
+    var task_runner = new Ext.util.TaskRunner();
+
+
     Ext.onReady(function(){
-        Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
+       Ext.BLANK_IMAGE_URL = 'resources/resources/images/default/s.gif';
 
     // NOTE: This is an example showing simple state management. During development,
     // it is generally best to disable state management as dynamically-generated ids
@@ -405,4 +409,18 @@
         Ext.state.Manager.set("reason_welcomed", true);
     } else { 
         repl_input.get("input_line").focus(); }
+
+    /* Set up the heartbeep */
+    var heartbeep = {
+    run:
+      function(){ if (heartbeep_request == true) return; 
+        yt_rpc.ExtDirectREPL.heartbeep(
+            {}, function(f, a) {
+            heartbeep_request = false;
+            if (f['alive'] == true) { 
+            }})},
+    interval: 5000};
+
+    //task_runner.start(heartbeep);
+                         
     });


http://bitbucket.org/yt_analysis/yt/changeset/4f80f59f442b/
changeset:   r4059:4f80f59f442b
branch:      yt
user:        MatthewTurk
date:        2011-04-01 05:39:02
summary:     Changed cells to be handled through payloads.  Side effect is that all the
executed commands are visible now in the cells, which may or may not be good.
affected #:  5 files (1.1 KB)

--- a/yt/gui/reason/bottle_mods.py	Thu Mar 31 23:03:43 2011 -0400
+++ b/yt/gui/reason/bottle_mods.py	Thu Mar 31 23:39:02 2011 -0400
@@ -73,15 +73,13 @@
     def wrapper(self, *args, **kwargs):
         reset = not _ph._hold
         _ph._hold = True
-        rv = func(self, *args, **kwargs)
+        func(self, *args, **kwargs)
         # Assume it returns a dict
-        if not reset: return rv
+        if not reset: return
         # In case it sets it manually
         _ph._hold = False
-        payloads = rv.get('payloads', [])
-        payloads += _ph.deliver_payloads()
-        rv['payloads'] = payloads
-        return rv
+        payloads = _ph.deliver_payloads()
+        return payloads
     return wrapper
 
 class BottleDirectRouter(DirectRouter):


--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 23:03:43 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 23:39:02 2011 -0400
@@ -156,9 +156,10 @@
     def execute(self, code):
         self.executed_cell_texts.append(code)
         result = ProgrammaticREPL.execute(self, code)
-        return_value = {'output': result,
-                        'input': highlighter(code)}
-        return return_value
+        self.payload_handler.add_payload(
+            {'type': 'cell_results',
+             'output': result,
+             'input': highlighter(code)})
 
     def get_history(self):
         return self.executed_cell_texts[:]
@@ -215,8 +216,7 @@
                    'widget_type': widget._widget_name,
                    'varname': varname}
         self.payload_handler.add_payload(payload)
-        rv = self.execute("%s = %s\n" % (varname, widget_name))
-        return rv
+        self.execute("%s = %s\n" % (varname, widget_name))
 
     @append_payloads
     def create_proj(self, pfname, axis, field, weight):
@@ -240,8 +240,7 @@
                    field=field)
         # There is a call to do this, but I have forgotten it ...
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
-        rv = self.execute(funccall)
-        return rv
+        self.execute(funccall)
 
     @append_payloads
     def create_slice(self, pfname, center, axis, field):
@@ -267,9 +266,7 @@
                    field=field)
         # There is a call to do this, but I have forgotten it ...
         funccall = "\n".join((line.strip() for line in funccall.splitlines()))
-        rv = self.execute(funccall)
-        return rv
-
+        self.execute(funccall)
 
     def _test_widget(self):
         class tt(object):


--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 23:03:43 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 23:39:02 2011 -0400
@@ -29,11 +29,25 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ***********************************************************************/
 
-function cell_finished(result, new_cell) {
+function cell_finished(result) {
     var new_log = false;
-    Ext.each(result['payloads'], 
+    Ext.each(result, 
     function(payload, index) {
-        if (payload['type'] == 'png_string') {
+        if (payload['type'] == 'cell_results') {
+            text = "<pre>"+payload['output']+"</pre>";
+            formatted_input = payload['input']
+            var cell = new_cell(formatted_input, text);
+            OutputContainer.add(cell);
+            OutputContainer.doLayout();
+            notebook.doLayout();
+            repl_input.get("input_line").setValue("");
+            if (OutputContainer.items.length > 1) {
+                examine = cell;
+                OutputContainer.body.dom.scrollTop = 
+                OutputContainer.body.dom.scrollHeight -
+                cell.body.dom.scrollHeight - 20;
+            }
+        } else if (payload['type'] == 'png_string') {
             new_cell.add(new Ext.Panel({
                 autoEl:{
                     tag:'img', 
@@ -216,7 +230,7 @@
 function widget_call(varname, method) {
     var fcall = varname + "." + method;
     yt_rpc.ExtDirectREPL.execute(
-        {code: fcall}, handle_payload);
+        {code: fcall}, cell_finished);
 }
 
 


--- a/yt/gui/reason/html/js/reason.js	Thu Mar 31 23:03:43 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Thu Mar 31 23:39:02 2011 -0400
@@ -44,27 +44,19 @@
 var handle_result = function(f, a) {
     var input_line = repl_input.get("input_line")
     if (a.result == null) {
+        formatted_input = input_line.getValue();
         text = "ERROR";
-        formatted_input = input_line.getValue();
-    } else {
-//        text = a.result['output'].replace(/\n/g,"<br/>");
-        text = "<pre>"+a.result['output']+"</pre>";
-        formatted_input = a.result['input']
+        var cell = new_cell(formatted_input, text);
+        OutputContainer.add(cell);
+        notebook.doLayout();
+        input_line.setValue("");
+        return;
     }
-    var cell = new_cell(formatted_input, text);
-    OutputContainer.add(cell);
-    notebook.doLayout();
-    input_line.setValue("");
-    cell_finished(a.result, cell);
-    if (OutputContainer.items.length > 1) {
-        OutputContainer.body.dom.scrollTop = 
-        OutputContainer.body.dom.scrollHeight -
-        cell.body.dom.scrollHeight - 20;
-    }
+    cell_finished(a.result);
 }
 
     var handle_payload = function(pp) {
-        cell_finished(pp, null);
+        cell_finished(pp);
     }
 
     var repl_input = new Ext.FormPanel({


--- a/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 23:03:43 2011 -0400
+++ b/yt/gui/reason/html/js/widget_plotwindow.js	Thu Mar 31 23:39:02 2011 -0400
@@ -74,7 +74,7 @@
                     handler: function(b,e) {
                         cc = python_varname + '.pan_rel((0.0, -0.1))'
                         yt_rpc.ExtDirectREPL.execute(
-                        {code:cc}, handle_payload); 
+                        {code:cc}, cell_finished); 
                     }
                 }, {
                     xtype:'button',
@@ -85,7 +85,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.1, 0.0))'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 }, {
                     xtype:'button',
@@ -96,7 +96,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.0, 0.1))'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 }, {
                     xtype: 'button',
@@ -107,7 +107,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((-0.1, 0.0))'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 }, 
                 /* the double buttons for 50% pan*/
@@ -120,7 +120,7 @@
                     handler: function(b,e) {
                         cc = python_varname + '.pan_rel((0.0, -0.5))'
                         yt_rpc.ExtDirectREPL.execute(
-                        {code:cc}, handle_payload); 
+                        {code:cc}, cell_finished); 
                     }
                 }, {
                     xtype:'button',
@@ -131,7 +131,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.5, 0.0))'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 }, {
                     xtype:'button',
@@ -142,7 +142,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((0.0, 0.5))'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 }, {
                     xtype: 'button',
@@ -153,7 +153,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.pan_rel((-0.5, 0.0))'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 },
                 /* Now the zoom buttons */
@@ -166,7 +166,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(10.0)'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 },{
                     xtype: 'button',
@@ -177,7 +177,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(2.0)'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 },{
                     xtype: 'button',
@@ -188,7 +188,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(0.5)'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 },{
                     xtype: 'button',
@@ -199,7 +199,7 @@
                     handler: function(b,e) {
                         yt_rpc.ExtDirectREPL.execute(
                             {code:python_varname + '.zoom(0.1)'},
-                        handle_payload); 
+                        cell_finished); 
                     }
                 }
             ]
@@ -218,7 +218,7 @@
 
     yt_rpc.ExtDirectREPL.execute(
         {code:python_varname + '.zoom(1.0)'},
-        handle_payload);
+        cell_finished);
 }
 
 widget_types['plot_window'] = WidgetPlotWindow;


http://bitbucket.org/yt_analysis/yt/changeset/8ec3cbe7f0fb/
changeset:   r4060:8ec3cbe7f0fb
branch:      yt
user:        MatthewTurk
date:        2011-04-01 19:06:30
summary:     Fixes for some enzo_test modules
affected #:  2 files (36 bytes)

--- a/yt/utilities/answer_testing/output_tests.py	Thu Mar 31 23:39:02 2011 -0400
+++ b/yt/utilities/answer_testing/output_tests.py	Fri Apr 01 13:06:30 2011 -0400
@@ -134,7 +134,7 @@
 
     def __iter__(self):
         for line in open(self.io_log):
-            yield line[len(self.io_log_header):].strip()
+            yield line[len(self.io_log_header):].split()[0].strip()
 
 def create_test(base, new_name, **attrs):
     """


--- a/yt/utilities/answer_testing/runner.py	Thu Mar 31 23:39:02 2011 -0400
+++ b/yt/utilities/answer_testing/runner.py	Fri Apr 01 13:06:30 2011 -0400
@@ -125,7 +125,7 @@
             project = imp.load_module(mname, f, filename, desc)
 
     def _update_io_log(self, opts, kwargs):
-        if len(opts.datasets) == 0: return
+        if opts.datasets is None or len(opts.datasets) == 0: return
         f = tempfile.NamedTemporaryFile()
         kwargs['io_log'] = f.name
         for d in opts.datasets:

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