[Yt-svn] yt-commit r429 - in trunk/yt: . reason

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Fri May 2 12:46:00 PDT 2008


Author: mturk
Date: Fri May  2 12:45:59 2008
New Revision: 429
URL: http://yt.spacepope.org/changeset/429

Log:
Closes #79.  Adds new config option reason.minpbar, which is default set to
300.



Modified:
   trunk/yt/config.py
   trunk/yt/funcs.py
   trunk/yt/reason/App.py

Modified: trunk/yt/config.py
==============================================================================
--- trunk/yt/config.py	(original)
+++ trunk/yt/config.py	Fri May  2 12:45:59 2008
@@ -42,6 +42,7 @@
         'width':"600",
         'height':"600",
         'centeronmax':'False',
+        'minpbar':'300',
         },
     "SWIG":{
         'EnzoInterfacePath':'/usr/work/mturk/local/lib/python2.5/site-packages',

Modified: trunk/yt/funcs.py
==============================================================================
--- trunk/yt/funcs.py	(original)
+++ trunk/yt/funcs.py	Fri May  2 12:45:59 2008
@@ -67,6 +67,17 @@
     def finish(sefl, *args, **kwargs):
         return
 
+class GUIProgressBar:
+    def __init__(self, title, maxval):
+        import wx
+        self._pbar = wx.ProgressDialog("Working...",
+                    title, maximum=maxval,
+                    style=wx.PD_REMAINING_TIME|wx.PD_ELAPSED_TIME|wx.PD_APP_MODAL)
+    def update(self, val):
+        self._pbar.Update(val)
+    def finish(self):
+        self._pbar.Destroy()
+
 def just_one(obj):
     if iterable(obj):
         return obj[0]
@@ -76,7 +87,10 @@
     from yt.config import ytcfg
     from yt.logger import lagosLogger as mylog
     if ytcfg.getboolean("yt","inGui"):
-        return DummyProgressBar()
+        if maxval > ytcfg.getint("reason","minpbar"): # Arbitrary number
+            return GUIProgressBar(title, maxval)
+        else:
+            return DummyProgressBar()
     elif ytcfg.getboolean("yt","suppressStreamLogging"):
         return DummyProgressBar()
     widgets = [ title,

Modified: trunk/yt/reason/App.py
==============================================================================
--- trunk/yt/reason/App.py	(original)
+++ trunk/yt/reason/App.py	Fri May  2 12:45:59 2008
@@ -37,6 +37,7 @@
         kwds["title"] = "yt - Reason"
         kwds["size"] = (ytcfg.getint("reason","width"),
                         ytcfg.getint("reason","height"))
+        ytcfg.set('yt','inGui','True')
         wx.Frame.__init__(self, *args, **kwds)
 
         self.__setup_controls()



More information about the yt-svn mailing list