[Yt-svn] yt-commit r502 - trunk/yt/reason

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu May 29 08:32:58 PDT 2008


Author: mturk
Date: Thu May 29 08:32:56 2008
New Revision: 502
URL: http://yt.spacepope.org/changeset/502

Log:
Reduced the numebr of redraws of slices by ... a lot.  Also started the work of
moving around the data objects.  Also cleaned up bulk velocity dialog a bit.

Things should be snappier now...



Modified:
   trunk/yt/reason/App.py
   trunk/yt/reason/Notebook.py
   trunk/yt/reason/Toolbars.py

Modified: trunk/yt/reason/App.py
==============================================================================
--- trunk/yt/reason/App.py	(original)
+++ trunk/yt/reason/App.py	Thu May 29 08:32:56 2008
@@ -341,7 +341,7 @@
                 MyID)
             self._add_data_object("Proj: %s %s" % (data_object, ax),
                                self.windows[-1].plot.data,
-                               _ProjObjectMenuItems)
+                               _ProjObjectMenuItems, parent_id)
             print "Adding with ID:", MyID
         for w in self.windows[-3:]: w.ChangeWidth(1,'1')
         proj_setup.Destroy()
@@ -363,7 +363,7 @@
                 MyID)
             self._add_data_object("Slice: %s %s" % (data_object, ax),
                                self.windows[-1].plot.data,
-                               _SliceObjectMenuItems)
+                               _SliceObjectMenuItems, parent_id)
         for w in self.windows[-3:]: w.ChangeWidth(1,'1')
 
     def __add_cutting_wrapper(self, parameter_file, normal):
@@ -371,6 +371,7 @@
 
     def _add_cutting(self, event=None, parameter_file = None, normal=None,
                      center = None):
+        parent_id = None
         if parameter_file is None or normal is None or center is None:
             parent_id, data_object = self.get_output()
             data_object.set_field_parameter("bulk_velocity",
@@ -391,7 +392,7 @@
             "%s - Cutting Plane" % (parameter_file.basename), MyID)
         self._add_data_object("Cutting Plane" % (parameter_file),
                               self.windows[-1].plot.data,
-                              _CuttingPlaneObjectMenuItems)
+                              _CuttingPlaneObjectMenuItems, parent_id)
         self.windows[-1].ChangeWidth(1,'1')
 
     def get_output(self, event=None):

Modified: trunk/yt/reason/Notebook.py
==============================================================================
--- trunk/yt/reason/Notebook.py	(original)
+++ trunk/yt/reason/Notebook.py	Thu May 29 08:32:56 2008
@@ -432,8 +432,6 @@
         self.SetSizer(self.sizer)
         self.Fit()
 
-        self.ChangeWidth(1,"1")
-
     def ChangeColorMapFromMessage(self, message):
         PlotPage.ChangeColorMapFromMessage(self, message)
         self.UpdateWidth()
@@ -560,7 +558,7 @@
 
     def ChangeWidth(self, width, unit):
         self.plot.set_width(width, unit)
-        self.UpdateCanvas()
+        self.UpdateCanvas(only_fig=True)
 
     def UpdateUnit(self, event=None):
         pos = self.widthSlider.GetValue()
@@ -640,7 +638,7 @@
 
     def set_width(self, *args):
         w, u = Toolbars.ChooseWidth(self.outputfile)
-        self.ChangeWidth(w,u)
+        #self.ChangeWidth(w,u) # Do we need this?
         Publisher().sendMessage(('viewchange','width'), (w,u))
 
     def ChangeFieldFromMessage(self, message):
@@ -657,9 +655,9 @@
         self.ChangeField(field)
         Publisher().sendMessage(('viewchange','field'), field)
 
-    def UpdateCanvas(self, *args):
+    def UpdateCanvas(self, only_fig=False):
         if self.IsShown():
-            self.plot._redraw_image()
+            if not only_fig: self.plot._redraw_image()
             self.figure_canvas.draw()
         #else: print "Opting not to update canvas"
 
@@ -815,9 +813,9 @@
         self.plot.switch_z(self.z_field.GetStringSelection())
         self.UpdateCanvas()
 
-    def UpdateCanvas(self, *args):
+    def UpdateCanvas(self, only_fig=False):
         if self.IsShown():
-            self.plot._redraw_image()
+            if not only_fig: self.plot._redraw_image()
             self.figure_canvas.draw()
         #else: print "Opting not to update canvas"
 

Modified: trunk/yt/reason/Toolbars.py
==============================================================================
--- trunk/yt/reason/Toolbars.py	(original)
+++ trunk/yt/reason/Toolbars.py	Thu May 29 08:32:56 2008
@@ -100,24 +100,38 @@
                  text="Choose the width you would like"):
         wx.Dialog.__init__(self, None, -1, title,
                            size=wx.Size(300,300))
+        hsizer = wx.BoxSizer(wx.HORIZONTAL)
         self.sizer = wx.BoxSizer(wx.VERTICAL)
+        hsizer.AddSpacer(10)
+        hsizer.Add(self.sizer, 1, wx.EXPAND)
+        hsizer.AddSpacer(10)
+
         text = wx.StaticText(self, -1, text)
+        self.sizer.AddSpacer(10)
         self.sizer.Add(text, 1)
+        self.sizer.AddSpacer(5)
 
         self.width = wx.TextCtrl(self, -1, "1")
         self.width.SetInsertionPoint(0)
-        self.sizer.Add(self.width, 1)
+        self.sizer.Add(self.width, 1, wx.EXPAND)
+        self.sizer.AddSpacer(5)
 
         self.choices = outputfile.units.keys()
         self.choices.sort()
         self.units = wx.Choice(self, -1, (85,25), choices=self.choices)
-        self.sizer.Add(self.units, 1)
+        self.sizer.Add(self.units, 1, wx.EXPAND)
+        self.sizer.AddSpacer(5)
 
+        self.cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
         self.ok = wx.Button(self, wx.ID_OK, "OK")
-        self.sizer.Add(self.ok, 1)
+        buttonsizer = wx.BoxSizer(wx.HORIZONTAL)
+        buttonsizer.Add(self.cancel, 0)
+        buttonsizer.Add(self.ok, 0)
+        self.sizer.Add(buttonsizer, 1, wx.EXPAND)
+        self.sizer.AddSpacer(10)
         self.ok.SetDefault()
 
-        self.SetSizer(self.sizer)
+        self.SetSizer(hsizer)
         self.Fit()
 
     def GetData(self):
@@ -155,8 +169,8 @@
 def GetBulkVelocity(outputfile, center):
     dlg = ReasonWidthSelectionWindow(outputfile,
                 "Radius Selector",
-            "With the current display-center, over \n" + \
-            "what radius should bulk velocity be calculated?")
+            "With the current display-center, over what\n" + \
+            "radius should bulk velocity be calculated?")
     resp = dlg.ShowModal()
     bv = None
     if resp == wx.ID_OK:



More information about the yt-svn mailing list