2007-12-17 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/CalculateEstimatedDates.py: Give good defaults for Filter and Enumerated Lists * src/plugins/Calendar.py: Give good defaults for Filter and Enumerated lists * src/PluginUtils/_MenuOptions.py: added a get_filter() method to return filter object; added a param to constructor to set default filter svn: r9526
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2007-12-17 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
|
* src/plugins/CalculateEstimatedDates.py: Give good defaults for Filter
|
||||||
|
and Enumerated Lists
|
||||||
|
* src/plugins/Calendar.py: Give good defaults for Filter and Enumerated
|
||||||
|
lists
|
||||||
|
* src/PluginUtils/_MenuOptions.py: added a get_filter() method to return
|
||||||
|
filter object; added a param to constructor to set default filter
|
||||||
|
|
||||||
2007-12-16 Brian Matherly <brian@gramps-project.org>
|
2007-12-16 Brian Matherly <brian@gramps-project.org>
|
||||||
* src/plugins/Calendar.py: Properly initialize Filter option.
|
* src/plugins/Calendar.py: Properly initialize Filter option.
|
||||||
* src/PluginUtils/_MenuOptions.py: Properly initialize Filter option.
|
* src/PluginUtils/_MenuOptions.py: Properly initialize Filter option.
|
||||||
|
@ -386,14 +386,14 @@ class FilterListOption(Option):
|
|||||||
This class describes an option that provides a finite list of filters.
|
This class describes an option that provides a finite list of filters.
|
||||||
Each possible value is assigned a type of set of filters to use.
|
Each possible value is assigned a type of set of filters to use.
|
||||||
"""
|
"""
|
||||||
def __init__(self,label):
|
def __init__(self,label,value=0):
|
||||||
"""
|
"""
|
||||||
@param label: A friendly label to be applied to this option.
|
@param label: A friendly label to be applied to this option.
|
||||||
Example: "Filter"
|
Example: "Filter"
|
||||||
@type label: string
|
@type label: string
|
||||||
@return: nothing
|
@return: nothing
|
||||||
"""
|
"""
|
||||||
Option.__init__(self,label,0)
|
Option.__init__(self,label,value)
|
||||||
self.__items = []
|
self.__items = []
|
||||||
self.__filters = []
|
self.__filters = []
|
||||||
|
|
||||||
@ -453,7 +453,6 @@ class FilterListOption(Option):
|
|||||||
self.gobj = gtk.HBox()
|
self.gobj = gtk.HBox()
|
||||||
for filter in self.get_items():
|
for filter in self.get_items():
|
||||||
if filter in ["person"]:
|
if filter in ["person"]:
|
||||||
# FIXME: get filter list from filter sidebar?
|
|
||||||
filter_list = ReportUtils.get_person_filters(dialog.person,
|
filter_list = ReportUtils.get_person_filters(dialog.person,
|
||||||
include_single=True)
|
include_single=True)
|
||||||
for filter in filter_list:
|
for filter in filter_list:
|
||||||
@ -479,6 +478,12 @@ class FilterListOption(Option):
|
|||||||
def get_center_person(self):
|
def get_center_person(self):
|
||||||
return self.dialog.person
|
return self.dialog.person
|
||||||
|
|
||||||
|
def get_filter(self):
|
||||||
|
"""
|
||||||
|
Return the filter object.
|
||||||
|
"""
|
||||||
|
return self.get_filters()[int(self.combo.get_active())]
|
||||||
|
|
||||||
def update_gui_obj(self):
|
def update_gui_obj(self):
|
||||||
# update the gui object with new filter info
|
# update the gui object with new filter info
|
||||||
from ReportBase import ReportUtils
|
from ReportBase import ReportUtils
|
||||||
|
@ -55,7 +55,7 @@ class CalcEstDateOptions(MenuToolOptions):
|
|||||||
""" Adds the options """
|
""" Adds the options """
|
||||||
category_name = _("Options")
|
category_name = _("Options")
|
||||||
|
|
||||||
filter = FilterListOption(_("Filter"))
|
filter = FilterListOption(_("Filter"), 3)
|
||||||
filter.add_item("person")
|
filter.add_item("person")
|
||||||
filter.set_help(_("Select filter to restrict people"))
|
filter.set_help(_("Select filter to restrict people"))
|
||||||
menu.add_option(category_name,"filter", filter)
|
menu.add_option(category_name,"filter", filter)
|
||||||
@ -121,7 +121,8 @@ class CalcToolManagedWindow(PluginWindows.ToolManagedWindowBatch):
|
|||||||
self.results_write("Processing...\n")
|
self.results_write("Processing...\n")
|
||||||
self.trans = self.db.transaction_begin("",batch=True)
|
self.trans = self.db.transaction_begin("",batch=True)
|
||||||
self.db.disable_signals()
|
self.db.disable_signals()
|
||||||
self.filter = self.options.handler.options_dict['filter']
|
self.filter_option = self.options.menu.get_option_by_name('filter')
|
||||||
|
self.filter = self.filter_option.get_filter() # the actual filter
|
||||||
people = self.filter.apply(self.db,
|
people = self.filter.apply(self.db,
|
||||||
self.db.get_person_handles(sort_handles=False))
|
self.db.get_person_handles(sort_handles=False))
|
||||||
source_text = self.options.handler.options_dict['source_text']
|
source_text = self.options.handler.options_dict['source_text']
|
||||||
|
@ -143,9 +143,7 @@ class Calendar(Report):
|
|||||||
self.text2 = options_class.handler.options_dict['text2']
|
self.text2 = options_class.handler.options_dict['text2']
|
||||||
self.text3 = options_class.handler.options_dict['text3']
|
self.text3 = options_class.handler.options_dict['text3']
|
||||||
self.filter_option = options_class.menu.get_option_by_name('filter')
|
self.filter_option = options_class.menu.get_option_by_name('filter')
|
||||||
filter_index = int(self.filter_option.get_value())
|
self.filter = self.filter_option.get_filter()
|
||||||
filters = self.filter_option.get_filters()
|
|
||||||
self.filter = filters[filter_index]
|
|
||||||
|
|
||||||
self.title = _("Calendar Report") #% name
|
self.title = _("Calendar Report") #% name
|
||||||
|
|
||||||
@ -487,13 +485,13 @@ class CalendarOptions(MenuReportOptions):
|
|||||||
filter.set_help(_("Select filter to restrict people that appear on calendar"))
|
filter.set_help(_("Select filter to restrict people that appear on calendar"))
|
||||||
menu.add_option(category_name,"filter", filter)
|
menu.add_option(category_name,"filter", filter)
|
||||||
|
|
||||||
name_format = EnumeratedListOption(_("Name format"), (1, ""))
|
name_format = EnumeratedListOption(_("Name format"), -1)
|
||||||
for num, name, fmt_str, act in name_displayer.get_name_format():
|
for num, name, fmt_str, act in name_displayer.get_name_format():
|
||||||
name_format.add_item(num, name)
|
name_format.add_item(num, name)
|
||||||
name_format.set_help(_("Select the format to display names"))
|
name_format.set_help(_("Select the format to display names"))
|
||||||
menu.add_option(category_name,"name_format", name_format)
|
menu.add_option(category_name,"name_format", name_format)
|
||||||
|
|
||||||
country = EnumeratedListOption(_("Country for holidays"), (0,_("Don't include holidays")))
|
country = EnumeratedListOption(_("Country for holidays"), 0)
|
||||||
count = 0
|
count = 0
|
||||||
for c in _countries:
|
for c in _countries:
|
||||||
country.add_item(count, c)
|
country.add_item(count, c)
|
||||||
@ -501,15 +499,14 @@ class CalendarOptions(MenuReportOptions):
|
|||||||
country.set_help(_("Select the country to see associated holidays"))
|
country.set_help(_("Select the country to see associated holidays"))
|
||||||
menu.add_option(category_name,"country", country)
|
menu.add_option(category_name,"country", country)
|
||||||
|
|
||||||
start_dow = EnumeratedListOption(_("First day of week"), GrampsLocale.long_days[1].capitalize())
|
start_dow = EnumeratedListOption(_("First day of week"), 1)
|
||||||
for count in range(1,8):
|
for count in range(1,8):
|
||||||
# conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below
|
# conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below
|
||||||
start_dow.add_item((count+5) % 7 + 1, GrampsLocale.long_days[count].capitalize())
|
start_dow.add_item((count+5) % 7 + 1, GrampsLocale.long_days[count].capitalize())
|
||||||
start_dow.set_help(_("Select the first day of the week for the calendar"))
|
start_dow.set_help(_("Select the first day of the week for the calendar"))
|
||||||
menu.add_option(category_name, "start_dow", start_dow)
|
menu.add_option(category_name, "start_dow", start_dow)
|
||||||
|
|
||||||
maiden_name = EnumeratedListOption(_("Birthday surname"),
|
maiden_name = EnumeratedListOption(_("Birthday surname"), "own")
|
||||||
("own", _("Wives use their own surname")))
|
|
||||||
maiden_name.add_item("spouse_first", _("Wives use husband's surname (from first family listed)"))
|
maiden_name.add_item("spouse_first", _("Wives use husband's surname (from first family listed)"))
|
||||||
maiden_name.add_item("spouse_last", _("Wives use husband's surname (from last family listed)"))
|
maiden_name.add_item("spouse_last", _("Wives use husband's surname (from last family listed)"))
|
||||||
maiden_name.add_item("own", _("Wives use their own surname"))
|
maiden_name.add_item("own", _("Wives use their own surname"))
|
||||||
|
Reference in New Issue
Block a user