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

Bitbucket commits-noreply at bitbucket.org
Sat Apr 23 18:48:12 PDT 2011


2 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/54395e368fb8/
changeset:   r4194:54395e368fb8
branch:      yt
user:        MatthewTurk
date:        2011-04-24 01:06:48
summary:     Initial pass at a grid data viewer.  This, the grid viewer, and a parameter
file viewer should all be combined eventually, and they'll need a controlling
widget.
affected #:  5 files (7.7 KB)

--- a/yt/gui/reason/extdirect_repl.py	Sat Apr 23 08:33:24 2011 -0400
+++ b/yt/gui/reason/extdirect_repl.py	Sat Apr 23 19:06:48 2011 -0400
@@ -417,6 +417,39 @@
         self.execute(self._add_widget('_tpw', '_twidget_data'), hide = True)
 
     @lockit
+    def create_grid_dataview(self, pfname):
+        funccall = """
+        _tpf = %(pfname)s
+        """ % dict(pfname = pfname)
+        funccall = "\n".join((line.strip() for line in funccall.splitlines()))
+        self.execute(funccall, hide = True)
+        pf = self.locals['_tpf']
+        levels = pf.h.grid_levels
+        left_edge = pf.h.grid_left_edge
+        right_edge = pf.h.grid_right_edge
+        dimensions = pf.h.grid_dimensions
+        cell_counts = pf.h.grid_dimensions.prod(axis=1)
+        # This is annoying, and not ... that happy for memory.
+        i = pf.h.grids[0]._id_offset
+        vals = []
+        for i, (L, LE, RE, dim, cell) in enumerate(zip(
+            levels, left_edge, right_edge, dimensions, cell_counts)):
+            vals.append([ int(i), int(L[0]),
+                          float(LE[0]), float(LE[1]), float(LE[2]),
+                          float(RE[0]), float(RE[1]), float(RE[2]),
+                          int(dim[0]), int(dim[1]), int(dim[2]),
+                          int(cell)] )
+        uu = str(uuid.uuid1()).replace("-","_")
+        varname = "gg_%s" % (uu)
+        payload = {'type': 'widget',
+                   'widget_type': 'grid_data',
+                   'varname': varname, # Is just "None"
+                   'data': dict(gridvals = vals),
+                   }
+        self.execute("%s = None\n" % (varname), hide=True)
+        self.payload_handler.add_payload(payload)
+
+    @lockit
     def create_grid_viewer(self, pfname):
         funccall = """
         _tpf = %(pfname)s


--- a/yt/gui/reason/html/index.html	Sat Apr 23 08:33:24 2011 -0400
+++ b/yt/gui/reason/html/index.html	Sat Apr 23 19:06:48 2011 -0400
@@ -106,6 +106,10 @@
 
     <!-- THE PROGRESS BAR FUNCTIONS --><script type="text/javascript" src="js/widget_progressbar.js"></script>
+
+    <!-- THE GRID DATA VIEWER FUNCTIONS -->
+    <script type="text/javascript" src="js/widget_griddata.js"></script>
+
     <script id="gv-shader-fs" type="x-shader/x-fragment">
     #ifdef GL_ES
     precision highp float;


--- a/yt/gui/reason/html/js/functions.js	Sat Apr 23 08:33:24 2011 -0400
+++ b/yt/gui/reason/html/js/functions.js	Sat Apr 23 19:06:48 2011 -0400
@@ -106,6 +106,8 @@
         } else if (payload['type'] == 'widget_payload') {
             var widget = widget_list[payload['widget_id']];
             widget.accept_results(payload);
+        } else {
+            alert("Didn't know how to process " + payload['type']);
         }
     });
     if (new_log == true){
@@ -183,6 +185,15 @@
 return gridViewerHandler;
 }
 
+function getGridDataViewerHandler(node){
+function gridDataViewerHandler(item, pressed){
+    yt_rpc.ExtDirectREPL.create_grid_dataview(
+        {pfname:node.attributes.objdata.varname},
+        handle_result);
+}
+return gridDataViewerHandler;
+}
+
 function getStreamlineViewerHandler(node){
 function streamlineViewerHandler(item, pressed){
     yt_rpc.ExtDirectREPL.create_streamline_viewer(


--- a/yt/gui/reason/html/js/reason.js	Sat Apr 23 08:33:24 2011 -0400
+++ b/yt/gui/reason/html/js/reason.js	Sat Apr 23 19:06:48 2011 -0400
@@ -150,6 +150,9 @@
                             text: 'View Grids',
                             handler: getGridViewerHandler(node),
                         }, {
+                            text: 'View Grid Data',
+                            handler: getGridDataViewerHandler(node),
+                        }, {
                             text: 'Open slice',
                             handler: getSliceHandler(node),
                         }, {


--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yt/gui/reason/html/js/widget_griddata.js	Sat Apr 23 19:06:48 2011 -0400
@@ -0,0 +1,146 @@
+/**********************************************************************
+The Plot Window Widget
+
+Author: Matthew Turk <matthewturk at gmail.com>
+Affiliation: NSF / Columbia
+Homepage: http://yt.enzotools.org/
+License:
+  Copyright (C) 2011 Matthew Turk.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+***********************************************************************/
+
+// shim layer with setTimeout fallback
+var WidgetGridDataViewer = function(python_varname, widget_data) {
+    this.id = python_varname;
+    this.widget_data = widget_data;
+    store = new Ext.data.ArrayStore({
+        fields: [
+           {name: 'grid_id', type:'int'},
+           {name: 'level', type:'int'},
+           {name: 'left_edge_x', type: 'float'},
+           {name: 'left_edge_y', type: 'float'},
+           {name: 'left_edge_z', type: 'float'},
+           {name: 'right_edge_x', type: 'float'},
+           {name: 'right_edge_y', type: 'float'},
+           {name: 'right_edge_z', type: 'float'},
+           {name: 'dim_x', type: 'int'},
+           {name: 'dim_y', type: 'int'},
+           {name: 'dim_z', type: 'int'},
+           {name: 'cells', type: 'int'},
+        ]
+    });
+    store.loadData(widget_data['gridvals']);
+    examine = widget_data;
+
+    viewport.get("center-panel").add(
+        {
+            xtype: 'panel',
+            id: "gg_" + python_varname,
+            title: "Grid Data Viewer",
+            iconCls: 'graph',
+            autoScroll: true,
+            layout:'absolute',
+            closable: true,
+            width: 800, height: 500,
+            items: [ {
+                       xtype: 'grid',
+                       store: store,
+                       columns: [
+                            {
+                                id: 'grid_id',
+                                header: 'Grid ID',
+                                width: 100,
+                                dataIndex: 'grid_id',
+                                sortable: true,
+                            }, {
+                                id: 'left_edge_x',
+                                header: 'Left Edge x',
+                                width: 100,
+                                dataIndex: 'left_edge_x',
+                                sortable: true,
+                            }, {
+                                id: 'left_edge_y',
+                                header: 'Left Edge y',
+                                width: 100,
+                                dataIndex: 'left_edge_y',
+                                sortable: true,
+                            }, {
+                                id: 'left_edge_z',
+                                header: 'Left Edge z',
+                                width: 100,
+                                dataIndex: 'left_edge_z',
+                                sortable: true,
+                            }, {
+                                id: 'right_edge_x',
+                                header: 'Right Edge x',
+                                width: 100,
+                                dataIndex: 'right_edge_x',
+                                sortable: true,
+                            }, {
+                                id: 'right_edge_y',
+                                header: 'Right Edge y',
+                                width: 100,
+                                dataIndex: 'right_edge_y',
+                                sortable: true,
+                            }, {
+                                id: 'right_edge_z',
+                                header: 'Right Edge z',
+                                width: 100,
+                                dataIndex: 'right_edge_z',
+                                sortable: true,
+                            }, {
+                                id: 'dim_x',
+                                header: 'DimX',
+                                width: 100,
+                                dataIndex: 'dim_x',
+                                sortable: true,
+                            }, {
+                                id: 'dim_y',
+                                header: 'DimY',
+                                width: 100,
+                                dataIndex: 'dim_y',
+                                sortable: true,
+                            }, {
+                                id: 'dim_z',
+                                header: 'DimZ',
+                                width: 100,
+                                dataIndex: 'dim_z',
+                                sortable: true,
+                            }, {
+                                id: 'cells',
+                                header: 'Cells',
+                                width: 100,
+                                dataIndex: 'cells',
+                                sortable: true,
+                            },
+                       ],
+                      height: 500, width: 700, x: 0, y: 0,
+                      }
+                   ],
+
+        }
+    );
+
+    viewport.get("center-panel").activate("gg_" + this.id);
+    viewport.doLayout();
+    this.panel = viewport.get("center-panel").get("gg_" + python_varname);
+    this.panel.doLayout();
+
+    this.accept_results = function(payload) { }
+}
+
+widget_types['grid_data'] = WidgetGridDataViewer;


http://bitbucket.org/yt_analysis/yt/changeset/583fc45c3a52/
changeset:   r4195:583fc45c3a52
branch:      yt
user:        MatthewTurk
date:        2011-04-24 01:08:57
summary:     This layout is a bit nicer, and we can stick stuff on top of it eventually.
affected #:  1 file (8 bytes)

--- a/yt/gui/reason/html/js/widget_griddata.js	Sat Apr 23 19:06:48 2011 -0400
+++ b/yt/gui/reason/html/js/widget_griddata.js	Sat Apr 23 19:08:57 2011 -0400
@@ -53,9 +53,9 @@
             title: "Grid Data Viewer",
             iconCls: 'graph',
             autoScroll: true,
-            layout:'absolute',
+            layout:'vbox',
+            layoutConfig: {align: 'stretch', pack: 'start'},
             closable: true,
-            width: 800, height: 500,
             items: [ {
                        xtype: 'grid',
                        store: store,
@@ -128,7 +128,7 @@
                                 sortable: true,
                             },
                        ],
-                      height: 500, width: 700, x: 0, y: 0,
+                      flex: 1,
                       }
                    ],

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