2006-04-27 Alex Roitman <shura@gramps-project.org>

* src/ViewManager.py (ViewManager.build_plugin_menu): Use unique
	command-line name for action menu.
	* src/plugins/GraphViz.py: Fix report.
	* src/PluginUtils/_PluginMgr.py (_register_standalone): Remove
	unneeded import.
	* src/PluginUtils/_Plugins.py (build_tools_menu, build_report_menu,
	build_plugin_menu, by_menu_name): Remove functions already
	re-implemented in ViewManager.
	* src/plugins/EventCmp.py: Correct button label.
	* src/plugins/StatisticsChart.py: Fix report.



svn: r6481
This commit is contained in:
Alex Roitman 2006-04-28 04:33:28 +00:00
parent 9d695790d0
commit d2698f566a
7 changed files with 35 additions and 103 deletions

View File

@ -1,3 +1,15 @@
2006-04-27 Alex Roitman <shura@gramps-project.org>
* src/ViewManager.py (ViewManager.build_plugin_menu): Use unique
command-line name for action menu.
* src/plugins/GraphViz.py: Fix report.
* src/PluginUtils/_PluginMgr.py (_register_standalone): Remove
unneeded import.
* src/PluginUtils/_Plugins.py (build_tools_menu, build_report_menu,
build_plugin_menu, by_menu_name): Remove functions already
re-implemented in ViewManager.
* src/plugins/EventCmp.py: Correct button label.
* src/plugins/StatisticsChart.py: Fix report.
2006-04-27 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsDbBase.py: fix custom event storing
* src/GrampsDb/_GrampsBSDDB.py: fix custom event storing

View File

@ -293,8 +293,6 @@ def _register_standalone(report_class, options_class, translated_name,
unsupported=False
):
"""Register a report with the plugin system"""
from PluginUtils import Report
del_index = -1
for i in range(0,len(report_list)):

View File

@ -293,86 +293,6 @@ class ToolPlugins(PluginDialog):
_("Run selected tool"),
TOOLS)
#-------------------------------------------------------------------------
#
# Building pulldown menus
#
#-------------------------------------------------------------------------
def build_tools_menu(top_menu,callback):
build_plugin_menu(_PluginMgr.tool_list,
_Tool.tool_categories,
_Tool.gui_tool,
top_menu,callback)
def build_report_menu(top_menu,callback):
build_plugin_menu(_PluginMgr.report_list,
_Report.standalone_categories,
_Report.report,
top_menu,callback)
def build_plugin_menu(item_list,categories,func,top_menu,callback):
menu = gtk.Menu()
menu.show()
hash_data = {}
for item in item_list:
if item[9]:
category = UNSUPPORTED
else:
category = categories[item[3]]
if hash_data.has_key(category):
hash_data[category].append(
(item[0],item[1],item[2],item[4],item[3]))
else:
hash_data[category] = [
(item[0],item[1],item[2],item[4],item[3])]
# Sort categories, skipping the unsupported
catlist = [item for item in hash_data.keys() if item != UNSUPPORTED]
catlist.sort()
for key in catlist:
entry = gtk.MenuItem(key)
entry.show()
menu.append(entry)
submenu = gtk.Menu()
submenu.show()
entry.set_submenu(submenu)
lst = hash_data[key]
lst.sort(by_menu_name)
for name in lst:
subentry = gtk.MenuItem("%s..." % name[2])
subentry.show()
subentry.connect("activate",callback,func,
name[0],name[1],name[2],name[3],name[4])
submenu.append(subentry)
# If there are any unsupported items we add separator
# and the unsupported category at the end of the menu
if hash_data.has_key(UNSUPPORTED):
entry = gtk.MenuItem(None)
entry.show()
menu.append(entry)
key = UNSUPPORTED
entry = gtk.MenuItem(key)
entry.show()
menu.append(entry)
submenu = gtk.Menu()
submenu.show()
entry.set_submenu(submenu)
lst = hash_data[key]
lst.sort(by_menu_name)
for name in lst:
subentry = gtk.MenuItem("%s..." % name[2])
subentry.show()
subentry.connect("activate",callback,func,
name[0],name[1],name[2],name[3],name[4])
submenu.append(subentry)
top_menu.set_submenu(menu)
def by_menu_name(a,b):
return cmp(a[2],b[2])
#-------------------------------------------------------------------------
#
# Reload plugins

View File

