diff --git a/src/plugins/drawreport/AncestorTree.py b/src/plugins/drawreport/AncestorTree.py index e27d00453..c043d355d 100644 --- a/src/plugins/drawreport/AncestorTree.py +++ b/src/plugins/drawreport/AncestorTree.py @@ -644,7 +644,11 @@ class GUIConnect(): def get_val(self, val): """ Get a GUI value. """ - return self.__opts.get_option_by_name(val).get_value() + value = self.__opts.get_option_by_name(val) + if value: + return value.get_value() + else: + False def title_class(self, doc): """ Return a class that holds the proper title based off of the @@ -870,7 +874,7 @@ class AncestorTree2Options(MenuReportOptions): MenuReportOptions.__init__(self, name, dbase) def add_menu_options(self, menu): - + category_name = _("Tree Options") pid = PersonOption(_("Center Person")) @@ -950,20 +954,42 @@ class AncestorTree2Options(MenuReportOptions): category_name = _("Print") - self.scale = EnumeratedListOption(_("Scale report to fit"), 0) - self.scale.add_item( 0, _("Do not scale report")) - self.scale.add_item( 1, _("Scale report to fit page width only")) - self.scale.add_item( 2, _("Scale report to fit the size of the page")) - self.scale.set_help(_("Whether to scale the report to fit a " - "specific size")) + self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) + self.scale.add_item( 0, _("Do not scale tree")) + self.scale.add_item( 1, _("Scale tree to fit page width only")) + self.scale.add_item( 2, _("Scale tree to fit the size of the page")) + self.scale.set_help( + _("Whether to scale the tree to fit a specific paper size") + ) menu.add_option(category_name, "scale_report", self.scale) self.scale.connect('value-changed', self.__check_blank) - self.__onepage = BooleanOption(_('One page report'), False) - self.__onepage.set_help(_("Whether to scale the size of the page to " - "the size of the report.")) - menu.add_option(category_name, "onepage", self.__onepage) - self.__onepage.connect('value-changed', self.__check_blank) + if "BKI" not in self.name.split(","): + self.__onepage = BooleanOption(_("Resize Page to Fit Tree size.\n" + "Note: Overrides options in the 'Paper Option' tab"), + False) + self.__onepage.set_help( + _("Whether to resize the page to fit the size \n" + "of the tree. Note: the page will have a \n" + "non standard size.\n" + "\n" + "With the 'Do not scale tree' option\n" + " the page is resized to the height/width \n" + " of the tree\n" + "\n" + "With 'Scale tree to fit page width only'\n" + " the height of the page is resized to the \n" + " height of the tree\n" + "\n" + "With 'Scale tree to fit the size of the page'\n" + " the page is resized to remove any gap in \n" + " either the height or width.") + + ) + menu.add_option(category_name, "onepage", self.__onepage) + self.__onepage.connect('value-changed', self.__check_blank) + else: + self.__onepage = None self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item( 0, _("Do not print a title")) @@ -1004,7 +1030,11 @@ class AncestorTree2Options(MenuReportOptions): menu.add_option(category_name, "note_local", notelocal) def __check_blank(self): - off = not self.__onepage.get_value() and (self.scale.get_value() != 2) + if self.__onepage: + value = not self.__onepage.get_value() + else: + value = True + off = value and (self.scale.get_value() != 2) self.__blank.set_available( off ) def __fillout_vals(self): diff --git a/src/plugins/drawreport/DescendTree.py b/src/plugins/drawreport/DescendTree.py index 2c0bfdc2b..e107201cf 100644 --- a/src/plugins/drawreport/DescendTree.py +++ b/src/plugins/drawreport/DescendTree.py @@ -1195,10 +1195,15 @@ class GuiConnect(): def set__opts(self, options, which): self._opts = options - self._which_report = which + self._which_report = which.split(",")[0] def get_val(self, val): - return self._opts.get_option_by_name(val).get_value() + """ Get a GUI value. """ + value = self._opts.get_option_by_name(val) + if value: + return value.get_value() + else: + False def Title_class(self, database, doc): Title_type = self.get_val('report_title') @@ -1459,7 +1464,7 @@ class Descend2TreeOptions(MenuReportOptions): """ category_name = _("Tree Options") - if self.name == _RPT_NAME: + if self.name.split(",")[0] == _RPT_NAME: self.__pid = PersonOption(_("Report for")) self.__pid.set_help(_("The main person for the report")) menu.add_option(category_name, "pid", self.__pid) @@ -1470,7 +1475,7 @@ class Descend2TreeOptions(MenuReportOptions): self.showparents = BooleanOption( _('Start with the parent(s) of the selected first'), - True) + False) self.showparents.set_help( _("Will show the parents, brother and sisters of the " "selected person.") @@ -1549,23 +1554,43 @@ class Descend2TreeOptions(MenuReportOptions): category_name = _("Print") - self.scale = EnumeratedListOption(_("Scale report to fit"), 0) - self.scale.add_item( 0, _("Do not scale report")) - self.scale.add_item( 1, _("Scale report to fit page width only")) - self.scale.add_item( 2, _("Scale report to fit the size of the page")) + self.scale = EnumeratedListOption(_("Scale tree to fit"), 0) + self.scale.add_item( 0, _("Do not scale tree")) + self.scale.add_item( 1, _("Scale tree to fit page width only")) + self.scale.add_item( 2, _("Scale tree to fit the size of the page")) self.scale.set_help( - _("Whether to scale the report to fit a specific size") + _("Whether to scale the tree to fit a specific paper size") ) menu.add_option(category_name, "scale_report", self.scale) self.scale.connect('value-changed', self.__check_blank) - self.__onepage = BooleanOption(_('One page report'), False) - self.__onepage.set_help( - _("Whether to scale the size of the page to " - "the size of the report.") - ) - menu.add_option(category_name, "onepage", self.__onepage) - self.__onepage.connect('value-changed', self.__check_blank) + if "BKI" not in self.name.split(","): + self.__onepage = BooleanOption(_("Resize Page to Fit Tree size.\n" + "Note: Overrides options in the 'Paper Option' tab"), + False) + self.__onepage.set_help( + _("Whether to resize the page to fit the size \n" + "of the tree. Note: the page will have a \n" + "non standard size.\n" + "\n" + "With the 'Do not scale tree' option\n" + " the page is resized to the height/width \n" + " of the tree\n" + "\n" + "With 'Scale tree to fit page width only'\n" + " the height of the page is resized to the \n" + " height of the tree\n" + "\n" + "With 'Scale tree to fit the size of the page'\n" + " the page is resized to remove any gap in \n" + " either the height or width.") + + ) + menu.add_option(category_name, "onepage", self.__onepage) + self.__onepage.connect('value-changed', self.__check_blank) + else: + self.__onepage = None + self.title = EnumeratedListOption(_("Report Title"), 0) self.title.add_item( 0, _("Do not print a title")) @@ -1608,7 +1633,11 @@ class Descend2TreeOptions(MenuReportOptions): def __check_blank(self): """dis/enables the 'print blank pages' checkbox""" - off = not self.__onepage.get_value() and (self.scale.get_value() != 2) + if self.__onepage: + value = not self.__onepage.get_value() + else: + value = True + off = value and (self.scale.get_value() != 2) self.__blank.set_available( off ) def __Title_enum(self): diff --git a/src/plugins/drawreport/drawplugins.gpr.py b/src/plugins/drawreport/drawplugins.gpr.py index 3d8179df4..e286ab863 100644 --- a/src/plugins/drawreport/drawplugins.gpr.py +++ b/src/plugins/drawreport/drawplugins.gpr.py @@ -27,6 +27,22 @@ # #------------------------------------------------------------------------ +plg = newplugin() +plg.id = 'ancestor_chart,BKI' +plg.name = _("Ancestor Tree") +plg.description = _("Produces a graphical ancestral tree") +plg.version = '1.0' +plg.gramps_target_version = '3.3' +plg.status = STABLE +plg.fname = 'AncestorTree.py' +plg.ptype = REPORT +plg.authors = ["Craig J. Anderson"] +plg.authors_email = ["ander882@gramps-project.org"] +plg.category = CATEGORY_DRAW +plg.reportclass = 'AncestorTree2' +plg.optionclass = 'AncestorTree2Options' +plg.report_modes = [REPORT_MODE_BKI] + plg = newplugin() plg.id = 'ancestor_chart' plg.name = _("Ancestor Tree") @@ -41,7 +57,7 @@ plg.authors_email = ["ander882@gramps-project.org"] plg.category = CATEGORY_DRAW plg.reportclass = 'AncestorTree2' plg.optionclass = 'AncestorTree2Options' -plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI] +plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI] #------------------------------------------------------------------------ # @@ -71,6 +87,22 @@ plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI] # #------------------------------------------------------------------------ +plg = newplugin() +plg.id = 'descend_chart,BKI' +plg.name = _("Descendant Tree") +plg.description = _("Produces a graphical descendant tree") +plg.version = '1.0' +plg.gramps_target_version = '3.3' +plg.status = STABLE +plg.fname = 'DescendTree.py' +plg.ptype = REPORT +plg.authors = ["Craig J. Anderson"] +plg.authors_email = ["ander882@gramps-project.org"] +plg.category = CATEGORY_DRAW +plg.reportclass = 'Descend2Tree' +plg.optionclass = 'Descend2TreeOptions' +plg.report_modes = [REPORT_MODE_BKI] + plg = newplugin() plg.id = 'descend_chart' plg.name = _("Descendant Tree") @@ -85,7 +117,7 @@ plg.authors_email = ["ander882@gramps-project.org"] plg.category = CATEGORY_DRAW plg.reportclass = 'Descend2Tree' plg.optionclass = 'Descend2TreeOptions' -plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI] +plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI] #------------------------------------------------------------------------ # @@ -93,6 +125,23 @@ plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI] # #------------------------------------------------------------------------ +plg = newplugin() +plg.id = 'family_descend_chart,BKI' +plg.name = _("Family Descendant Tree") +plg.description = _("Produces a graphical descendant tree around a family") +plg.version = '1.0' +plg.status = STABLE +plg.fname = 'DescendTree.py' +plg.ptype = REPORT +plg.category = CATEGORY_DRAW +plg.gramps_target_version = '3.3' +plg.authors = ["Craig J. Anderson"] +plg.authors_email = ["ander882@gramps-project.org"] +plg.require_active = True +plg.reportclass = 'Descend2Tree' +plg.optionclass = 'Descend2TreeOptions' +plg.report_modes = [REPORT_MODE_BKI] + plg = newplugin() plg.id = 'family_descend_chart' plg.name = _("Family Descendant Tree") @@ -108,7 +157,7 @@ plg.authors_email = ["ander882@gramps-project.org"] plg.require_active = True plg.reportclass = 'Descend2Tree' plg.optionclass = 'Descend2TreeOptions' -plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_BKI, REPORT_MODE_CLI] +plg.report_modes = [REPORT_MODE_GUI, REPORT_MODE_CLI] #------------------------------------------------------------------------ #