diff --git a/ChangeLog b/ChangeLog index e08d46d1e..48eda647c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-16 Don Allingham + * src/GrampsCfg.py: additional database path + * src/Config/_GrampsConfigKeys.py: additional database path + * src/DbManager.py: additional database path + * src/GrampsDbUtils/Makefile.am: additional database path + * src/Makefile.am: additional database path + * data/gramps.schemas.in: additional database path + 2007-06-16 Brian Pepple * data/gramps.desktop.in: Fix desktop file to conform to desktop file specs. diff --git a/data/gramps.schemas.in b/data/gramps.schemas.in index d933cb3ba..412138724 100644 --- a/data/gramps.schemas.in +++ b/data/gramps.schemas.in @@ -598,6 +598,18 @@ + + /schemas/apps/gramps/behavior/database-path + /apps/gramps/behavior/database-path + gramps + string + + + Additional path where the databases may reside + Additional path where the databases may reside + + + /schemas/apps/gramps/preferences/fprefix /apps/gramps/preferences/fprefix diff --git a/src/Config/_GrampsConfigKeys.py b/src/Config/_GrampsConfigKeys.py index 26a3f656d..5d3f60552 100644 --- a/src/Config/_GrampsConfigKeys.py +++ b/src/Config/_GrampsConfigKeys.py @@ -39,6 +39,7 @@ USE_LAST_VIEW = ('preferences','use-last-view', 0) FAMILY_SIBLINGS = ('preferences','family-siblings', 0) AUTOLOAD = ('behavior','autoload', 0) ENABLE_AUTOBACKUP = ('behavior','enable-autobackup', 0) +DATABASE_PATH = ('behavior','database-path', 2) SPELLCHECK = ('behavior','spellcheck', 0) BETAWARN = ('behavior','betawarn', 0) WELCOME = ('behavior','welcome', 1) diff --git a/src/DbManager.py b/src/DbManager.py index 66a87f74c..c67fbfeaa 100644 --- a/src/DbManager.py +++ b/src/DbManager.py @@ -117,22 +117,22 @@ class DbManager: self.current_names = [] - self.connect_signals() - self.build_interface() - self.populate() + self.__connect_signals() + self.__build_interface() + self.__populate() - def connect_signals(self): + def __connect_signals(self): """ Connects the signals to the buttons on the interface. """ - self.remove.connect('clicked', self.remove_db) - self.new.connect('clicked', self.new_db) - self.rename.connect('clicked', self.rename_db) - self.repair.connect('clicked', self.repair_db) - self.selection.connect('changed', self.selection_changed) - self.dblist.connect('button-press-event', self.button_press) + self.remove.connect('clicked', self.__remove_db) + self.new.connect('clicked', self.__new_db) + self.rename.connect('clicked', self.__rename_db) + self.repair.connect('clicked', self.__repair_db) + self.selection.connect('changed', self.__selection_changed) + self.dblist.connect('button-press-event', self.__button_press) - def button_press(self, obj, event): + def __button_press(self, obj, event): """ Checks for a double click event. In the tree view, we want to treat a double click as if it was OK button press. However, we have @@ -145,7 +145,7 @@ class DbManager: return True return False - def selection_changed(self, selection): + def __selection_changed(self, selection): """ Called with the selection is changed in the TreeView. What we are trying to detect is the selection or unselection of a row. @@ -180,7 +180,7 @@ class DbManager: self.remove.set_sensitive(True) - def build_interface(self): + def __build_interface(self): """ Builds the columns for the TreeView. The columns are: @@ -204,7 +204,7 @@ class DbManager: # build the database name column render = gtk.CellRendererText() render.set_property('editable', True) - render.connect('edited', self.change_name) + render.connect('edited', self.__change_name) self.column = gtk.TreeViewColumn(_('Family tree name'), render, text=NAME_COL) self.dblist.append_column(self.column) @@ -217,7 +217,7 @@ class DbManager: # set the rules hit self.dblist.set_rules_hint(True) - def populate(self): + def __populate(self): """ Builds the display model. """ @@ -231,20 +231,29 @@ class DbManager: except (IOError, OSError), msg: LOG.error(_("Could not make database directory: ") + str(msg)) + additional = Config.get(Config.DATABASE_PATH).strip() + + pathlist = [ DEFAULT_DIR ] + + if os.path.isdir(additional): + pathlist.append(additional) + self.current_names = [] - for dpath in os.listdir(DEFAULT_DIR): - dirpath = os.path.join(DEFAULT_DIR, dpath) - path_name = os.path.join(dirpath, NAME_FILE) - if os.path.isfile(path_name): - name = file(path_name).readline().strip() + + for path in pathlist: + for dpath in os.listdir(path): + dirpath = os.path.join(path, dpath) + path_name = os.path.join(dirpath, NAME_FILE) + if os.path.isfile(path_name): + name = file(path_name).readline().strip() - (tval, last) = time_val(dirpath) - (enable, stock_id) = icon_values(dirpath, self.active, - self.dbstate.db.is_open()) + (tval, last) = time_val(dirpath) + (enable, stock_id) = icon_values(dirpath, self.active, + self.dbstate.db.is_open()) - self.current_names.append( - (name, os.path.join(DEFAULT_DIR, dpath), path_name, - last, tval, enable, stock_id)) + self.current_names.append( + (name, os.path.join(DEFAULT_DIR, dpath), path_name, + last, tval, enable, stock_id)) self.current_names.sort() for items in self.current_names: @@ -268,7 +277,7 @@ class DbManager: self.top.destroy() return None - def change_name(self, text, path, new_text): + def __change_name(self, text, path, new_text): """ Changes the name of the database. This is a callback from the column, which has been marked as editable. @@ -289,7 +298,7 @@ class DbManager: _("Could not rename family tree"), str(msg)) - def remove_db(self, obj): + def __remove_db(self, obj): """ Callback associated with the Remove button. Get the selected row and data, then call the verification dialog. @@ -301,12 +310,12 @@ class DbManager: _("Remove the '%s' database?") % self.data_to_delete[0], _("Removing this database will permanently destroy the data."), _("Remove database"), - self.really_delete_db) + self.__really_delete_db) # rebuild the display - self.populate() + self.__populate() - def really_delete_db(self): + def __really_delete_db(self): """ Delete the selected database. If the databse is open, close it first. Then scan the database directory, deleting the files, and finally @@ -327,7 +336,7 @@ class DbManager: QuestionDialog.ErrorDialog(_("Could not delete family tree"), str(msg)) - def rename_db(self, obj): + def __rename_db(self, obj): """ Start the rename process by calling the start_editing option on the line with the cursor. @@ -337,7 +346,7 @@ class DbManager: self.dblist.set_cursor(path, focus_column=self.column, start_editing=True) - def repair_db(self, obj): + def __repair_db(self, obj): """ Start the rename process by calling the start_editing option on the line with the cursor. @@ -369,21 +378,21 @@ class DbManager: self.msg.set_label("") db.close() self.dbstate.no_database() - self.populate() + self.__populate() - def new_db(self, obj): + def __new_db(self, obj): """ Callback wrapper around the actual routine that creates the new database. Catch OSError and IOError and display a warning message. """ try: - self.mk_db() + self.__create_new_db() except (OSError, IOError), msg: QuestionDialog.ErrorDialog(_("Could not create family tree"), str(msg)) - def mk_db(self): + def __create_new_db(self): """ Create a new database. """ diff --git a/src/GrampsCfg.py b/src/GrampsCfg.py index df8e739e3..e1ed9a43c 100644 --- a/src/GrampsCfg.py +++ b/src/GrampsCfg.py @@ -112,6 +112,8 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): self.window.connect('response',self.done) panel.append_page(self.add_behavior_panel(), MarkupLabel(_('General'))) + panel.append_page(self.add_database_panel(), + MarkupLabel(_('Database'))) panel.append_page(self.add_formats_panel(), MarkupLabel(_('Display'))) panel.append_page(self.add_name_panel(), @@ -495,27 +497,36 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): table.set_col_spacings(6) table.set_row_spacings(6) - self.add_checkbox(table, _('Automatically backup database on exit'), - 0, Config.ENABLE_AUTOBACKUP) - self.add_checkbox(table, _('Automatically load last database'), - 1, Config.AUTOLOAD) - self.add_checkbox(table, _('Enable database transactions'), - 2, Config.TRANSACTIONS) self.add_checkbox(table, _('Add default source on import'), - 3, Config.DEFAULT_SOURCE) + 0, Config.DEFAULT_SOURCE) self.add_checkbox(table, _('Enable spelling checker'), - 4, Config.SPELLCHECK) + 1, Config.SPELLCHECK) self.add_checkbox(table, _('Display Tip of the Day'), - 5, Config.USE_TIPS) + 2, Config.USE_TIPS) self.add_checkbox(table, _('Use shading in Relationship View'), - 6, Config.RELATION_SHADE) + 3, Config.RELATION_SHADE) self.add_checkbox(table, _('Display edit buttons on Relationship View'), - 7, Config.RELEDITBTN) + 4, Config.RELEDITBTN) self.add_checkbox(table, _('Remember last view displayed'), - 8, Config.USE_LAST_VIEW) + 5, Config.USE_LAST_VIEW) return table + def add_database_panel(self): + table = gtk.Table(3,8) + table.set_border_width(12) + table.set_col_spacings(6) + table.set_row_spacings(6) + + self.add_entry(table, _('Database path'), 0, Config.DATABASE_PATH) + self.add_checkbox(table, _('Automatically backup database on exit'), + 1, Config.ENABLE_AUTOBACKUP) + self.add_checkbox(table, _('Automatically load last database'), + 2, Config.AUTOLOAD) + self.add_checkbox(table, _('Enable database transactions'), + 3, Config.TRANSACTIONS) + return table + def add_checkbox(self, table, label, index, constant): checkbox = gtk.CheckButton(label) checkbox.set_active(Config.get(constant)) diff --git a/src/GrampsDbUtils/Makefile.am b/src/GrampsDbUtils/Makefile.am index c03a4d63c..3ecfaa4bc 100644 --- a/src/GrampsDbUtils/Makefile.am +++ b/src/GrampsDbUtils/Makefile.am @@ -6,20 +6,20 @@ pkgdatadir = $(datadir)/@PACKAGE@/GrampsDbUtils pkgdata_PYTHON = \ - _GedcomInfo.py\ - _GedcomTokens.py\ - _GedcomParse.py\ + _Backup.py\ _GedcomChar.py\ - _GedcomUtils.py\ + _GedcomInfo.py\ _GedcomLex.py\ + _GedcomParse.py\ + _GedcomTokens.py\ + _GedcomUtils.py\ + _GrampsDbWRFactories.py\ __init__.py\ _ReadGedcom.py\ - _ReadGrdb.py\ _ReadXML.py\ _WriteGedcom.py\ _WriteGrdb.py\ - _WriteXML.py\ - _GrampsDbWRFactories.py + _WriteXML.py pkgpyexecdir = @pkgpyexecdir@/GrampsDbUtils pkgpythondir = @pkgpythondir@/GrampsDbUtils diff --git a/src/Makefile.am b/src/Makefile.am index 1c3d0e8f7..f5daa38da 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -94,6 +94,7 @@ pycheck: docs: epydoc -v -o html --html --exclude gtk --no-private --show-imports --url=http://gramps-project.org --graph=umlclasstree $(docmodules) + epydoc -v -o pdf --pdf --exclude gtk --no-private --show-imports --url=http://gramps-project.org --graph=umlclasstree $(docmodules) cmdplug: ./build_cmdplug diff --git a/src/Simple/_SimpleDoc.py b/src/Simple/_SimpleDoc.py index 6fee57f83..65bc24fbf 100644 --- a/src/Simple/_SimpleDoc.py +++ b/src/Simple/_SimpleDoc.py @@ -25,7 +25,7 @@ import BaseDoc class SimpleDoc: """ -Provides a simplified database access interface to the GRAMPS database. + Provides a simplified database access interface to the GRAMPS database. """ def __init__(self, doc):