[Yt-svn] commit/yt: jsoishi: added handlers for projection right-click. now it goes!

Bitbucket commits-noreply at bitbucket.org
Thu Mar 31 11:29:21 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/db3a525da7e9/
changeset:   r4057:db3a525da7e9
branch:      yt
user:        jsoishi
date:        2011-03-31 20:25:21
summary:     added handlers for projection right-click. now it goes!
affected #:  2 files (1.5 KB)

--- a/yt/gui/reason/extdirect_repl.py	Thu Mar 31 11:53:59 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Thu Mar 31 11:25:21 2011 -0700
@@ -216,6 +216,29 @@
         return rv
 
     @append_payloads
+    def create_proj(self, pfname, axis, field, weight):
+        funccall = """
+        _tpf = %(pfname)s
+        _taxis = %(axis)s
+        _tfield = "%(field)s"
+        _tweight = "%(weight)s"
+        _tsl = _tpf.h.proj(_taxis,_tfield, weight_field=_tweight)
+        _txax, _tyax = x_dict[_taxis], y_dict[_taxis]
+        DLE, DRE = _tpf.domain_left_edge, _tpf.domain_right_edge
+        from yt.visualization.plot_window import PWViewerExtJS
+        _tpw = PWViewerExtJS(_tsl, (DLE[_txax], DRE[_txax], DLE[_tyax], DRE[_tyax]))
+        _tpw._current_field = _tfield
+        _tpw.set_log(_tfield, True)
+        add_widget('_tpw')
+        """ % dict(pfname = pfname,
+                   axis = inv_axis_names[axis],
+                   weight = weight,
+                   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
+    @append_payloads
     def create_slice(self, pfname, center, axis, field):
         funccall = """
         _tpf = %(pfname)s


--- a/yt/gui/reason/html/js/functions.js	Thu Mar 31 11:53:59 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Thu Mar 31 11:25:21 2011 -0700
@@ -260,7 +260,16 @@
             buttons: [
                 {
                     text: 'Project',
-                    handler: function(b, e){win.close()}
+                    handler: function(b, e){
+                        var axis = Ext.get("axis").getValue();
+                        var field = Ext.get("field").getValue();
+                        var weight = Ext.get("weightField").getValue();
+                        yt_rpc.ExtDirectREPL.create_proj({
+                                pfname: node.attributes.objdata.varname,
+                                axis: axis, field: field, weight: weight},
+                              handle_result);
+                        win.close();
+                    }
                 },{
                     text: 'Cancel',
                     handler: function(b, e){win.close()}

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