Dynamic Report and Tool menus

svn: r325
This commit is contained in:
Don Allingham 2001-08-11 21:43:34 +00:00
parent 43c22b8f3f
commit 0b5eaf9f8b
3 changed files with 121 additions and 3 deletions

View File

@ -276,6 +276,20 @@
</widget>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>reports_menu</name>
<label>_Reports</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>tools_menu</name>
<label>_Tools</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>settings1</name>

View File

@ -2492,6 +2492,106 @@ def bookmark_callback(obj,person):
def on_preferences_activate(obj):
Config.display_preferences_box()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def build_report_menu(report_item):
report_menu = GtkMenu()
report_menu.show()
report_item.set_submenu(report_menu)
hash = {}
for report in Plugins.reports:
if report.__dict__.has_key("get_name"):
doc = report.get_name()
else:
doc = report.__doc__
info = string.split(doc,"/")
if hash.has_key(info[0]):
hash[info[0]].append((info[1],report.report))
else:
hash[info[0]] = [(info[1],report.report)]
catlist = hash.keys()
catlist.sort()
for key in catlist:
entry = GtkMenuItem(key)
entry.show()
report_menu.append(entry)
submenu = GtkMenu()
submenu.show()
entry.set_submenu(submenu)
list = hash[key]
list.sort()
for name in list:
subentry = GtkMenuItem(name[0])
subentry.show()
subentry.connect("activate",menu_report,name[1])
submenu.append(subentry)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def menu_report(obj,task):
if active_person:
task(database,active_person)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def build_tools_menu(report_item):
report_menu = GtkMenu()
report_menu.show()
report_item.set_submenu(report_menu)
hash = {}
for report in Plugins.tools:
if report.__dict__.has_key("get_name"):
doc = report.get_name()
else:
doc = report.__doc__
info = string.split(doc,"/")
if hash.has_key(info[0]):
hash[info[0]].append((info[1],report.runTool))
else:
hash[info[0]] = [(info[1],report.runTool)]
catlist = hash.keys()
catlist.sort()
for key in catlist:
entry = GtkMenuItem(key)
entry.show()
report_menu.append(entry)
submenu = GtkMenu()
submenu.show()
entry.set_submenu(submenu)
list = hash[key]
list.sort()
for name in list:
subentry = GtkMenuItem(name[0])
subentry.show()
subentry.connect("activate",menu_tools,name[1])
submenu.append(subentry)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def menu_tools(obj,task):
if active_person:
task(database,active_person,update_display)
#-------------------------------------------------------------------------
#
# Main program
@ -2517,6 +2617,9 @@ def main(arg):
Filter.load_filters(path)
gtop = libglade.GladeXML(const.gladeFile, "gramps")
build_report_menu(gtop.get_widget("reports_menu"))
build_tools_menu(gtop.get_widget("tools_menu"))
statusbar = gtop.get_widget("statusbar")
topWindow = gtop.get_widget("gramps")

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"Database Processing/Check database integrity"
"Database Processing/Check and repair database"
import RelLib
import utils
@ -86,6 +86,7 @@ class CheckIntegrity:
break
else:
family.removeChild(child)
utils.modified()
self.broken_links.append((child,family))
#-------------------------------------------------------------------------
@ -233,7 +234,7 @@ class CheckIntegrity:
#
#-------------------------------------------------------------------------
def get_description():
return _("Checks the database for any relationship errors")
return _("Checks the database for integrity problems, fixing the problems that it can")
def get_name():
return _("Database Processing/Check database integrity")
return _("Database Processing/Check and repair database")