More updates to better support MenuOptions. FamilyLines seems to work now.
svn: r9634
This commit is contained in:
parent
07bdb19028
commit
e0543b0644
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
|||||||
|
2007-12-29 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/ReportBase/_GraphvizReportDialog.py:
|
||||||
|
* src/ReportBase/_BareReportDialog.py:
|
||||||
|
* src/ReportBase/_ReportOptions.py:
|
||||||
|
* src/plugins/DescendReport.py:
|
||||||
|
* src/plugins/DetDescendantReport.py:
|
||||||
|
* src/plugins/CalculateEstimatedDates.py:
|
||||||
|
* src/plugins/Calendar.py:
|
||||||
|
* src/plugins/GVFamilyLines.py:
|
||||||
|
* src/plugins/AncestorReport.py:
|
||||||
|
* src/plugins/DescendChart.py:
|
||||||
|
* src/plugins/EndOfLineReport.py:
|
||||||
|
* src/plugins/AncestorChart.py:
|
||||||
|
* src/plugins/DetAncestralReport.py:
|
||||||
|
* src/plugins/FamilyGroup.py:
|
||||||
|
* src/plugins/GVRelGraph.py:
|
||||||
|
* src/plugins/GVHourGlass.py:
|
||||||
|
* src/plugins/FamilyLines.py:
|
||||||
|
* src/plugins/FanChart.py:
|
||||||
|
* src/DbState.py:
|
||||||
|
* src/PluginUtils/__init__.py:
|
||||||
|
* src/PluginUtils/_MenuOptions.py:
|
||||||
|
* src/BaseDoc.py:
|
||||||
|
More updates to better support MenuOptions. FamilyLines seems to work now.
|
||||||
|
|
||||||
2007-12-29 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
2007-12-29 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
* src/DataViews/MyGrampsView.py: show matching surnames
|
* src/DataViews/MyGrampsView.py: show matching surnames
|
||||||
* src/plugins/OnThisDay.py: refinement
|
* src/plugins/OnThisDay.py: refinement
|
||||||
|
@ -1599,3 +1599,22 @@ class GVDoc:
|
|||||||
@return: nothing
|
@return: nothing
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def start_subgraph(self,id):
|
||||||
|
"""
|
||||||
|
Start a subgraph in this graph.
|
||||||
|
|
||||||
|
@param id: The unique identifier of the subgraph.
|
||||||
|
Example: "p55"
|
||||||
|
@type id1: string
|
||||||
|
@return: nothing
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def end_subgraph(self):
|
||||||
|
"""
|
||||||
|
End a subgraph that was previously started in this graph.
|
||||||
|
|
||||||
|
@return: nothing
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
@ -119,3 +119,9 @@ class DbState(GrampsDBCallback):
|
|||||||
self.active = None
|
self.active = None
|
||||||
self.open = False
|
self.open = False
|
||||||
self.emit('database-changed', (self.db, ))
|
self.emit('database-changed', (self.db, ))
|
||||||
|
|
||||||
|
def get_database(self):
|
||||||
|
"""
|
||||||
|
Gets a reference to the current database.
|
||||||
|
"""
|
||||||
|
return self.db
|
||||||
|
@ -31,6 +31,7 @@ import gobject
|
|||||||
import _Tool as Tool
|
import _Tool as Tool
|
||||||
import GrampsWidgets
|
import GrampsWidgets
|
||||||
from Selectors import selector_factory
|
from Selectors import selector_factory
|
||||||
|
from BasicUtils import name_displayer as _nd
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -595,7 +596,7 @@ class PeoplePickerOption(Option):
|
|||||||
This class describes a widget that allows
|
This class describes a widget that allows
|
||||||
people from the database to be selected.
|
people from the database to be selected.
|
||||||
"""
|
"""
|
||||||
def __init__(self, label, value, db):
|
def __init__(self, label, value, dbstate):
|
||||||
"""
|
"""
|
||||||
@param label: A friendly label to be applied to this option.
|
@param label: A friendly label to be applied to this option.
|
||||||
Example: "People of interest"
|
Example: "People of interest"
|
||||||
@ -605,13 +606,16 @@ class PeoplePickerOption(Option):
|
|||||||
@type value: set()
|
@type value: set()
|
||||||
@return: nothing
|
@return: nothing
|
||||||
"""
|
"""
|
||||||
self.db = db
|
self.db = dbstate.get_database()
|
||||||
|
self.dbstate = dbstate
|
||||||
Option.__init__(self,label,value)
|
Option.__init__(self,label,value)
|
||||||
|
|
||||||
def make_gui_obj(self, gtk, dialog):
|
def make_gui_obj(self, gtk, dialog):
|
||||||
"""
|
"""
|
||||||
Add a "people picker" widget to the dialog.
|
Add a "people picker" widget to the dialog.
|
||||||
"""
|
"""
|
||||||
|
self.dialog = dialog
|
||||||
|
|
||||||
value = self.get_value()
|
value = self.get_value()
|
||||||
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
|
self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||||
self.treeView = gtk.TreeView(self.model)
|
self.treeView = gtk.TreeView(self.model)
|
||||||
@ -633,9 +637,6 @@ class PeoplePickerOption(Option):
|
|||||||
self.hbox = gtk.HBox()
|
self.hbox = gtk.HBox()
|
||||||
self.hbox.pack_start(self.scrolledWindow, expand=True, fill=True)
|
self.hbox.pack_start(self.scrolledWindow, expand=True, fill=True)
|
||||||
|
|
||||||
if not self.db:
|
|
||||||
print "PROBLEM: from where can I obtain or pass in a db parm?"
|
|
||||||
else:
|
|
||||||
for gid in value.split():
|
for gid in value.split():
|
||||||
person = self.db.get_person_from_gramps_id(gid)
|
person = self.db.get_person_from_gramps_id(gid)
|
||||||
if person:
|
if person:
|
||||||
@ -669,9 +670,6 @@ class PeoplePickerOption(Option):
|
|||||||
def addPersonClicked(self, obj):
|
def addPersonClicked(self, obj):
|
||||||
# people we already have must be excluded
|
# people we already have must be excluded
|
||||||
# so we don't list them multiple times
|
# so we don't list them multiple times
|
||||||
if not self.db:
|
|
||||||
print "PROBLEM: this method needs a db parm, and various other things like db, uistate, and track!"
|
|
||||||
|
|
||||||
skipList = set()
|
skipList = set()
|
||||||
iter = self.model.get_iter_first()
|
iter = self.model.get_iter_first()
|
||||||
while (iter):
|
while (iter):
|
||||||
@ -681,7 +679,7 @@ class PeoplePickerOption(Option):
|
|||||||
iter = self.model.iter_next(iter)
|
iter = self.model.iter_next(iter)
|
||||||
|
|
||||||
SelectPerson = selector_factory('Person')
|
SelectPerson = selector_factory('Person')
|
||||||
sel = SelectPerson(self.dbstate, self.uistate, self.track, skip=skipList)
|
sel = SelectPerson(self.dbstate, self.dialog.uistate, self.dialog.track, skip=skipList)
|
||||||
person = sel.run()
|
person = sel.run()
|
||||||
if person:
|
if person:
|
||||||
name = _nd.display(person)
|
name = _nd.display(person)
|
||||||
@ -694,12 +692,18 @@ class PeoplePickerOption(Option):
|
|||||||
if familyList:
|
if familyList:
|
||||||
for familyHandle in familyList:
|
for familyHandle in familyList:
|
||||||
family = self.db.get_family_from_handle(familyHandle)
|
family = self.db.get_family_from_handle(familyHandle)
|
||||||
spouseHandle = ReportUtils.find_spouse(person, family)
|
|
||||||
|
if person.get_handle() == family.get_father_handle():
|
||||||
|
spouseHandle = family.get_mother_handle()
|
||||||
|
else:
|
||||||
|
spouseHandle = family.get_father_handle()
|
||||||
|
|
||||||
if spouseHandle:
|
if spouseHandle:
|
||||||
if spouseHandle not in skipList:
|
if spouseHandle not in skipList:
|
||||||
|
import gtk
|
||||||
spouse = self.db.get_person_from_handle(spouseHandle)
|
spouse = self.db.get_person_from_handle(spouseHandle)
|
||||||
text = _('Also include %s?') % spouse.get_primary_name().get_regular_name()
|
text = _('Also include %s?') % spouse.get_primary_name().get_regular_name()
|
||||||
prompt = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_YES_NO, message_format=text)
|
prompt = gtk.MessageDialog(parent=self.dialog.window, flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_QUESTION, buttons=gtk.BUTTONS_YES_NO, message_format=text)
|
||||||
prompt.set_default_response(gtk.RESPONSE_YES)
|
prompt.set_default_response(gtk.RESPONSE_YES)
|
||||||
prompt.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
|
prompt.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
|
||||||
prompt.set_title(_('Select Person'))
|
prompt.set_title(_('Select Person'))
|
||||||
@ -826,13 +830,13 @@ class Menu:
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class MenuOptions:
|
class MenuOptions:
|
||||||
def __init__(self):
|
def __init__(self,dbstate):
|
||||||
self.menu = Menu()
|
self.menu = Menu()
|
||||||
|
|
||||||
# Fill options_dict with report/tool defaults:
|
# Fill options_dict with report/tool defaults:
|
||||||
self.options_dict = {}
|
self.options_dict = {}
|
||||||
self.options_help = {}
|
self.options_help = {}
|
||||||
self.add_menu_options(self.menu)
|
self.add_menu_options(self.menu,dbstate)
|
||||||
for name in self.menu.get_all_option_names():
|
for name in self.menu.get_all_option_names():
|
||||||
option = self.menu.get_option_by_name(name)
|
option = self.menu.get_option_by_name(name)
|
||||||
self.options_dict[name] = option.get_value()
|
self.options_dict[name] = option.get_value()
|
||||||
@ -841,7 +845,7 @@ class MenuOptions:
|
|||||||
def make_default_style(self,default_style):
|
def make_default_style(self,default_style):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
"""
|
"""
|
||||||
Add the user defined options to the menu.
|
Add the user defined options to the menu.
|
||||||
|
|
||||||
|
@ -58,6 +58,6 @@ class MenuToolOptions(MenuOptions,Tool.ToolOptions):
|
|||||||
"""
|
"""
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,person_id=None):
|
||||||
Tool.ToolOptions.__init__(self,name, person_id)
|
Tool.ToolOptions.__init__(self,name, person_id)
|
||||||
MenuOptions.__init__(self)
|
MenuOptions.__init__(self,None)
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
def init_options(self,option_class):
|
def init_options(self,option_class):
|
||||||
if type(option_class) == ClassType:
|
if type(option_class) == ClassType:
|
||||||
self.options = option_class(self.raw_name)
|
self.options = option_class(self.raw_name,self.dbstate)
|
||||||
elif type(option_class) == InstanceType:
|
elif type(option_class) == InstanceType:
|
||||||
self.options = option_class
|
self.options = option_class
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
|
|||||||
self.rankdir = _RANKDIR[ self.options['rank_dir' ]]['value']
|
self.rankdir = _RANKDIR[ self.options['rank_dir' ]]['value']
|
||||||
self.ranksep = self.options['ranksep' ]
|
self.ranksep = self.options['ranksep' ]
|
||||||
self.ratio = _RATIO[ self.options['ratio' ]]['value']
|
self.ratio = _RATIO[ self.options['ratio' ]]['value']
|
||||||
self.usesubgraphs = self.options['usesubgraphs' ]
|
|
||||||
self.vpages = self.options['v_pages' ]
|
self.vpages = self.options['v_pages' ]
|
||||||
|
|
||||||
paper_size = paper_style.get_size()
|
paper_size = paper_style.get_size()
|
||||||
@ -266,6 +265,13 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
|
|||||||
|
|
||||||
self.dot.write(';\n')
|
self.dot.write(';\n')
|
||||||
|
|
||||||
|
def start_subgraph(self,id):
|
||||||
|
self.dot.write(' subgraph cluster_%s\n' % id)
|
||||||
|
self.dot.write(' {\n')
|
||||||
|
|
||||||
|
def end_subgraph(self):
|
||||||
|
self.dot.write(' }\n')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GVDotDoc
|
# GVDotDoc
|
||||||
@ -680,7 +686,7 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
|
|
||||||
def init_options(self,option_class):
|
def init_options(self,option_class):
|
||||||
if type(option_class) == ClassType:
|
if type(option_class) == ClassType:
|
||||||
self.options = option_class(self.raw_name)
|
self.options = option_class(self.raw_name,self.dbstate)
|
||||||
elif type(option_class) == InstanceType:
|
elif type(option_class) == InstanceType:
|
||||||
self.options = option_class
|
self.options = option_class
|
||||||
|
|
||||||
@ -778,17 +784,6 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
"between columns."))
|
"between columns."))
|
||||||
self.options.add_menu_option(category, "ranksep", ranksep)
|
self.options.add_menu_option(category, "ranksep", ranksep)
|
||||||
|
|
||||||
usesubgraphs = BooleanOption(_('Use subgraphs'), False)
|
|
||||||
usesubgraphs.set_help(_("Subgraphs can help GraphViz position "
|
|
||||||
"certain linked nodes closer together, "
|
|
||||||
"but with non-trivial graphs will result "
|
|
||||||
"in longer lines and larger graphs."))
|
|
||||||
self.options.add_menu_option(category, "usesubgraphs", usesubgraphs)
|
|
||||||
|
|
||||||
# this control only affects a subset of graphviz-based reports, so we
|
|
||||||
# need to remember it since we'll be toggling the visibility
|
|
||||||
self.usesubgraphs = usesubgraphs
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
category = _("Note")
|
category = _("Note")
|
||||||
################################
|
################################
|
||||||
@ -822,14 +817,6 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
else:
|
else:
|
||||||
self.page_dir.combo.set_sensitive(False)
|
self.page_dir.combo.set_sensitive(False)
|
||||||
|
|
||||||
def report_allows_subgraphs(self, state):
|
|
||||||
# if your report can take advantage of subgraphs, call this
|
|
||||||
# method to allow the users to toggle the state of subgraphs
|
|
||||||
if state:
|
|
||||||
self.usesubgraphs.gobj.show()
|
|
||||||
else:
|
|
||||||
self.usesubgraphs.gobj.hide()
|
|
||||||
|
|
||||||
def init_interface(self):
|
def init_interface(self):
|
||||||
ReportDialog.init_interface(self)
|
ReportDialog.init_interface(self)
|
||||||
self.doc_type_changed(self.format_menu)
|
self.doc_type_changed(self.format_menu)
|
||||||
@ -843,10 +830,6 @@ class GraphvizReportDialog(ReportDialog):
|
|||||||
self.v_pages.gobj.connect('value-changed', self.pages_changed)
|
self.v_pages.gobj.connect('value-changed', self.pages_changed)
|
||||||
self.pages_changed(self.h_pages.gobj)
|
self.pages_changed(self.h_pages.gobj)
|
||||||
|
|
||||||
# note that the "use subgraph" option isn't used by many reports,
|
|
||||||
# so we'll hide it unless a reports specifically asks for it
|
|
||||||
self.report_allows_subgraphs(False)
|
|
||||||
|
|
||||||
def setup_format_frame(self):
|
def setup_format_frame(self):
|
||||||
"""Set up the format frame of the dialog."""
|
"""Set up the format frame of the dialog."""
|
||||||
|
|
||||||
|
@ -663,8 +663,12 @@ class MenuReportOptions(MenuOptions,ReportOptions):
|
|||||||
MenuReportOptions class will worry about setting up the GUI.
|
MenuReportOptions class will worry about setting up the GUI.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
ReportOptions.__init__(self,name, person_id)
|
if dbstate:
|
||||||
MenuOptions.__init__(self)
|
active_person = dbstate.get_active_person().get_gramps_id()
|
||||||
|
else:
|
||||||
|
active_person = None
|
||||||
|
ReportOptions.__init__(self,name,active_person)
|
||||||
|
MenuOptions.__init__(self,dbstate)
|
||||||
|
|
||||||
|
|
||||||
|
@ -444,10 +444,10 @@ class AncestorChartOptions(MenuReportOptions):
|
|||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
max_gen = NumberOption(_("Generations"),10,1,15)
|
max_gen = NumberOption(_("Generations"),10,1,15)
|
||||||
|
@ -38,7 +38,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from PluginUtils import register_report, NumberOption, BooleanOption
|
from PluginUtils import register_report, NumberOption, BooleanOption
|
||||||
from ReportBase import Report, ReportUtils, ReportOptions, MenuReportOptions, \
|
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
@ -222,10 +222,10 @@ class AncestorOptions(MenuReportOptions):
|
|||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
maxgen = NumberOption(_("Generations"),10,1,15)
|
maxgen = NumberOption(_("Generations"),10,1,15)
|
||||||
|
@ -51,7 +51,7 @@ import Errors
|
|||||||
class CalcEstDateOptions(MenuToolOptions):
|
class CalcEstDateOptions(MenuToolOptions):
|
||||||
""" Calculate Estimated Date options """
|
""" Calculate Estimated Date options """
|
||||||
|
|
||||||
def add_menu_options(self, menu):
|
def add_menu_options(self, menu, dbstate):
|
||||||
""" Adds the options """
|
""" Adds the options """
|
||||||
category_name = _("Options")
|
category_name = _("Options")
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ class CalendarReport(Calendar):
|
|||||||
class CalendarOptions(MenuReportOptions):
|
class CalendarOptions(MenuReportOptions):
|
||||||
""" Calendar options for graphic calendar """
|
""" Calendar options for graphic calendar """
|
||||||
|
|
||||||
def add_menu_options(self, menu):
|
def add_menu_options(self, menu,dbstate):
|
||||||
""" Adds the options for the graphical calendar """
|
""" Adds the options for the graphical calendar """
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
@ -605,14 +605,14 @@ class CalendarOptions(MenuReportOptions):
|
|||||||
class CalendarReportOptions(CalendarOptions):
|
class CalendarReportOptions(CalendarOptions):
|
||||||
""" Options for the calendar (birthday and anniversary) report """
|
""" Options for the calendar (birthday and anniversary) report """
|
||||||
|
|
||||||
def add_menu_options(self, menu):
|
def add_menu_options(self, menu,dbstate):
|
||||||
""" Adds the options for the graphical calendar """
|
""" Adds the options for the graphical calendar """
|
||||||
category_name = _("Text Options")
|
category_name = _("Text Options")
|
||||||
titletext = StringOption(_("Title text"),
|
titletext = StringOption(_("Title text"),
|
||||||
_("Birthday and Anniversary Report"))
|
_("Birthday and Anniversary Report"))
|
||||||
titletext.set_help(_("Title of calendar"))
|
titletext.set_help(_("Title of calendar"))
|
||||||
menu.add_option(category_name,"titletext", titletext)
|
menu.add_option(category_name,"titletext", titletext)
|
||||||
CalendarOptions.add_menu_options(self, menu)
|
CalendarOptions.add_menu_options(self, menu, dbstate)
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
option = BooleanOption(_("Include relationships to center person (slower)"),
|
option = BooleanOption(_("Include relationships to center person (slower)"),
|
||||||
False)
|
False)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
from PluginUtils import register_report, NumberOption, BooleanOption, TextOption
|
from PluginUtils import register_report, NumberOption, BooleanOption, TextOption
|
||||||
from ReportBase import Report, ReportOptions, MenuReportOptions, \
|
from ReportBase import Report, MenuReportOptions, \
|
||||||
ReportUtils, CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
|
ReportUtils, CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
from SubstKeywords import SubstKeywords
|
from SubstKeywords import SubstKeywords
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
@ -397,8 +397,8 @@ class DescendChartOptions(MenuReportOptions):
|
|||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
@ -37,7 +37,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from PluginUtils import register_report, NumberOption
|
from PluginUtils import register_report, NumberOption
|
||||||
from ReportBase import Report, ReportUtils, ReportOptions, MenuReportOptions, \
|
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import Errors
|
import Errors
|
||||||
@ -195,10 +195,10 @@ class DescendantOptions(MenuReportOptions):
|
|||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
gen = NumberOption(_("Generations"),10,1,15)
|
gen = NumberOption(_("Generations"),10,1,15)
|
||||||
|
@ -659,10 +659,10 @@ class DetAncestorOptions(MenuReportOptions):
|
|||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
gen = NumberOption(_("Generations"),10,1,100)
|
gen = NumberOption(_("Generations"),10,1,100)
|
||||||
|
@ -622,10 +622,10 @@ class DetDescendantOptions(MenuReportOptions):
|
|||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
gen = NumberOption(_("Generations"),10,1,100)
|
gen = NumberOption(_("Generations"),10,1,100)
|
||||||
|
@ -35,7 +35,7 @@ from gettext import gettext as _
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_report
|
||||||
from ReportBase import Report, ReportUtils, ReportOptions, \
|
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
@ -207,13 +207,21 @@ class EndOfLineReport(Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
class EndOfLineOptions(ReportOptions):
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# EndOfLineOptions
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class EndOfLineOptions(MenuReportOptions):
|
||||||
"""
|
"""
|
||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
ReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
|
def add_menu_options(self,menu,dbstate):
|
||||||
|
pass
|
||||||
|
|
||||||
def make_default_style(self,default_style):
|
def make_default_style(self,default_style):
|
||||||
"""Make the default output style for the End of Line Report."""
|
"""Make the default output style for the End of Line Report."""
|
||||||
|
@ -36,8 +36,8 @@ import gtk
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import gen.lib
|
import gen.lib
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_report, BooleanOption, EnumeratedListOption
|
||||||
from ReportBase import Report, ReportUtils, ReportOptions, \
|
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import DateHandler
|
import DateHandler
|
||||||
@ -324,41 +324,6 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
self.doc.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
def dump_marriage(self,family):
|
|
||||||
if not family:
|
|
||||||
return
|
|
||||||
m = None
|
|
||||||
family_ref_list = family.get_event_ref_list()
|
|
||||||
for event_ref in family_ref_list:
|
|
||||||
if event_ref:
|
|
||||||
event = self.database.get_event_from_handle(event_ref.ref)
|
|
||||||
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
|
|
||||||
m = event
|
|
||||||
break
|
|
||||||
|
|
||||||
if m or self.missingInfo:
|
|
||||||
self.doc.start_table("MarriageInfo",'FGR-ParentTable')
|
|
||||||
self.doc.start_row()
|
|
||||||
self.doc.start_cell('FGR-ParentHead',3)
|
|
||||||
self.doc.start_paragraph('FGR-ParentName')
|
|
||||||
self.doc.write_text(_("Marriage:"))
|
|
||||||
self.doc.end_paragraph()
|
|
||||||
self.doc.end_cell()
|
|
||||||
self.doc.end_row()
|
|
||||||
|
|
||||||
evtName = str(gen.lib.EventType(gen.lib.EventType.MARRIAGE))
|
|
||||||
self.dump_parent_event(evtName,m)
|
|
||||||
|
|
||||||
for event_ref in family_ref_list:
|
|
||||||
if event_ref:
|
|
||||||
event = self.database.get_event_from_handle(event_ref.ref)
|
|
||||||
evtType = event.get_type()
|
|
||||||
if int(evtType) != gen.lib.EventType.MARRIAGE:
|
|
||||||
name = Utils.format_event( evtType )
|
|
||||||
self.dump_parent_event(name,event)
|
|
||||||
|
|
||||||
self.doc.end_table()
|
|
||||||
|
|
||||||
def dump_marriage(self,family):
|
def dump_marriage(self,family):
|
||||||
|
|
||||||
if not family:
|
if not family:
|
||||||
@ -613,82 +578,93 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
# MenuReportOptions
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class FamilyGroupOptions(ReportOptions):
|
class FamilyGroupOptions(MenuReportOptions):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
ReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
# Options specific for this report
|
def add_menu_options(self,menu,dbstate):
|
||||||
self.options_dict = {
|
|
||||||
'family_id' : '',
|
|
||||||
'recursive' : 0,
|
|
||||||
'missinginfo' : 1,
|
|
||||||
'generations' : 1,
|
|
||||||
'incParEvents' : 0,
|
|
||||||
'incParAddr' : 0,
|
|
||||||
'incParNotes' : 0,
|
|
||||||
'incattrs' : 0,
|
|
||||||
'incParNames' : 0,
|
|
||||||
'incParMar' : 0,
|
|
||||||
'incChiMar' : 1,
|
|
||||||
'incRelDates' : 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
self.options_help = {
|
##########################
|
||||||
'family_id' : ("=ID","Gramps ID of the person's family.",
|
category_name = _("Report Options")
|
||||||
"Use show=id to get ID list.",
|
##########################
|
||||||
),
|
|
||||||
'recursive' : ("=0/1","Create reports for all decendants of this family.",
|
|
||||||
["Do not create reports for decendants","Create reports for decendants"],
|
|
||||||
False),
|
|
||||||
|
|
||||||
'missinginfo' : ("=0/1","Whether to include fields for missing information.",
|
families = self.get_families(dbstate.get_database(),
|
||||||
["Do not include missing info","Include missing info"],
|
dbstate.get_active_person())
|
||||||
True),
|
|
||||||
|
|
||||||
'generations' : ("=0/1","Whether to include the generation on each report (recursive only).",
|
family_id = EnumeratedListOption(_("Spouse"), "")
|
||||||
["Do not include the generation","Include the generation"],
|
for item in families:
|
||||||
True),
|
family_id.add_item(item[0], item[1])
|
||||||
|
family_id.set_help(_("Gramps ID of the person's family."))
|
||||||
|
menu.add_option(category_name,"family_id",family_id)
|
||||||
|
|
||||||
'incParEvents' : ("=0/1","Whether to include events for parents.",
|
recursive = BooleanOption(_('Recursive'),False)
|
||||||
["Do not include parental events","Include parental events"],
|
recursive.set_help(_("Create reports for all decendants "
|
||||||
True),
|
"of this family."))
|
||||||
|
menu.add_option(category_name,"recursive",recursive)
|
||||||
|
|
||||||
'incParAddr' : ("=0/1","Whether to include addresses for parents.",
|
##########################
|
||||||
["Do not include parental addresses","Include parental addresses"],
|
category_name = _("Include")
|
||||||
True),
|
##########################
|
||||||
|
|
||||||
'incParNotes' : ("=0/1","Whether to include notes for parents.",
|
generations = BooleanOption(_("Generation numbers "
|
||||||
["Do not include parental notes","Include parental notes"],
|
"(recursive only)"),True)
|
||||||
True),
|
generations.set_help(_("Whether to include the generation on each "
|
||||||
|
"report (recursive only)."))
|
||||||
|
menu.add_option(category_name,"generations",generations)
|
||||||
|
|
||||||
'incattrs' : ("=0/1","Whether to include attributes.",
|
incParEvents = BooleanOption(_("Parent Events"),False)
|
||||||
["Do not include attributes","Include attributes"],
|
incParEvents.set_help(_("Whether to include events for parents."))
|
||||||
True),
|
menu.add_option(category_name,"incParEvents",incParEvents)
|
||||||
|
|
||||||
'incParNames' : ("=0/1","Whether to include alternate names for parents.",
|
incParAddr = BooleanOption(_("Parent Addresses"),False)
|
||||||
["Do not include parental names","Include parental names"],
|
incParAddr.set_help(_("Whether to include addresses for parents."))
|
||||||
True),
|
menu.add_option(category_name,"incParAddr",incParAddr)
|
||||||
|
|
||||||
'incParMar' : ("=0/1","Whether to include marriage information for parents.",
|
incParNotes = BooleanOption(_("Parent Notes"),False)
|
||||||
["Do not include parental marriage info","Include parental marriage info"],
|
incParNotes.set_help(_("Whether to include notes for parents."))
|
||||||
False),
|
menu.add_option(category_name,"incParNotes",incParNotes)
|
||||||
|
|
||||||
'incChiMar' : ("=0/1","Whether to include marriage information for children.",
|
incattrs = BooleanOption(_("Parent Attributes"),False)
|
||||||
["Do not include children marriage info","Include children marriage info"],
|
incattrs.set_help(_("Whether to include attributes."))
|
||||||
True),
|
menu.add_option(category_name,"incattrs",incattrs)
|
||||||
|
|
||||||
'incRelDates' : ("=0/1","Whether to include dates for relatives.",
|
incParNames = BooleanOption(_("Alternate Parent Names"),False)
|
||||||
["Do not include dates of relatives","Include dates of relatives"],
|
incParNames.set_help(_("Whether to include alternate "
|
||||||
True),
|
"names for parents."))
|
||||||
}
|
menu.add_option(category_name,"incParNames",incParNames)
|
||||||
|
|
||||||
|
incParMar = BooleanOption(_("Parent Marriage"),False)
|
||||||
|
incParMar.set_help(_("Whether to include marriage information "
|
||||||
|
"for parents."))
|
||||||
|
menu.add_option(category_name,"incParMar",incParMar)
|
||||||
|
|
||||||
|
incRelDates = BooleanOption(_("Dates of Relatives"),False)
|
||||||
|
incRelDates.set_help(_("Whether to include dates for relatives "
|
||||||
|
"(father, mother, spouse)."))
|
||||||
|
menu.add_option(category_name,"incRelDates",incRelDates)
|
||||||
|
|
||||||
|
incChiMar = BooleanOption(_("Children Marriages"),True)
|
||||||
|
incChiMar.set_help(_("Whether to include marriage information "
|
||||||
|
"for children."))
|
||||||
|
menu.add_option(category_name,"incChiMar",incChiMar)
|
||||||
|
|
||||||
|
##########################
|
||||||
|
category_name = _("Missing Information")
|
||||||
|
##########################
|
||||||
|
|
||||||
|
missinginfo = BooleanOption(_("Print fields for missing "
|
||||||
|
"information"),True)
|
||||||
|
missinginfo.set_help(_("Whether to include fields for missing "
|
||||||
|
"information."))
|
||||||
|
menu.add_option(category_name,"missinginfo",missinginfo)
|
||||||
|
|
||||||
def get_families(self,database,person):
|
def get_families(self,database,person):
|
||||||
"""
|
"""
|
||||||
@ -716,103 +692,6 @@ class FamilyGroupOptions(ReportOptions):
|
|||||||
families.append((family_id,name))
|
families.append((family_id,name))
|
||||||
return families
|
return families
|
||||||
|
|
||||||
def add_user_options(self,dialog):
|
|
||||||
"""
|
|
||||||
Override the base class add_user_options task to add a menu that allows
|
|
||||||
the user to select the sort method.
|
|
||||||
"""
|
|
||||||
|
|
||||||
families = self.get_families(dialog.db,dialog.person)
|
|
||||||
family_id = self.options_dict['family_id']
|
|
||||||
|
|
||||||
self.spouse_menu = gtk.combo_box_new_text()
|
|
||||||
index = 0
|
|
||||||
family_index = 0
|
|
||||||
for item in families:
|
|
||||||
self.spouse_menu.append_text(item[1])
|
|
||||||
if item[0] == family_id:
|
|
||||||
family_index = index
|
|
||||||
index = index + 1
|
|
||||||
self.spouse_menu.set_active(family_index)
|
|
||||||
|
|
||||||
# Recursive
|
|
||||||
self.recursive_option = gtk.CheckButton()
|
|
||||||
self.recursive_option.set_active(self.options_dict['recursive'])
|
|
||||||
|
|
||||||
# Missing Info
|
|
||||||
self.missing_info_option = gtk.CheckButton(_("Print fields for missing information"))
|
|
||||||
self.missing_info_option.set_active(self.options_dict['missinginfo'])
|
|
||||||
|
|
||||||
# Generations
|
|
||||||
self.include_generations_option = gtk.CheckButton(_("Generation numbers (recursive only)"))
|
|
||||||
self.include_generations_option.set_active(self.options_dict['generations'])
|
|
||||||
|
|
||||||
# Parental Events
|
|
||||||
self.include_par_events_option = gtk.CheckButton(_("Parent Events"))
|
|
||||||
self.include_par_events_option.set_active(self.options_dict['incParEvents'])
|
|
||||||
|
|
||||||
# Parental Addresses
|
|
||||||
self.include_par_addr_option = gtk.CheckButton(_("Parent Addresses"))
|
|
||||||
self.include_par_addr_option.set_active(self.options_dict['incParAddr'])
|
|
||||||
|
|
||||||
# Parental Notes
|
|
||||||
self.include_par_notes_option = gtk.CheckButton(_("Parent Notes"))
|
|
||||||
self.include_par_notes_option.set_active(self.options_dict['incParNotes'])
|
|
||||||
|
|
||||||
# Parental Attributes
|
|
||||||
self.include_attributes_option = gtk.CheckButton(_("Parent Attributes"))
|
|
||||||
self.include_attributes_option.set_active(self.options_dict['incattrs'])
|
|
||||||
|
|
||||||
# Parental Names
|
|
||||||
self.include_par_names_option = gtk.CheckButton(_("Alternate Parent Names"))
|
|
||||||
self.include_par_names_option.set_active(self.options_dict['incParNames'])
|
|
||||||
|
|
||||||
# Parental Marriage
|
|
||||||
self.include_par_marriage_option = gtk.CheckButton(_("Parent Marriage"))
|
|
||||||
self.include_par_marriage_option.set_active(self.options_dict['incParMar'])
|
|
||||||
|
|
||||||
# Relatives Dates
|
|
||||||
self.include_rel_dates_option = gtk.CheckButton(_("Dates of Relatives (father, mother, spouse)"))
|
|
||||||
self.include_rel_dates_option.set_active(self.options_dict['incRelDates'])
|
|
||||||
|
|
||||||
# Children Marriages
|
|
||||||
self.include_chi_marriage_option = gtk.CheckButton(_("Children Marriages"))
|
|
||||||
self.include_chi_marriage_option.set_active(self.options_dict['incChiMar'])
|
|
||||||
|
|
||||||
dialog.add_option(_("Spouse"),self.spouse_menu)
|
|
||||||
dialog.add_option(_("Recursive"),self.recursive_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_generations_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_par_events_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_par_addr_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_par_notes_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_attributes_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_par_names_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_par_marriage_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_chi_marriage_option)
|
|
||||||
dialog.add_frame_option(_('Include'),'',self.include_rel_dates_option)
|
|
||||||
dialog.add_frame_option(_('Missing Information'),'',self.missing_info_option)
|
|
||||||
|
|
||||||
def parse_user_options(self,dialog):
|
|
||||||
"""
|
|
||||||
Parses the custom options that we have added.
|
|
||||||
"""
|
|
||||||
families = self.get_families(dialog.db,dialog.person)
|
|
||||||
family_index = self.spouse_menu.get_active()
|
|
||||||
if families:
|
|
||||||
self.options_dict['family_id'] = families[family_index][0]
|
|
||||||
|
|
||||||
self.options_dict['recursive'] = int(self.recursive_option.get_active())
|
|
||||||
self.options_dict['missinginfo'] = int(self.missing_info_option.get_active())
|
|
||||||
self.options_dict['generations'] = int(self.include_generations_option.get_active())
|
|
||||||
self.options_dict['incParEvents'] = int(self.include_par_events_option.get_active())
|
|
||||||
self.options_dict['incParAddr'] = int(self.include_par_addr_option.get_active())
|
|
||||||
self.options_dict['incParNotes'] = int(self.include_par_notes_option.get_active())
|
|
||||||
self.options_dict['incattrs'] = int(self.include_attributes_option.get_active())
|
|
||||||
self.options_dict['incParNames'] = int(self.include_par_names_option.get_active())
|
|
||||||
self.options_dict['incParMar'] = int(self.include_par_marriage_option.get_active())
|
|
||||||
self.options_dict['incChiMar'] = int(self.include_chi_marriage_option.get_active())
|
|
||||||
self.options_dict['incRelDates'] = int(self.include_rel_dates_option.get_active())
|
|
||||||
|
|
||||||
def make_default_style(self,default_style):
|
def make_default_style(self,default_style):
|
||||||
"""Make default output style for the Family Group Report."""
|
"""Make default output style for the Family Group Report."""
|
||||||
para = BaseDoc.ParagraphStyle()
|
para = BaseDoc.ParagraphStyle()
|
||||||
|
@ -1435,5 +1435,6 @@ register_report(
|
|||||||
report_class = FamilyLinesDialog, # class which will create everything needed for the report
|
report_class = FamilyLinesDialog, # class which will create everything needed for the report
|
||||||
options_class = None,
|
options_class = None,
|
||||||
translated_name = _("Family Lines Graph"),
|
translated_name = _("Family Lines Graph"),
|
||||||
|
unsupported = True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -315,12 +315,12 @@ class FanChart(Report):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class FanChartOptions(MenuReportOptions):
|
class FanChartOptions(MenuReportOptions):
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
self.MAX_GENERATIONS = 8
|
self.MAX_GENERATIONS = 8
|
||||||
|
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
max_gen = NumberOption(_("Generations"),5,1,self.MAX_GENERATIONS)
|
max_gen = NumberOption(_("Generations"),5,1,self.MAX_GENERATIONS)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Stephane Charette
|
# Copyright (C) 2007 Stephane Charette
|
||||||
|
# Copyright (C) 2007 Brian G. Matherly
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Pubilc License as published by
|
# it under the terms of the GNU General Pubilc License as published by
|
||||||
@ -101,16 +102,18 @@ class FamilyLinesOptions(MenuReportOptions):
|
|||||||
Defines all of the controls necessary
|
Defines all of the controls necessary
|
||||||
to configure the FamilyLines reports.
|
to configure the FamilyLines reports.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name, person_id=None):
|
def __init__(self, name, dbstate=None):
|
||||||
MenuReportOptions.__init__(self, name, person_id)
|
MenuReportOptions.__init__(self, name, dbstate)
|
||||||
|
|
||||||
def add_menu_options(self, menu):
|
def add_menu_options(self, menu,dbstate):
|
||||||
|
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
category = _('People of Interest')
|
category = _('People of Interest')
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
|
|
||||||
peoplePicker = PeoplePickerOption( _('People of interest'), '', None) # todo, fixme: need access to the database (3rd parm)
|
peoplePicker = PeoplePickerOption( _('People of interest'),
|
||||||
|
'',
|
||||||
|
dbstate )
|
||||||
peoplePicker.set_help( _('People of interest are used as a starting point when determining \"family lines\".'))
|
peoplePicker.set_help( _('People of interest are used as a starting point when determining \"family lines\".'))
|
||||||
menu.add_option(category, 'FLgidlist', peoplePicker)
|
menu.add_option(category, 'FLgidlist', peoplePicker)
|
||||||
|
|
||||||
@ -206,6 +209,13 @@ class FamilyLinesOptions(MenuReportOptions):
|
|||||||
includePrivate.set_help( _('Whether to include names, dates, and families that are marked as private.'))
|
includePrivate.set_help( _('Whether to include names, dates, and families that are marked as private.'))
|
||||||
menu.add_option(category, 'FLincludePrivate', includePrivate)
|
menu.add_option(category, 'FLincludePrivate', includePrivate)
|
||||||
|
|
||||||
|
usesubgraphs = BooleanOption(_('Use subgraphs'), False)
|
||||||
|
usesubgraphs.set_help(_("Subgraphs can help GraphViz position "
|
||||||
|
"certain linked nodes closer together, "
|
||||||
|
"but with non-trivial graphs will result "
|
||||||
|
"in longer lines and larger graphs."))
|
||||||
|
menu.add_option(category, "usesubgraphs", usesubgraphs)
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -223,6 +233,7 @@ class FamilyLinesReport(Report):
|
|||||||
person - currently selected person
|
person - currently selected person
|
||||||
options - instance of the FamilyLinesOptions class for this report
|
options - instance of the FamilyLinesOptions class for this report
|
||||||
"""
|
"""
|
||||||
|
Report.__init__(self,database,person,options)
|
||||||
|
|
||||||
# initialize several convenient variables
|
# initialize several convenient variables
|
||||||
self.options = options
|
self.options = options
|
||||||
@ -232,10 +243,7 @@ class FamilyLinesReport(Report):
|
|||||||
self.deletedPeople = 0
|
self.deletedPeople = 0
|
||||||
self.deletedFamilies = 0
|
self.deletedFamilies = 0
|
||||||
|
|
||||||
# inherited from parent; see "usesubgraphs" in _GraphvizReportDialog.py
|
|
||||||
self.useSubgraphs = options.handler.options_dict['usesubgraphs' ]
|
self.useSubgraphs = options.handler.options_dict['usesubgraphs' ]
|
||||||
|
|
||||||
# the remainder of the options are specific to this report
|
|
||||||
self.followParents = options.handler.options_dict['FLfollowParents' ]
|
self.followParents = options.handler.options_dict['FLfollowParents' ]
|
||||||
self.followChildren = options.handler.options_dict['FLfollowChildren' ]
|
self.followChildren = options.handler.options_dict['FLfollowChildren' ]
|
||||||
self.removeExtraPeople = options.handler.options_dict['FLremoveExtraPeople' ]
|
self.removeExtraPeople = options.handler.options_dict['FLremoveExtraPeople' ]
|
||||||
@ -714,11 +722,7 @@ class FamilyLinesReport(Report):
|
|||||||
if imagePath:
|
if imagePath:
|
||||||
label += '</TD></TR></TABLE>'
|
label += '</TD></TR></TABLE>'
|
||||||
|
|
||||||
if bUseHtmlOutput:
|
self.doc.add_node(person.get_gramps_id(),label,"box","","filled",colour)
|
||||||
label = '<%s>' % label
|
|
||||||
else:
|
|
||||||
label = '"%s"' % label
|
|
||||||
self.write(' %s [shape="box", fillcolor="%s", label=%s];\n' % (person.get_gramps_id(), colour, label))
|
|
||||||
|
|
||||||
|
|
||||||
def writeFamilies(self):
|
def writeFamilies(self):
|
||||||
@ -778,12 +782,12 @@ class FamilyLinesReport(Report):
|
|||||||
if label != '':
|
if label != '':
|
||||||
label += '\\n'
|
label += '\\n'
|
||||||
label += '%s' % childrenStr
|
label += '%s' % childrenStr
|
||||||
self.write(' %s [shape="ellipse", fillcolor="%s", label="%s"];\n' % (fgid, self.colourFamilies, label))
|
self.doc.add_node(fgid,label,"ellipse","","filled",self.colourFamilies)
|
||||||
|
|
||||||
|
|
||||||
# now that we have the families written, go ahead and link the parents and children to the families
|
# now that we have the families written, go ahead and link the parents and children to the families
|
||||||
for familyHandle in self.familiesToOutput:
|
for familyHandle in self.familiesToOutput:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
self.write('\n')
|
|
||||||
|
|
||||||
# get the parents for this family
|
# get the parents for this family
|
||||||
family = self.db.get_family_from_handle(familyHandle)
|
family = self.db.get_family_from_handle(familyHandle)
|
||||||
@ -792,29 +796,28 @@ class FamilyLinesReport(Report):
|
|||||||
motherHandle = family.get_mother_handle()
|
motherHandle = family.get_mother_handle()
|
||||||
|
|
||||||
if self.useSubgraphs and fatherHandle and motherHandle:
|
if self.useSubgraphs and fatherHandle and motherHandle:
|
||||||
self.write(' subgraph cluster_%s\n' % fgid)
|
self.doc.start_subgraph(fgid)
|
||||||
self.write(' {\n')
|
|
||||||
|
|
||||||
# see if we have a father to link to this family
|
# see if we have a father to link to this family
|
||||||
if fatherHandle:
|
if fatherHandle:
|
||||||
if fatherHandle in self.peopleToOutput:
|
if fatherHandle in self.peopleToOutput:
|
||||||
father = self.db.get_person_from_handle(fatherHandle)
|
father = self.db.get_person_from_handle(fatherHandle)
|
||||||
self.write(' %s -> %s // father: %s\n' % (fgid, father.get_gramps_id(), father.get_primary_name().get_regular_name()))
|
self.doc.add_link(fgid, father.get_gramps_id())
|
||||||
|
|
||||||
# see if we have a mother to link to this family
|
# see if we have a mother to link to this family
|
||||||
if motherHandle:
|
if motherHandle:
|
||||||
if motherHandle in self.peopleToOutput:
|
if motherHandle in self.peopleToOutput:
|
||||||
mother = self.db.get_person_from_handle(motherHandle)
|
mother = self.db.get_person_from_handle(motherHandle)
|
||||||
self.write(' %s -> %s // mother: %s\n' % (fgid, mother.get_gramps_id(), mother.get_primary_name().get_regular_name()))
|
self.doc.add_link(fgid, mother.get_gramps_id())
|
||||||
|
|
||||||
if self.useSubgraphs and fatherHandle and motherHandle:
|
if self.useSubgraphs and fatherHandle and motherHandle:
|
||||||
self.write(' }\n')
|
self.doc.end_subgraph()
|
||||||
|
|
||||||
# link the children to the family
|
# link the children to the family
|
||||||
for childRef in family.get_child_ref_list():
|
for childRef in family.get_child_ref_list():
|
||||||
if childRef.ref in self.peopleToOutput:
|
if childRef.ref in self.peopleToOutput:
|
||||||
child = self.db.get_person_from_handle(childRef.ref)
|
child = self.db.get_person_from_handle(childRef.ref)
|
||||||
self.write(' %s -> %s // child: %s\n' % (child.get_gramps_id(), fgid, child.get_primary_name().get_regular_name()))
|
self.doc.add_link(child.get_gramps_id(), fgid)
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
@ -149,10 +149,10 @@ class HourGlassOptions(MenuReportOptions):
|
|||||||
"""
|
"""
|
||||||
Defines options for the HourGlass report.
|
Defines options for the HourGlass report.
|
||||||
"""
|
"""
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
|
|
||||||
max_gen = NumberOption(_('Max Descendant Generations'),10,1,15)
|
max_gen = NumberOption(_('Max Descendant Generations'),10,1,15)
|
||||||
|
@ -410,10 +410,10 @@ class RelGraphOptions(MenuReportOptions):
|
|||||||
"""
|
"""
|
||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,dbstate=None):
|
||||||
MenuReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,dbstate)
|
||||||
|
|
||||||
def add_menu_options(self,menu):
|
def add_menu_options(self,menu,dbstate):
|
||||||
################################
|
################################
|
||||||
category_name = _("Report Options")
|
category_name = _("Report Options")
|
||||||
################################
|
################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user