@ -1108,7 +1108,8 @@ class ViewManager:
(item[0], item[1], item[2], item[4], item[3])]
# Sort categories, skipping the unsupported
catlist = [item for item in hash_data.keys() if item != Plugins.UNSUPPORTED]
catlist = [item for item in hash_data.keys()
if item != Plugins.UNSUPPORTED]
catlist.sort()
for key in catlist:
new_key = key.replace(' ', '-')
@ -1117,7 +1118,7 @@ class ViewManager:
lst = hash_data[key]
lst.sort(by_menu_name)
for name in lst:
new_key = name[2].replace(' ', '-')
new_key = name[3].replace(' ', '-')
f.write('<menuitem action="%s"/>' % new_key)
actions.append((new_key, None, name[2], None, None,
func(name, self.state, self.uistate)))
@ -1132,7 +1133,7 @@ class ViewManager:
lst = hash_data[key]
lst.sort(by_menu_name)
for name in lst:
new_key = name[2].replace(' ', '-')
new_key = name[3].replace(' ', '-')
f.write('<menuitem action="%s"/>' % new_key)
actions.append((new_key, None, name[2], None, None,
func(name, self.state, self.uistate)))

View File

@ -237,7 +237,6 @@ class DisplayChart(ManagedWindow.ManagedWindow):
"on_write_table" : self.on_write_table,
"destroy_passed_object" : self.close,
"on_help_clicked" : self.on_help_clicked,
"on_view_delete_event" : self.close,
})
window = self.topDialog.get_widget("view")
@ -375,7 +374,7 @@ class DisplayChart(ManagedWindow.ManagedWindow):
action=gtk.FILE_CHOOSER_ACTION_SAVE,
buttons=(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN,
gtk.STOCK_SAVE,
gtk.RESPONSE_OK))
f.set_current_folder(os.getcwd())

View File

@ -244,12 +244,16 @@ class GraphViz:
for person_handle in self.ind_list:
person = self.database.get_person_from_handle(person_handle)
pid = person.get_gramps_id().replace('-','_')
for family_handle, mrel, frel in person.get_parent_family_handle_list():
for family_handle in person.get_parent_family_handle_list():
family = self.database.get_family_from_handle(family_handle)
madopted = False
fadopted = False
for child_ref in family.get_child_ref_list():
if child_ref.ref == person_handle:
fadopted = child_ref.frel != RelLib.ChildRefType.BIRTH
madopted = child_ref.mrel != RelLib.ChildRefType.BIRTH
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
fadopted = frel != RelLib.ChildRefType.BIRTH
madopted = mrel != RelLib.ChildRefType.BIRTH
famid = family.get_gramps_id().replace('-','_')
if (self.show_families and
(father_handle and person_dict.has_key(father_handle) or
@ -765,7 +769,6 @@ class GraphVizDialog(Report.ReportDialog):
self.category = Report.CATEGORY_CODE
Report.ReportDialog.__init__(self,database,person,self.options_class,
name,translated_name)
response = self.window.run()
if response == gtk.RESPONSE_OK:
try:

View File

@ -50,13 +50,13 @@ import gtk
#------------------------------------------------------------------------
# Person and relation types
from RelLib import Person, Family
from RelLib import Person, FamilyRelType, EventType
# gender and report type names
import BaseDoc
from PluginUtils import Report, ReportOptions, ReportUtils, register_report
import GenericFilter
import DateHandler
from Utils import ProgressMeter, format_event
from Utils import ProgressMeter
#------------------------------------------------------------------------
#
@ -252,7 +252,7 @@ class Extract:
person, event_handles = data
for event_handle in event_handles:
event = self.db.get_event_from_handle(event_handle)
evtType = format_event( event.get_type() )
evtType = str(event.get_type())
types.append(evtType)
if types:
return types
@ -336,8 +336,8 @@ class Extract:
children = []
for fam_handle in person.get_family_handle_list():
fam = self.db.get_family_from_handle(fam_handle)
for child_handle in fam.get_child_handle_list():
children.append(child_handle)
for child_ref in fam.get_child_ref_list():
children.append(child_ref.ref)
# TODO: it would be good to return only biological children,
# but GRAMPS doesn't offer any efficient way to check that
# (I don't want to check each children's parent family mother
@ -351,12 +351,11 @@ class Extract:
marriages = []
for family_handle in person.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
if family.get_relationship() == Family.MARRIED:
for event_handle in family.get_event_list():
if event_handle:
event = self.db.get_event_from_handle(event_handle)
if event.get_name() == "Marriage":
marriages.append(event_handle)
if int(family.get_relationship()) == FamilyRelType.MARRIED:
for event_ref in family.get_event_ref_list():
event = self.db.get_event_from_handle(event_ref.ref)
if int(event.get_type()) == EventType.MARRIAGE:
marriages.append(event_ref.ref)
if marriages:
return (person, marriages)
return None
@ -373,7 +372,7 @@ class Extract:
"return list of event handles for given person or None"
events = []
for event_ref in person.get_event_ref_list():
events.append( event_ref.get_reference_handle())
events.append(event_ref.ref)
if events:
return (person, events)