From 99535cddbbffc4f3e81a8b51a586aad363432926 Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Sun, 28 Nov 2010 20:15:09 -0500 Subject: [PATCH] cleanups --- pyfpdb/GuiAutoImport.py | 7 ++----- pyfpdb/fpdb.pyw | 10 +++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index b6d7bcaf..03bec89d 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -204,16 +204,13 @@ class GuiAutoImport (threading.Thread): # That is not correct. It should open another dir for importing while piping the # results to the same pipe. This means that self.path should be a a list of dirs # to watch. - if data == "autostart": + if data == "autostart" or (widget == self.startButton and self.startButton.get_active()): self.startButton.set_active(True) - return - - if widget == self.startButton and self.startButton.get_active(): # - Does the lock acquisition need to be more sophisticated for multiple dirs? # (see comment above about what to do if pipe already open) # - Ideally we want to release the lock if the auto-import is killed by some # kind of exception - is this possible? - if self.settings['global_lock'].acquire(False, source="AutoImport"): # returns false immediately if lock not acquired + if self.settings['global_lock'].acquire(wait=False, source="AutoImport"): # returns false immediately if lock not acquired self.addText(_("\nGlobal lock taken ... Auto Import Started.\n")) self.doAutoImportBool = True self.startButton.set_label(_(u' _Stop Auto Import ')) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 53f74aa4..e7663007 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -75,7 +75,7 @@ try: pygtk.require('2.0') import gtk import pango -except: +except ImportError: print _("Unable to load PyGTK modules required for GUI. Please install PyCairo, PyGObject, and PyGTK from www.pygtk.org.") raw_input(_("Press ENTER to continue.")) exit() @@ -86,18 +86,18 @@ import interlocks try: import matplotlib matplotlib_version = matplotlib.__version__ -except: +except ImportError: matplotlib_version = 'not found' try: import numpy numpy_version = numpy.__version__ -except: +except ImportError: numpy_version = 'not found' try: import sqlite3 sqlite3_version = sqlite3.version sqlite_version = sqlite3.sqlite_version -except: +except ImportError: sqlite3_version = 'not found' sqlite_version = 'not found' @@ -203,7 +203,7 @@ class fpdb: gtk.Button.set_relief(button, gtk.RELIEF_NONE) settings = gtk.Widget.get_settings(button); (w,h) = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_SMALL_TOOLBAR); - gtk.Widget.set_size_request (button, w + 4, h + 4); + gtk.Widget.set_size_request(button, w + 4, h + 4); image.show() iconBox.pack_start(image, True, False, 0) button.add(iconBox)