From e2b86eb239320f89e95fda78ab0c2e1160fef55b Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Sat, 27 Nov 2010 19:32:28 -0500 Subject: [PATCH] Add --autoimport command argument --- pyfpdb/GuiAutoImport.py | 2 +- pyfpdb/Options.py | 2 ++ pyfpdb/fpdb.pyw | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index 59fe808c..3cc816ed 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -204,7 +204,7 @@ 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 widget.get_active(): # toggled on + if widget.get_active() or data == "autostart": # toggled on # - 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 diff --git a/pyfpdb/Options.py b/pyfpdb/Options.py index d66675c5..9f5778ea 100644 --- a/pyfpdb/Options.py +++ b/pyfpdb/Options.py @@ -63,6 +63,8 @@ def fpdb_options(): help=_("X location to open window")) parser.add_option("--yloc", dest="yloc", default=None, type="int", help=_("Y location to open Window")) + parser.add_option("--autoimport", action="store_true", dest="autoimport", + help=_("Auto-start Auto-import")) (options, argv) = parser.parse_args() diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 0135aa26..90ce59e8 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -993,6 +993,9 @@ class fpdb: self.threads.append(new_aimp_thread) aimp_tab=new_aimp_thread.get_vbox() self.add_and_display_tab(aimp_tab, _("Auto Import")) + if options.autoimport: + new_aimp_thread.startClicked(new_aimp_thread.startButton, "autostart") + options.autoimport = False def tab_bulk_import(self, widget, data=None): """opens a tab for bulk importing""" @@ -1177,6 +1180,9 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an self.window.connect('window-state-event', self.window_state_event_cb) sys.stderr.write(_("fpdb starting ...")) + + if options.autoimport: + self.tab_auto_import(None) def __iconify(self):