From daf542039b535ab52b3b7bd9eb0750647dbb8195 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 21 Feb 2002 15:13:48 +0000 Subject: [PATCH] Graphical output format can be selected, RelDataBase renamed to GrampsDB svn: r788 --- gramps/src/Config.py | 36 ++++++++++++++--- gramps/src/Plugins.py | 15 +++++++- gramps/src/ReadXML.py | 2 +- gramps/src/RelLib.py | 6 +-- gramps/src/gramps_main.py | 2 +- gramps/src/preferences.glade | 75 +++++++++++++++++++++++++++++------- 6 files changed, 111 insertions(+), 25 deletions(-) diff --git a/gramps/src/Config.py b/gramps/src/Config.py index a5659c244..76ddc656f 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -137,8 +137,9 @@ attr_name = "" status_bar = 0 toolbar = 2 calendar = 0 -paper_preference = None -output_preference = None +paper_preference = "" +output_preference = "" +goutput_preference = "" lastnamegen = None report_dir = "./" web_dir = "./" @@ -212,6 +213,7 @@ def loadConfig(call): global _callback global paper_preference global output_preference + global goutput_preference global lastnamegen global report_dir global web_dir @@ -254,6 +256,7 @@ def loadConfig(call): dateEntry = get_int("/gramps/config/dateEntry") paper_preference = get_string("/gramps/config/paperPreference") output_preference = get_string("/gramps/config/outputPreference") + goutput_preference = get_string("/gramps/config/goutputPreference") lastnamegen = get_int("/gramps/config/surnameGuessing") _name_format = get_int("/gramps/config/nameFormat") @@ -298,7 +301,10 @@ def loadConfig(call): paper_preference = "Letter" if output_preference == None: - output_preference = "OpenOffice" + output_preference = "" + + if goutput_preference == None: + goutput_preference = "" if iprefix == None: iprefix = "I" @@ -571,6 +577,7 @@ class GrampsPreferences: self.tree = self.top.get_widget("tree") self.panel = self.top.get_widget("panel") self.ofmt = self.top.get_widget("output_format") + self.gfmt = self.top.get_widget("graphical_format") self.build_tree() self.build() @@ -688,8 +695,6 @@ class GrampsPreferences: lastnamegen_obj.set_menu(menu) menu = gtk.GtkMenu() - choice = 0 - choice = 0 index = 0 for name in Plugins.get_text_doc_list(): @@ -704,6 +709,21 @@ class GrampsPreferences: menu.set_active(choice) self.ofmt.set_menu(menu) + menu = gtk.GtkMenu() + choice = 0 + index = 0 + for name in Plugins.get_draw_doc_list(): + if name == goutput_preference: + choice = index + item = gtk.GtkMenuItem(name) + item.set_data(DATA,name) + item.connect("activate", self.on_format_toggled) + item.show() + menu.append(item) + index = index + 1 + menu.set_active(choice) + self.gfmt.set_menu(menu) + date_option = self.top.get_widget("date_format") date_menu = gtk.GtkMenu() for index in range(0,len(_date_format_list)): @@ -884,6 +904,7 @@ class GrampsPreferences: global hide_altnames global paper_preference global output_preference + global goutput_preference global show_detail global report_dir global web_dir @@ -911,7 +932,8 @@ class GrampsPreferences: index_visible = self.top.get_widget("show_child_id").get_active() hide_altnames = self.top.get_widget("display_altnames").get_active() paper_obj = self.top.get_widget("paper_size").get_menu().get_active() - output_obj = self.top.get_widget("output_format").get_menu().get_active() + output_obj = self.ofmt.get_menu().get_active() + goutput_obj = self.gfmt.get_menu().get_active() if self.top.get_widget("stat1").get_active(): status_bar = 0 @@ -957,6 +979,7 @@ class GrampsPreferences: paper_preference = paper_obj.get_data(DATA) output_preference = output_obj.get_data(DATA) + goutput_preference = goutput_obj.get_data(DATA) set_bool("/gramps/config/UseTabs",usetabs) set_bool("/gramps/config/UseLDS",uselds) @@ -978,6 +1001,7 @@ class GrampsPreferences: set_string("/gramps/config/DisplayAttrName",attr_name) set_string("/gramps/config/paperPreference",paper_preference) set_string("/gramps/config/outputPreference",output_preference) + set_string("/gramps/config/goutputPreference",goutput_preference) set_bool("/gramps/config/autoLoad",autoload) set_int("/gramps/config/autoSaveInterval",autosave_int) diff --git a/gramps/src/Plugins.py b/gramps/src/Plugins.py index 28dbe2c94..543e6b415 100644 --- a/gramps/src/Plugins.py +++ b/gramps/src/Plugins.py @@ -506,6 +506,19 @@ def get_text_doc_list(): l.append(item[0]) return l +#------------------------------------------------------------------------- +# +# get_draw_doc_list +# +#------------------------------------------------------------------------- +def get_draw_doc_list(): + + l = [] + _drawdoc.sort() + for item in _drawdoc: + l.append(item[0]) + return l + #------------------------------------------------------------------------- # # get_draw_doc_menu @@ -523,7 +536,7 @@ def get_draw_doc_menu(main_menu,callback=None,obj=None): menuitem.connect("activate",callback) menuitem.show() myMenu.append(menuitem) - if name == Config.output_preference: + if name == Config.goutput_preference: myMenu.set_active(index) if callback: callback(menuitem) diff --git a/gramps/src/ReadXML.py b/gramps/src/ReadXML.py index dc4991209..565431f93 100644 --- a/gramps/src/ReadXML.py +++ b/gramps/src/ReadXML.py @@ -205,7 +205,7 @@ if __name__ == "__main__": import sys import time - database = RelDataBase() + database = GrampsDB() t1 = time.time() if len(sys.argv) > 2: profile.run('loadData(database, sys.argv[1])') diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index d3cfc8e91..df3b95b9f 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -1636,11 +1636,11 @@ class SourceRef: # # #------------------------------------------------------------------------- -class RelDataBase: +class GrampsDB: """Gramps database object""" def __init__(self): - """creates a new RelDataBase""" + """creates a new GrampsDB""" self.iprefix = "I%d" self.sprefix = "S%d" self.oprefix = "O%d" @@ -1683,7 +1683,7 @@ class RelDataBase: self.fprefix = val + "%d" def new(self): - """initializes the RelDataBase to empty values""" + """initializes the GrampsDB to empty values""" # eliminate memory reference cycles for 1.5.2 garbage collection for f in self.familyMap.values(): diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index bb02e56e7..57430a951 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -2029,7 +2029,7 @@ def main(arg): msg = _("You are running GRAMPS as the 'root' user.\nThis account is not meant for normal application use.") gnome.ui.GnomeWarningDialog(msg) - database = RelDataBase() + database = GrampsDB() Plugins.load_plugins(const.docgenDir) Plugins.load_plugins(os.path.expanduser("~/.gramps/docgen")) diff --git a/gramps/src/preferences.glade b/gramps/src/preferences.glade index 9dca7700e..b5e6c63ab 100644 --- a/gramps/src/preferences.glade +++ b/gramps/src/preferences.glade @@ -2214,8 +2214,8 @@ GtkTable - table8 - 4 + graphical_format + 5 3 False 0 @@ -2224,7 +2224,7 @@ GtkLabel label26 - + GTK_JUSTIFY_CENTER False 1 @@ -2260,8 +2260,8 @@ 0 1 - 1 - 2 + 2 + 3 5 5 False @@ -2286,8 +2286,8 @@ 0 1 - 2 - 3 + 3 + 4 5 5 False @@ -2312,8 +2312,8 @@ 0 1 - 3 - 4 + 4 + 5 5 5 False @@ -2336,8 +2336,8 @@ 1 3 - 2 - 3 + 3 + 4 5 5 True @@ -2378,8 +2378,8 @@ 1 3 - 3 - 4 + 4 + 5 5 5 True @@ -2438,6 +2438,55 @@ True Letter A4 + + 0 + + 1 + 2 + 2 + 3 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label100 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 5 + 5 + False + False + False + False + True + False + + + + + GtkOptionMenu + graphical_format + True + 0