2007-08-25 Don Allingham <don@gramps-project.org>

* src/Config/_GrampsConfigKeys.py; Add EXPORT_NO_PRIVATE and
	EXPORT_RESTRICT
	* src/Config/_GrampsIniKeys.py: properly handle False values
	* src/ExportOptions.py: replace deprecated OptionMenu with ComboBox



svn: r8867
This commit is contained in:
Don Allingham 2007-08-25 15:34:13 +00:00
parent 39eee89295
commit 342f60a78f
4 changed files with 36 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2007-08-25 Don Allingham <don@gramps-project.org>
* src/Config/_GrampsConfigKeys.py; Add EXPORT_NO_PRIVATE and
EXPORT_RESTRICT
* src/Config/_GrampsIniKeys.py: properly handle False values
* src/ExportOptions.py: replace deprecated OptionMenu with ComboBox
2007-08-25 Benny Malengier <bm@cage.ugent.be>
* src/Config/_GrampsConfigKeys.py : store last export type
* src/ExportAssistant.py : use last export type

View File

@ -46,7 +46,8 @@ Then add the variable to the default_value map at the end of the
file, and provide a default value according to the value's type.
"""
EXPORT_NO_PRIVATE = ('export', 'no-private', 0)
EXPORT_RESTRICT = ('export', 'restrict-living', 0)
DEFAULT_SOURCE = ('preferences', 'default-source', 0)
RELATION_SHADE = ('preferences', 'relation-shade', 0)
ONLINE_MAPS = ('preferences', 'online-maps', 0)
@ -250,4 +251,6 @@ default_value = {
REPO_REF_HEIGHT : 450,
REPO_REF_WIDTH : 600,
OWNER_WARN : False,
EXPORT_NO_PRIVATE : True,
EXPORT_RESTRICT : True,
}

View File

@ -210,7 +210,7 @@ def get(key):
val = get_int(key)
else:
val = get_string(key)
if not val:
if val == None:
val = default_value[key]
return val
@ -219,7 +219,7 @@ def get_bool(key):
val = client.get_bool(key)
except KeyError:
val = None
if val in (True,False):
if val in (True, False):
return val
elif key in default_value:
return default_value[key]

View File

@ -21,6 +21,8 @@ import gtk
from gettext import gettext as _
import RelLib
import Config
from BasicUtils import name_displayer
from Filters import GenericFilter, Rules, build_filter_menu
@ -62,14 +64,15 @@ class WriterOptionBox:
self.person = person
def get_option_box(self):
self.restrict = True
table = gtk.Table(3, 2)
label = gtk.Label('Filter')
self.filter_obj = gtk.OptionMenu()
self.filter_obj = gtk.ComboBox()
self.private_check = gtk.CheckButton(_('Do not include records marked private'))
self.restrict_check = gtk.CheckButton(_('Restrict data on living people'))
self.private_check.set_active(Config.get(Config.EXPORT_NO_PRIVATE))
self.restrict_check.set_active(Config.get(Config.EXPORT_RESTRICT))
table.set_border_width(12)
table.set_row_spacings(6)
table.set_col_spacings(6)
@ -109,8 +112,16 @@ class WriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters)
self.filter_obj.set_menu(self.filter_menu)
model = gtk.ListStore(str, object)
for f in the_filters:
model.append(row=[f.get_name(), f])
cell = gtk.CellRendererText()
self.filter_obj.pack_start(cell, True)
self.filter_obj.add_attribute(cell, 'text', 0)
self.filter_obj.set_model(model)
self.filter_obj.set_active(0)
table.show()
return table
@ -119,5 +130,12 @@ class WriterOptionBox:
self.restrict = self.restrict_check.get_active()
self.private = self.private_check.get_active()
self.cfilter = self.filter_menu.get_active().get_data("filter")
Config.set(Config.EXPORT_NO_PRIVATE, self.private)
Config.set(Config.EXPORT_RESTRICT, self.restrict)
Config.sync()
model = self.filter_obj.get_model()
node = self.filter_obj.get_active_iter()
self.cfilter = model[node][1]