Add --autoimport command argument

This commit is contained in:
Eric Blade 2010-11-27 19:32:28 -05:00
parent f94ad0126a
commit e2b86eb239
3 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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()

View File

@ -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):