Add tooltip support for the "extra" menu and textbox.
svn: r642
This commit is contained in:
parent
c9c099b7b2
commit
b93bf5e1d7
@ -226,21 +226,26 @@ class ReportDialog:
|
|||||||
'page break between generations' check box"""
|
'page break between generations' check box"""
|
||||||
return (10, 1)
|
return (10, 1)
|
||||||
|
|
||||||
def get_report_extra_menu_map(self):
|
def get_report_extra_menu_info(self):
|
||||||
"""Return the data used to fill out the 'extra' option menu in
|
"""Return the data used to fill out the 'extra' option menu in
|
||||||
the report options box. The first value is the string to be
|
the report options box. The first value is the string to be
|
||||||
used as the label to the left of the menu. The second value
|
used as the label to the left of the menu. The second value
|
||||||
is a mapping of string:value pairs. The strings will be used
|
is a mapping of string:value pairs. The strings will be used
|
||||||
to label individual menu items, and the values are what will
|
to label individual menu items, and the values are what will
|
||||||
be returned if a given menu item is selected. The final value
|
be returned if a given menu item is selected. The third value
|
||||||
is the name of menu item to pre-select."""
|
is the name of menu item to pre-select, and the final value is
|
||||||
return (None, None, None)
|
a string to use as the tooltip for the textbox."""
|
||||||
|
return (None, None, None, None)
|
||||||
|
|
||||||
def get_report_extra_textbox_string(self):
|
def get_report_extra_textbox_info(self):
|
||||||
"""Return the string to put into the 'extra' text box in
|
"""Return the data used to fill out the 'extra' textbox in the
|
||||||
the report options box. If None, then the text box will be
|
report options dialog. The first value is the string to be
|
||||||
hidden."""
|
used as the label to the left of the textbox. The second
|
||||||
return (None, None)
|
value is the string to use as the default contents of the
|
||||||
|
textbox. If None, then the text box will be hidden. The
|
||||||
|
final value is a string to use as the tooltip for the
|
||||||
|
textbox."""
|
||||||
|
return (None, None, None)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -473,23 +478,25 @@ class ReportDialog:
|
|||||||
# Now the "extra" option menu
|
# Now the "extra" option menu
|
||||||
self.extra_menu_label = self.topDialog.get_widget("extra_menu_label")
|
self.extra_menu_label = self.topDialog.get_widget("extra_menu_label")
|
||||||
self.extra_menu = self.topDialog.get_widget("extra_menu")
|
self.extra_menu = self.topDialog.get_widget("extra_menu")
|
||||||
(label, extra_map, preset) = self.get_report_extra_menu_map()
|
(label, extra_map, preset, tip) = self.get_report_extra_menu_info()
|
||||||
if extra_map:
|
if extra_map:
|
||||||
self.extra_menu_label.set_text(label)
|
self.extra_menu_label.set_text(label)
|
||||||
self.extra_menu_label.show()
|
self.extra_menu_label.show()
|
||||||
myMenu = utils.build_string_optmenu(extra_map, preset)
|
myMenu = utils.build_string_optmenu(extra_map, preset)
|
||||||
self.extra_menu.set_menu(myMenu)
|
self.extra_menu.set_menu(myMenu)
|
||||||
self.extra_menu.set_sensitive(len(extra_map) > 1)
|
self.extra_menu.set_sensitive(len(extra_map) > 1)
|
||||||
|
self.add_tooltip(self.extra_menu,tip)
|
||||||
self.extra_menu.show()
|
self.extra_menu.show()
|
||||||
|
|
||||||
# Now the "extra" text box
|
# Now the "extra" text box
|
||||||
self.extra_textbox_label = self.topDialog.get_widget("extra_textbox_label")
|
self.extra_textbox_label = self.topDialog.get_widget("extra_textbox_label")
|
||||||
self.extra_textbox = self.topDialog.get_widget("extra_textbox")
|
self.extra_textbox = self.topDialog.get_widget("extra_textbox")
|
||||||
(label, string) = self.get_report_extra_textbox_string()
|
(label, string, tip) = self.get_report_extra_textbox_info()
|
||||||
if string:
|
if string:
|
||||||
self.extra_textbox_label.set_text(label)
|
self.extra_textbox_label.set_text(label)
|
||||||
self.extra_textbox_label.show()
|
self.extra_textbox_label.show()
|
||||||
self.extra_textbox.insert_defaults(string)
|
self.extra_textbox.insert_defaults(string)
|
||||||
|
self.add_tooltip(self.extra_textbox,tip)
|
||||||
self.topDialog.get_widget("extra_scrolledwindow").show()
|
self.topDialog.get_widget("extra_scrolledwindow").show()
|
||||||
|
|
||||||
def setup_other_frames(self):
|
def setup_other_frames(self):
|
||||||
@ -631,6 +638,17 @@ class ReportDialog:
|
|||||||
write the data to a file."""
|
write the data to a file."""
|
||||||
assert 0, _("The make_report function must be overridden.")
|
assert 0, _("The make_report function must be overridden.")
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Miscellaneous functions.
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
def add_tooltip(self,widget,string):
|
||||||
|
if not widget or not string:
|
||||||
|
return
|
||||||
|
tip = gtk.GtkTooltips()
|
||||||
|
tip.set_tip(widget,string)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# TextReportDialog - A class of ReportDialog customized for text based
|
# TextReportDialog - A class of ReportDialog customized for text based
|
||||||
|
@ -274,9 +274,10 @@ class AncestorChartDialog(DrawReportDialog):
|
|||||||
"""Default to 10 generations, no page breaks."""
|
"""Default to 10 generations, no page breaks."""
|
||||||
return (10, 0)
|
return (10, 0)
|
||||||
|
|
||||||
def get_report_extra_textbox_string(self):
|
def get_report_extra_textbox_info(self):
|
||||||
"""Label the textbox and provide the default contents."""
|
"""Label the textbox and provide the default contents."""
|
||||||
return (_("Display Format"), "$n\nb. $b\nd. $d")
|
return (_("Display Format"), "$n\nb. $b\nd. $d",
|
||||||
|
_("Allows you to customize the data in the boxes in the report"))
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -358,7 +358,7 @@ class FamilyGroupDialog(TextReportDialog):
|
|||||||
"""No generation options."""
|
"""No generation options."""
|
||||||
return (0, 0)
|
return (0, 0)
|
||||||
|
|
||||||
def get_report_extra_menu_map(self):
|
def get_report_extra_menu_info(self):
|
||||||
"""Create a mapping of all spouse names:families to be put
|
"""Create a mapping of all spouse names:families to be put
|
||||||
into the 'extra' option menu in the report options box. If
|
into the 'extra' option menu in the report options box. If
|
||||||
the selected person has never been married then this routine
|
the selected person has never been married then this routine
|
||||||
@ -378,7 +378,7 @@ class FamilyGroupDialog(TextReportDialog):
|
|||||||
else:
|
else:
|
||||||
name= _("unknown")
|
name= _("unknown")
|
||||||
mapping[name] = family
|
mapping[name] = family
|
||||||
return (_("Spouse"), mapping, None)
|
return (_("Spouse"), mapping, None, None)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user