Graphical output format can be selected, RelDataBase renamed to GrampsDB

svn: r788
This commit is contained in:
Don Allingham 2002-02-21 15:13:48 +00:00
parent 2381ee659b
commit 8285071eee
6 changed files with 111 additions and 25 deletions

View File

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

View File

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

View File

@ -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])')

View File

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

View File

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

View File

@ -2214,8 +2214,8 @@
<widget>
<class>GtkTable</class>
<name>table8</name>
<rows>4</rows>
<name>graphical_format</name>
<rows>5</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -2224,7 +2224,7 @@
<widget>
<class>GtkLabel</class>
<name>label26</name>
<label>Preferred Output Format</label>
<label>Preferred Text Format</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
@ -2260,8 +2260,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
@ -2286,8 +2286,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
@ -2312,8 +2312,8 @@
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
@ -2336,8 +2336,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
@ -2378,8 +2378,8 @@
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
@ -2438,6 +2438,55 @@
<can_focus>True</can_focus>
<items>Letter
A4
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label100</name>
<label>Preferred Graphical Format</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>graphical_format</name>
<can_focus>True</can_focus>
<items>
</items>
<initial_choice>0</initial_choice>
<child>