diff --git a/src/StartupDialog.py b/src/StartupDialog.py index 741bc8aa6..2529a0411 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,10 +41,10 @@ def need_to_run(): class StartupDialog: - def __init__(self,task,arg): + def __init__(self,task,args): self.task = task - self.arg = arg + self.args = args self.w = gtk.Window() self.fg_color = gtk.gdk.color_parse('#7d684a') @@ -69,7 +69,7 @@ class StartupDialog: self.w.show_all() def close(self,obj): - self.task(self.arg) + self.task(self.args) def build_page1(self): p = gnome.ui.DruidPageEdge(0) @@ -130,7 +130,7 @@ class StartupDialog: self.client.set_int("/apps/gramps/UseLDS",self.lds.get_active()) self.client.set_int(_StartupEntry,const.startup) self.w.destroy() - self.task(self.arg) + self.task(self.args) def build_page2(self): p = gnome.ui.DruidPageStandard() diff --git a/src/const.py.in b/src/const.py.in index 2c71ea723..ac0619b25 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -134,6 +134,27 @@ male = _("male") female = _("female") unknown = _("unknown") +#------------------------------------------------------------------------- +# +# Options Constants +# +#------------------------------------------------------------------------- + +longopts = [ + "load-modules=", + "help", + "usage", + "oaf-ior-fd=", + "oaf-activate-iid=", + "oaf-private", + "disable-sound", + "enable-sound", + "espeaker=", + "version", + ] + +shortopts = "i:o:f:a:?" + #------------------------------------------------------------------------- # # Constants diff --git a/src/gramps.py b/src/gramps.py index 930fc1a26..979831abb 100755 --- a/src/gramps.py +++ b/src/gramps.py @@ -1,4 +1,23 @@ #! /usr/bin/python -O +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2003 Donald N. Allinghamg +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# import sys import os @@ -43,18 +62,15 @@ import gtk #------------------------------------------------------------------------- import gramps_main -if len(sys.argv) > 1: - arg = sys.argv[1] -else: - arg = None +args = sys.argv[1:] try: import StartupDialog if StartupDialog.need_to_run(): - StartupDialog.StartupDialog(gramps_main.Gramps,arg) + StartupDialog.StartupDialog(gramps_main.Gramps,args) else: - gramps_main.Gramps(arg) + gramps_main.Gramps(args) except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/src/gramps_main.py b/src/gramps_main.py index 6f6b7eff9..905396062 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1,8 +1,7 @@ -#! /usr/bin/python -O # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allinghamg +# Copyright (C) 2000-2003 Donald N. Allinghamg # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,6 +25,7 @@ #------------------------------------------------------------------------- import string import os +import getopt #------------------------------------------------------------------------- # @@ -97,7 +97,7 @@ _sel_mode = gtk.SELECTION_MULTIPLE #------------------------------------------------------------------------- class Gramps: - def __init__(self,arg): + def __init__(self,args): self.pl_titles = [ (_('Name'),5,250), (_('ID'),1,50),(_('Gender'),2,70), (_('Birth date'),6,150),(_('Death date'),7,150), ('',5,0), @@ -140,11 +140,66 @@ class Gramps: self.relationship = Plugins.relationship_function() self.init_interface() - if arg != None: - if string.upper(arg[-3:]) == "GED": - self.read_gedcom(arg) - else: - self.read_file(arg) + self.cl = 0 + if args: + options,leftargs = getopt.getopt(args, + const.shortopts,const.longopts) + if leftargs: + print "Unrecognized option: %s" % leftargs[0] + return + outfile = '' + action = '' + for opt_ix in range(len(options)): + o = options[opt_ix][0][1] + if o == '-': + continue + elif o == 'i': + fname = options[opt_ix][1] + if opt_ix