New preferences dialog
svn: r703
This commit is contained in:
parent
302745652c
commit
72dc57b233
@ -56,8 +56,8 @@ _ = gettext
|
||||
_surname_styles = [
|
||||
_("Father's surname"),
|
||||
_("None"),
|
||||
_("Latin American style (Combination of mother's and father's surname)"),
|
||||
_("Icelandic style (Father's surname with son/daughter indicator)"),
|
||||
_("Combination of mother's and father's surname"),
|
||||
_("Icelandic style"),
|
||||
]
|
||||
|
||||
_date_format_list = [
|
||||
@ -87,6 +87,23 @@ _name_format_list = [
|
||||
(_("Surname, Firstname"), utils.phonebook_name),
|
||||
]
|
||||
|
||||
|
||||
notemap = {
|
||||
_("Database") : 1,
|
||||
_("Find") : 3,
|
||||
_("Revision Control") : 2,
|
||||
_("Tool and Status Bars") : 4,
|
||||
_("Display") : 5,
|
||||
_("List Colors") : 6,
|
||||
_("Dates and Calendars") : 7,
|
||||
_("Researcher Information") : 8,
|
||||
_("Report Preferences") : 9,
|
||||
_("Media Objects") : 10,
|
||||
_("GRAMPS internal IDs") : 11,
|
||||
_("Other") : 12,
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Visible globals
|
||||
@ -144,11 +161,11 @@ _druid = None
|
||||
# Constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
ODDFGCOLOR = "oddForeground"
|
||||
ODDBGCOLOR = "oddBackground"
|
||||
EVENFGCOLOR = "evenForeground"
|
||||
EVENBGCOLOR = "evenBackground"
|
||||
ANCESTORFGCOLOR = "ancestorForeground"
|
||||
ODDFGCOLOR = "oddfg"
|
||||
ODDBGCOLOR = "oddbg"
|
||||
EVENFGCOLOR = "evenfg"
|
||||
EVENBGCOLOR = "evenbg"
|
||||
ANCESTORFGCOLOR = "ancestorfg"
|
||||
INDEX = "i"
|
||||
OBJECT = "o"
|
||||
DATA = "d"
|
||||
@ -431,18 +448,251 @@ def store_researcher(res):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_propertybox_help(obj,page):
|
||||
import gnome.help
|
||||
def save_config_color(name,color):
|
||||
set_int("/gramps/color/" + name + ".r",color[0])
|
||||
set_int("/gramps/color/" + name + ".g",color[1])
|
||||
set_int("/gramps/color/" + name + ".b",color[2])
|
||||
|
||||
|
||||
class GrampsPreferences:
|
||||
def __init__(self,db):
|
||||
self.db = db
|
||||
self.top = libglade.GladeXML(const.prefsFile,"preferences")
|
||||
self.top.signal_autoconnect({
|
||||
"on_close_clicked" : self.on_close_clicked,
|
||||
"on_ok_clicked" : self.on_ok_clicked,
|
||||
"on_apply_clicked" : self.on_propertybox_apply,
|
||||
"on_help_clicked" : self.on_propertybox_help,
|
||||
"on_color_toggled" : self.on_color_toggled,
|
||||
"on_color_set" : self.on_color_set,
|
||||
"on_object_toggled" : self.on_object_toggled
|
||||
})
|
||||
|
||||
self.window = self.top.get_widget("preferences")
|
||||
self.apply = self.top.get_widget("apply")
|
||||
self.tree = self.top.get_widget("tree")
|
||||
self.panel = self.top.get_widget("panel")
|
||||
self.build_tree()
|
||||
self.build()
|
||||
self.apply.set_sensitive(0)
|
||||
|
||||
def build_tree(self):
|
||||
self.top_item = gtk.GtkTreeItem('GRAMPS')
|
||||
self.top_item.show()
|
||||
self.top_item.connect("select",self.select,0)
|
||||
self.tree.append(self.top_item)
|
||||
subtree = gtk.GtkTree()
|
||||
subtree.show()
|
||||
self.top_item.set_subtree(subtree)
|
||||
self.top_item.expand()
|
||||
for name in notemap.keys():
|
||||
item = gtk.GtkTreeItem(name)
|
||||
item.expand()
|
||||
item.connect("select",self.select,notemap[name])
|
||||
item.show()
|
||||
subtree.append(item)
|
||||
|
||||
def build(self):
|
||||
auto = self.top.get_widget("autoload")
|
||||
asave_int = self.top.get_widget("autosave_interval")
|
||||
vis = self.top.get_widget("gid_visible")
|
||||
idedit = self.top.get_widget("gid_edit")
|
||||
index_vis = self.top.get_widget("show_child_id")
|
||||
tabs = self.top.get_widget("usetabs")
|
||||
lds = self.top.get_widget("uselds")
|
||||
ac = self.top.get_widget("autocomp")
|
||||
mr = self.top.get_widget("mediaref")
|
||||
mc = self.top.get_widget("mediacopy")
|
||||
dg = self.top.get_widget("globalprop")
|
||||
dl = self.top.get_widget("localprop")
|
||||
cal = self.top.get_widget("calendar")
|
||||
vc = self.top.get_widget("use_vc")
|
||||
vcom = self.top.get_widget("vc_comment")
|
||||
compress = self.top.get_widget("uncompress")
|
||||
detail = self.top.get_widget("showdetail")
|
||||
display_attr_obj = self.top.get_widget("attr_display")
|
||||
display_altnames = self.top.get_widget("display_altnames")
|
||||
|
||||
auto.set_active(autoload)
|
||||
asave_int.set_value(int(autosave_int))
|
||||
detail.set_active(show_detail)
|
||||
tabs.set_active(usetabs)
|
||||
lds.set_active(uselds)
|
||||
ac.set_active(autocomp)
|
||||
if mediaref:
|
||||
mr.set_active(1)
|
||||
else:
|
||||
mc.set_active(1)
|
||||
dg.set_active(globalprop)
|
||||
dl.set_active(localprop)
|
||||
cal.set_active(calendar)
|
||||
vc.set_active(usevc)
|
||||
vcom.set_active(vc_comment)
|
||||
compress.set_active(uncompress)
|
||||
vis.set_active(id_visible)
|
||||
idedit.set_active(id_edit)
|
||||
index_vis.set_active(index_visible)
|
||||
|
||||
self.top.get_widget("iprefix").set_text(iprefix)
|
||||
self.top.get_widget("oprefix").set_text(oprefix)
|
||||
self.top.get_widget("fprefix").set_text(fprefix)
|
||||
self.top.get_widget("sprefix").set_text(sprefix)
|
||||
self.top.get_widget("pprefix").set_text(pprefix)
|
||||
|
||||
if status_bar == 0:
|
||||
self.top.get_widget("stat1").set_active(1)
|
||||
elif status_bar == 1:
|
||||
self.top.get_widget("stat2").set_active(1)
|
||||
else:
|
||||
self.top.get_widget("stat3").set_active(1)
|
||||
|
||||
if toolbar == 0:
|
||||
self.top.get_widget("tool1").set_active(1)
|
||||
elif toolbar == 1:
|
||||
self.top.get_widget("tool2").set_active(1)
|
||||
else:
|
||||
self.top.get_widget("tool3").set_active(1)
|
||||
|
||||
display_attr_obj.set_active(display_attr)
|
||||
self.top.get_widget("attr_name").set_text(attr_name)
|
||||
|
||||
display_altnames.set_active(hide_altnames)
|
||||
|
||||
paper_obj = self.top.get_widget("paper_size")
|
||||
menu = gtk.GtkMenu()
|
||||
choice = 0
|
||||
for index in range(0,len(PaperMenu.paper_sizes)):
|
||||
name = PaperMenu.paper_sizes[index].get_name()
|
||||
if name == paper_preference:
|
||||
choice = index
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data(DATA,name)
|
||||
item.connect("activate", self.on_format_toggled)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
menu.set_active(choice)
|
||||
paper_obj.set_menu(menu)
|
||||
|
||||
lastnamegen_obj = self.top.get_widget("lastnamegen")
|
||||
menu = gtk.GtkMenu()
|
||||
choice = 0
|
||||
for index in range(0,len(_surname_styles)):
|
||||
name = _surname_styles[index]
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data(DATA,index)
|
||||
item.connect("activate", self.on_format_toggled)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
menu.set_active(lastnamegen)
|
||||
lastnamegen_obj.set_menu(menu)
|
||||
|
||||
output_obj = self.top.get_widget("output_format")
|
||||
menu = gtk.GtkMenu()
|
||||
choice = 0
|
||||
|
||||
choice = 0
|
||||
index = 0
|
||||
for name in const.output_formats:
|
||||
if name == output_preference:
|
||||
choice = index
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data(DATA,name)
|
||||
item.connect("activate", self.on_format_toggled)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
index = index + 1
|
||||
menu.set_active(choice)
|
||||
output_obj.set_menu(menu)
|
||||
|
||||
date_option = self.top.get_widget("date_format")
|
||||
date_menu = gtk.GtkMenu()
|
||||
for index in range(0,len(_date_format_list)):
|
||||
item = gtk.GtkMenuItem(_date_format_list[index])
|
||||
item.set_data(INDEX,index)
|
||||
item.connect("activate", self.on_format_toggled)
|
||||
item.show()
|
||||
date_menu.append(item)
|
||||
date_menu.set_active(get_format_code())
|
||||
date_option.set_menu(date_menu)
|
||||
|
||||
date_entry = self.top.get_widget("date_entry_format")
|
||||
date_menu = gtk.GtkMenu()
|
||||
for index in range(0,len(_date_entry_list)):
|
||||
item = gtk.GtkMenuItem(_date_entry_list[index])
|
||||
item.set_data(INDEX,index)
|
||||
item.connect("activate", self.on_format_toggled)
|
||||
item.show()
|
||||
date_menu.append(item)
|
||||
date_menu.set_active(Date.entryCode)
|
||||
date_entry.set_menu(date_menu)
|
||||
|
||||
name_option = self.top.get_widget("name_format")
|
||||
name_menu = gtk.GtkMenu()
|
||||
for index in range(0,len(_name_format_list)):
|
||||
name_tuple = _name_format_list[index]
|
||||
item = gtk.GtkMenuItem(name_tuple[0])
|
||||
item.set_data(INDEX,index)
|
||||
item.connect("activate", self.on_format_toggled)
|
||||
item.show()
|
||||
name_menu.append(item)
|
||||
name_menu.set_active(_name_format)
|
||||
name_option.set_menu(name_menu)
|
||||
|
||||
self.top.get_widget("resname").set_text(owner.getName())
|
||||
self.top.get_widget("resaddr").set_text(owner.getAddress())
|
||||
self.top.get_widget("rescity").set_text(owner.getCity())
|
||||
self.top.get_widget("resstate").set_text(owner.getState())
|
||||
self.top.get_widget("rescountry").set_text(owner.getCountry())
|
||||
self.top.get_widget("respostal").set_text(owner.getPostalCode())
|
||||
self.top.get_widget("resphone").set_text(owner.getPhone())
|
||||
self.top.get_widget("resemail").set_text(owner.getEmail())
|
||||
|
||||
cwidget = self.top.get_widget(ODDFGCOLOR)
|
||||
cwidget.set_i16(ListColors.oddfg[0],ListColors.oddfg[1],\
|
||||
ListColors.oddfg[2],0xffff)
|
||||
|
||||
cwidget = self.top.get_widget(ODDBGCOLOR)
|
||||
cwidget.set_i16(ListColors.oddbg[0],ListColors.oddbg[1],\
|
||||
ListColors.oddbg[2],0xffff)
|
||||
|
||||
cwidget = self.top.get_widget(EVENFGCOLOR)
|
||||
cwidget.set_i16(ListColors.evenfg[0],ListColors.evenfg[1],\
|
||||
ListColors.evenfg[2],0xffff)
|
||||
|
||||
cwidget = self.top.get_widget(EVENBGCOLOR)
|
||||
cwidget.set_i16(ListColors.evenbg[0],ListColors.evenbg[1],\
|
||||
ListColors.evenbg[2],0xffff)
|
||||
|
||||
cwidget = self.top.get_widget(ANCESTORFGCOLOR)
|
||||
cwidget.set_i16(ListColors.ancestorfg[0],ListColors.ancestorfg[1],\
|
||||
ListColors.ancestorfg[2],0xffff)
|
||||
|
||||
self.top.get_widget("enableColors").set_active(ListColors.get_enable())
|
||||
self.top.get_widget(ODDFGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
self.top.get_widget(ODDBGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
self.top.get_widget(EVENBGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
self.top.get_widget(EVENFGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
self.top.get_widget(ANCESTORFGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
|
||||
self.top.get_widget("dbdir").gtk_entry().set_text(db_dir)
|
||||
self.top.get_widget("repdir").gtk_entry().set_text(report_dir)
|
||||
self.top.get_widget("htmldir").gtk_entry().set_text(web_dir)
|
||||
|
||||
def select(self,obj,data):
|
||||
self.panel.set_page(data)
|
||||
|
||||
def on_propertybox_help(self,obj):
|
||||
import gnome.help
|
||||
gnome.help.display('gramps-manual','prefs.html')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Apply values set in the property box. For simplicity, only apply the
|
||||
# values when the page is -1 (the box has been closed).
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_propertybox_apply(obj,page):
|
||||
def on_close_clicked(self,obj):
|
||||
utils.destroy_passed_object(self.window)
|
||||
|
||||
def on_ok_clicked(self,obj):
|
||||
self.on_propertybox_apply(obj)
|
||||
utils.destroy_passed_object(self.window)
|
||||
|
||||
def on_propertybox_apply(self,obj):
|
||||
global nameof
|
||||
global owner
|
||||
global usetabs
|
||||
@ -476,70 +726,67 @@ def on_propertybox_apply(obj,page):
|
||||
global db_dir
|
||||
global lastnamegen
|
||||
|
||||
if page != -1:
|
||||
return
|
||||
show_detail = self.top.get_widget("showdetail").get_active()
|
||||
autoload = self.top.get_widget("autoload").get_active()
|
||||
autosave_int = self.top.get_widget("autosave_interval").get_value_as_int()
|
||||
display_attr = self.top.get_widget("attr_display").get_active()
|
||||
attr_name = string.strip(self.top.get_widget("attr_name").get_text())
|
||||
usetabs = self.top.get_widget("usetabs").get_active()
|
||||
uselds = self.top.get_widget("uselds").get_active()
|
||||
autocomp = self.top.get_widget("autocomp").get_active()
|
||||
mediaref = self.top.get_widget("mediaref").get_active()
|
||||
localprop = self.top.get_widget("localprop").get_active()
|
||||
globalprop = self.top.get_widget("globalprop").get_active()
|
||||
calendar = self.top.get_widget("calendar").get_active()
|
||||
usevc = self.top.get_widget("use_vc").get_active()
|
||||
vc_comment = self.top.get_widget("vc_comment").get_active()
|
||||
uncompress = self.top.get_widget("uncompress").get_active()
|
||||
id_visible = self.top.get_widget("gid_visible").get_active()
|
||||
id_edit = self.top.get_widget("gid_edit").get_active()
|
||||
index_visible = self.top.get_widget("show_child_id").get_active()
|
||||
hide_altnames = self.top.get_widget("display_altnames").get_active()
|
||||
paper_obj = self.top.get_widget("paper_size").get_menu().get_active()
|
||||
output_obj = self.top.get_widget("output_format").get_menu().get_active()
|
||||
|
||||
show_detail = prefsTop.get_widget("showdetail").get_active()
|
||||
autoload = prefsTop.get_widget("autoload").get_active()
|
||||
autosave_int = prefsTop.get_widget("save_interval").get_value_as_int()
|
||||
display_attr = prefsTop.get_widget("attr_display").get_active()
|
||||
attr_name = string.strip(prefsTop.get_widget("attr_name").get_text())
|
||||
usetabs = prefsTop.get_widget("usetabs").get_active()
|
||||
uselds = prefsTop.get_widget("uselds").get_active()
|
||||
autocomp = prefsTop.get_widget("autocomp").get_active()
|
||||
mediaref = prefsTop.get_widget("mediaref").get_active()
|
||||
localprop = prefsTop.get_widget("localprop").get_active()
|
||||
globalprop = prefsTop.get_widget("globalprop").get_active()
|
||||
calendar = prefsTop.get_widget("calendar").get_active()
|
||||
usevc = prefsTop.get_widget("use_vc").get_active()
|
||||
vc_comment = prefsTop.get_widget("vc_comment").get_active()
|
||||
uncompress = prefsTop.get_widget("uncompress").get_active()
|
||||
id_visible = prefsTop.get_widget("gid_visible").get_active()
|
||||
id_edit = prefsTop.get_widget("gid_edit").get_active()
|
||||
index_visible = prefsTop.get_widget("show_child_id").get_active()
|
||||
hide_altnames = prefsTop.get_widget("display_altnames").get_active()
|
||||
paper_obj = prefsTop.get_widget("paper_size").get_menu().get_active()
|
||||
output_obj = prefsTop.get_widget("output_format").get_menu().get_active()
|
||||
|
||||
if prefsTop.get_widget("stat1").get_active():
|
||||
if self.top.get_widget("stat1").get_active():
|
||||
status_bar = 0
|
||||
elif prefsTop.get_widget("stat2").get_active():
|
||||
elif self.top.get_widget("stat2").get_active():
|
||||
status_bar = 1
|
||||
else:
|
||||
status_bar = 2
|
||||
|
||||
if prefsTop.get_widget("tool1").get_active():
|
||||
if self.top.get_widget("tool1").get_active():
|
||||
toolbar = 0
|
||||
elif prefsTop.get_widget("tool2").get_active():
|
||||
elif self.top.get_widget("tool2").get_active():
|
||||
toolbar = 1
|
||||
else:
|
||||
toolbar = 2
|
||||
|
||||
iprefix = prefsTop.get_widget("iprefix").get_text()
|
||||
iprefix = self.top.get_widget("iprefix").get_text()
|
||||
if iprefix == "":
|
||||
iprefix = "I"
|
||||
sprefix = prefsTop.get_widget("sprefix").get_text()
|
||||
sprefix = self.top.get_widget("sprefix").get_text()
|
||||
if sprefix == "":
|
||||
sprefix = "S"
|
||||
oprefix = prefsTop.get_widget("oprefix").get_text()
|
||||
oprefix = self.top.get_widget("oprefix").get_text()
|
||||
if oprefix == "":
|
||||
oprefix = "O"
|
||||
fprefix = prefsTop.get_widget("fprefix").get_text()
|
||||
fprefix = self.top.get_widget("fprefix").get_text()
|
||||
if fprefix == "":
|
||||
fprefix = "F"
|
||||
pprefix = prefsTop.get_widget("pprefix").get_text()
|
||||
pprefix = self.top.get_widget("pprefix").get_text()
|
||||
if pprefix == "":
|
||||
pprefix = "P"
|
||||
|
||||
dbdir_temp = prefsTop.get_widget("dbdir").get_full_path(1)
|
||||
dbdir_temp = self.top.get_widget("dbdir").get_full_path(1)
|
||||
if dbdir_temp != None and os.path.isdir(dbdir_temp):
|
||||
db_dir = os.path.normpath(dbdir_temp) + os.sep
|
||||
|
||||
repdir_temp = prefsTop.get_widget("repdir").get_full_path(1)
|
||||
repdir_temp = self.top.get_widget("repdir").get_full_path(1)
|
||||
if repdir_temp != None and os.path.isdir(repdir_temp):
|
||||
report_dir = os.path.normpath(repdir_temp) + os.sep
|
||||
|
||||
webdir_temp = prefsTop.get_widget("htmldir").get_full_path(1)
|
||||
webdir_temp = self.top.get_widget("htmldir").get_full_path(1)
|
||||
if webdir_temp != None and os.path.isdir(webdir_temp):
|
||||
web_dir = os.path.normpath(webdir_temp) + os.sep
|
||||
|
||||
@ -585,14 +832,13 @@ def on_propertybox_apply(obj,page):
|
||||
set_string("/gramps/config/sprefix",sprefix)
|
||||
|
||||
# search for the active date format selection
|
||||
|
||||
format_menu = prefsTop.get_widget("date_format").get_menu()
|
||||
format_menu = self.top.get_widget("date_format").get_menu()
|
||||
active = format_menu.get_active().get_data(INDEX)
|
||||
|
||||
set_format_code(active)
|
||||
set_int("/gramps/config/dateFormat",active)
|
||||
|
||||
format_menu = prefsTop.get_widget("date_entry_format").get_menu()
|
||||
format_menu = self.top.get_widget("date_entry_format").get_menu()
|
||||
entry_active = format_menu.get_active().get_data(INDEX)
|
||||
|
||||
Date.entryCode = entry_active
|
||||
@ -600,34 +846,34 @@ def on_propertybox_apply(obj,page):
|
||||
|
||||
# get the name format
|
||||
|
||||
format_menu = prefsTop.get_widget("name_format").get_menu()
|
||||
format_menu = self.top.get_widget("name_format").get_menu()
|
||||
active_name = format_menu.get_active().get_data(INDEX)
|
||||
|
||||
name_tuple = _name_format_list[active_name]
|
||||
nameof = name_tuple[1]
|
||||
set_int("/gramps/config/nameFormat",active_name)
|
||||
|
||||
format_menu = prefsTop.get_widget("lastnamegen").get_menu()
|
||||
format_menu = self.top.get_widget("lastnamegen").get_menu()
|
||||
lastnamegen = format_menu.get_active().get_data(DATA)
|
||||
set_int("/gramps/config/surnameGuessing",lastnamegen)
|
||||
|
||||
name = prefsTop.get_widget("resname").get_text()
|
||||
addr = prefsTop.get_widget("resaddr").get_text()
|
||||
city = prefsTop.get_widget("rescity").get_text()
|
||||
state = prefsTop.get_widget("resstate").get_text()
|
||||
country = prefsTop.get_widget("rescountry").get_text()
|
||||
postal = prefsTop.get_widget("respostal").get_text()
|
||||
phone = prefsTop.get_widget("resphone").get_text()
|
||||
email = prefsTop.get_widget("resemail").get_text()
|
||||
name = self.top.get_widget("resname").get_text()
|
||||
addr = self.top.get_widget("resaddr").get_text()
|
||||
city = self.top.get_widget("rescity").get_text()
|
||||
state = self.top.get_widget("resstate").get_text()
|
||||
country = self.top.get_widget("rescountry").get_text()
|
||||
postal = self.top.get_widget("respostal").get_text()
|
||||
phone = self.top.get_widget("resphone").get_text()
|
||||
email = self.top.get_widget("resemail").get_text()
|
||||
|
||||
ListColors.set_enable(prefsTop.get_widget("enableColors").get_active())
|
||||
ListColors.set_enable(self.top.get_widget("enableColors").get_active())
|
||||
set_bool("/gramps/color/enableColors",ListColors.get_enable())
|
||||
|
||||
ListColors.oddfg = prefsTop.get_widget(ODDFGCOLOR).get_i16()
|
||||
ListColors.oddbg = prefsTop.get_widget(ODDBGCOLOR).get_i16()
|
||||
ListColors.evenfg = prefsTop.get_widget(EVENFGCOLOR).get_i16()
|
||||
ListColors.evenbg = prefsTop.get_widget(EVENBGCOLOR).get_i16()
|
||||
ListColors.ancestorfg = prefsTop.get_widget(ANCESTORFGCOLOR).get_i16()
|
||||
ListColors.oddfg = self.top.get_widget(ODDFGCOLOR).get_i16()
|
||||
ListColors.oddbg = self.top.get_widget(ODDBGCOLOR).get_i16()
|
||||
ListColors.evenfg = self.top.get_widget(EVENFGCOLOR).get_i16()
|
||||
ListColors.evenbg = self.top.get_widget(EVENBGCOLOR).get_i16()
|
||||
ListColors.ancestorfg = self.top.get_widget(ANCESTORFGCOLOR).get_i16()
|
||||
|
||||
save_config_color(ODDFGCOLOR,ListColors.oddfg)
|
||||
save_config_color(ODDBGCOLOR,ListColors.oddbg)
|
||||
@ -638,69 +884,42 @@ def on_propertybox_apply(obj,page):
|
||||
owner.set(name,addr,city,state,country,postal,phone,email)
|
||||
store_researcher(owner)
|
||||
|
||||
db = obj.get_data("db")
|
||||
db.set_iprefix(iprefix)
|
||||
db.set_fprefix(fprefix)
|
||||
db.set_sprefix(sprefix)
|
||||
db.set_oprefix(oprefix)
|
||||
db.set_pprefix(pprefix)
|
||||
self.db.set_iprefix(iprefix)
|
||||
self.db.set_fprefix(fprefix)
|
||||
self.db.set_sprefix(sprefix)
|
||||
self.db.set_oprefix(oprefix)
|
||||
self.db.set_pprefix(pprefix)
|
||||
|
||||
# update the config file
|
||||
|
||||
sync()
|
||||
_callback()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def save_config_color(name,color):
|
||||
set_int("/gramps/color/" + name + ".r",color[0])
|
||||
set_int("/gramps/color/" + name + ".g",color[1])
|
||||
set_int("/gramps/color/" + name + ".b",color[2])
|
||||
def on_object_toggled(self,obj):
|
||||
"""Called by the elements on the property box to set the changed flag,
|
||||
so that the property box knows to set the Apply button"""
|
||||
self.apply.set_sensitive(1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Called by the elements on the property box to set the changed flag,
|
||||
# so that the property box knows to set the Apply button
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_object_toggled(obj):
|
||||
obj.changed()
|
||||
def on_format_toggled(self,obj):
|
||||
"""Called by the elements on the property box to set the changed flag,
|
||||
so that the property box knows to set the Apply button"""
|
||||
self.apply.set_sensitive(1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Called by the elements on the property box to set the changed flag,
|
||||
# so that the property box knows to set the Apply button
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_format_toggled(obj):
|
||||
obj.get_data(OBJECT).changed()
|
||||
def on_color_toggled(self,obj):
|
||||
"""Called by the elements on the property box to set the changed flag,
|
||||
so that the property box knows to set the Apply button"""
|
||||
active = self.top.get_widget("enableColors").get_active()
|
||||
self.top.get_widget(ODDFGCOLOR).set_sensitive(active)
|
||||
self.top.get_widget(ODDBGCOLOR).set_sensitive(active)
|
||||
self.top.get_widget(EVENFGCOLOR).set_sensitive(active)
|
||||
self.top.get_widget(EVENBGCOLOR).set_sensitive(active)
|
||||
self.top.get_widget(ANCESTORFGCOLOR).set_sensitive(active)
|
||||
self.apply.set_sensitive(1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Called by the elements on the property box to set the changed flag,
|
||||
# so that the property box knows to set the Apply button
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_color_toggled(obj):
|
||||
active = prefsTop.get_widget("enableColors").get_active()
|
||||
prefsTop.get_widget(ODDFGCOLOR).set_sensitive(active)
|
||||
prefsTop.get_widget(ODDBGCOLOR).set_sensitive(active)
|
||||
prefsTop.get_widget(EVENFGCOLOR).set_sensitive(active)
|
||||
prefsTop.get_widget(EVENBGCOLOR).set_sensitive(active)
|
||||
prefsTop.get_widget(ANCESTORFGCOLOR).set_sensitive(active)
|
||||
obj.changed()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Called by the elements on the property box to set the changed flag,
|
||||
# so that the property box knows to set the Apply button
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_color_set(obj,r,g,b,a):
|
||||
obj.changed()
|
||||
def on_color_set(self,obj,r,g,b,a):
|
||||
"""Called by the elements on the property box to set the changed flag,
|
||||
so that the property box knows to set the Apply button"""
|
||||
self.apply.set_sensitive(1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -708,212 +927,7 @@ def on_color_set(obj,r,g,b,a):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def display_preferences_box(db):
|
||||
global prefsTop
|
||||
|
||||
prefsTop = libglade.GladeXML(const.configFile,"propertybox")
|
||||
prefsTop.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_propertybox_apply" : on_propertybox_apply,
|
||||
"on_propertybox_help" : on_propertybox_help,
|
||||
"on_color_toggled" : on_color_toggled,
|
||||
"on_color_set" : on_color_set,
|
||||
"on_object_toggled" : on_object_toggled
|
||||
})
|
||||
|
||||
pbox = prefsTop.get_widget("propertybox")
|
||||
pbox.set_data("db",db)
|
||||
auto = prefsTop.get_widget("autoload")
|
||||
asave_int = prefsTop.get_widget("save_interval")
|
||||
vis = prefsTop.get_widget("gid_visible")
|
||||
idedit = prefsTop.get_widget("gid_edit")
|
||||
index_vis = prefsTop.get_widget("show_child_id")
|
||||
tabs = prefsTop.get_widget("usetabs")
|
||||
lds = prefsTop.get_widget("uselds")
|
||||
ac = prefsTop.get_widget("autocomp")
|
||||
mr = prefsTop.get_widget("mediaref")
|
||||
mc = prefsTop.get_widget("mediacopy")
|
||||
dg = prefsTop.get_widget("globalprop")
|
||||
dl = prefsTop.get_widget("localprop")
|
||||
cal = prefsTop.get_widget("calendar")
|
||||
vc = prefsTop.get_widget("use_vc")
|
||||
vcom = prefsTop.get_widget("vc_comment")
|
||||
compress = prefsTop.get_widget("uncompress")
|
||||
detail = prefsTop.get_widget("showdetail")
|
||||
display_attr_obj = prefsTop.get_widget("attr_display")
|
||||
display_altnames = prefsTop.get_widget("display_altnames")
|
||||
auto.set_active(autoload)
|
||||
asave_int.set_value(autosave_int)
|
||||
detail.set_active(show_detail)
|
||||
tabs.set_active(usetabs)
|
||||
lds.set_active(uselds)
|
||||
ac.set_active(autocomp)
|
||||
if mediaref:
|
||||
mr.set_active(1)
|
||||
else:
|
||||
mc.set_active(1)
|
||||
dg.set_active(globalprop)
|
||||
dl.set_active(localprop)
|
||||
cal.set_active(calendar)
|
||||
vc.set_active(usevc)
|
||||
vcom.set_active(vc_comment)
|
||||
compress.set_active(uncompress)
|
||||
vis.set_active(id_visible)
|
||||
idedit.set_active(id_edit)
|
||||
index_vis.set_active(index_visible)
|
||||
|
||||
prefsTop.get_widget("iprefix").set_text(iprefix)
|
||||
prefsTop.get_widget("oprefix").set_text(oprefix)
|
||||
prefsTop.get_widget("fprefix").set_text(fprefix)
|
||||
prefsTop.get_widget("sprefix").set_text(sprefix)
|
||||
prefsTop.get_widget("pprefix").set_text(pprefix)
|
||||
|
||||
if status_bar == 0:
|
||||
prefsTop.get_widget("stat1").set_active(1)
|
||||
elif status_bar == 1:
|
||||
prefsTop.get_widget("stat2").set_active(1)
|
||||
else:
|
||||
prefsTop.get_widget("stat3").set_active(1)
|
||||
|
||||
if toolbar == 0:
|
||||
prefsTop.get_widget("tool1").set_active(1)
|
||||
elif toolbar == 1:
|
||||
prefsTop.get_widget("tool2").set_active(1)
|
||||
else:
|
||||
prefsTop.get_widget("tool3").set_active(1)
|
||||
|
||||
display_attr_obj.set_active(display_attr)
|
||||
prefsTop.get_widget("attr_name").set_text(attr_name)
|
||||
|
||||
display_altnames.set_active(hide_altnames)
|
||||
|
||||
paper_obj = prefsTop.get_widget("paper_size")
|
||||
menu = gtk.GtkMenu()
|
||||
choice = 0
|
||||
for index in range(0,len(PaperMenu.paper_sizes)):
|
||||
name = PaperMenu.paper_sizes[index].get_name()
|
||||
if name == paper_preference:
|
||||
choice = index
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data(OBJECT,pbox)
|
||||
item.set_data(DATA,name)
|
||||
item.connect("activate", on_format_toggled)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
menu.set_active(choice)
|
||||
paper_obj.set_menu(menu)
|
||||
|
||||
lastnamegen_obj = prefsTop.get_widget("lastnamegen")
|
||||
menu = gtk.GtkMenu()
|
||||
choice = 0
|
||||
for index in range(0,len(_surname_styles)):
|
||||
name = _surname_styles[index]
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data(OBJECT,pbox)
|
||||
item.set_data(DATA,index)
|
||||
item.connect("activate", on_format_toggled)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
menu.set_active(lastnamegen)
|
||||
lastnamegen_obj.set_menu(menu)
|
||||
|
||||
output_obj = prefsTop.get_widget("output_format")
|
||||
menu = gtk.GtkMenu()
|
||||
choice = 0
|
||||
|
||||
choice = 0
|
||||
index = 0
|
||||
for name in const.output_formats:
|
||||
if name == output_preference:
|
||||
choice = index
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data(OBJECT,pbox)
|
||||
item.set_data(DATA,name)
|
||||
item.connect("activate", on_format_toggled)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
index = index + 1
|
||||
menu.set_active(choice)
|
||||
output_obj.set_menu(menu)
|
||||
|
||||
date_option = prefsTop.get_widget("date_format")
|
||||
date_menu = gtk.GtkMenu()
|
||||
for index in range(0,len(_date_format_list)):
|
||||
item = gtk.GtkMenuItem(_date_format_list[index])
|
||||
item.set_data(INDEX,index)
|
||||
item.set_data(OBJECT,pbox)
|
||||
item.connect("activate", on_format_toggled)
|
||||
item.show()
|
||||
date_menu.append(item)
|
||||
date_menu.set_active(get_format_code())
|
||||
date_option.set_menu(date_menu)
|
||||
|
||||
date_entry = prefsTop.get_widget("date_entry_format")
|
||||
date_menu = gtk.GtkMenu()
|
||||
for index in range(0,len(_date_entry_list)):
|
||||
item = gtk.GtkMenuItem(_date_entry_list[index])
|
||||
item.set_data(INDEX,index)
|
||||
item.set_data(OBJECT,pbox)
|
||||
item.connect("activate", on_format_toggled)
|
||||
item.show()
|
||||
date_menu.append(item)
|
||||
date_menu.set_active(Date.entryCode)
|
||||
date_entry.set_menu(date_menu)
|
||||
|
||||
name_option = prefsTop.get_widget("name_format")
|
||||
name_menu = gtk.GtkMenu()
|
||||
for index in range(0,len(_name_format_list)):
|
||||
name_tuple = _name_format_list[index]
|
||||
item = gtk.GtkMenuItem(name_tuple[0])
|
||||
item.set_data(INDEX,index)
|
||||
item.set_data(OBJECT,pbox)
|
||||
item.connect("activate", on_format_toggled)
|
||||
item.show()
|
||||
name_menu.append(item)
|
||||
name_menu.set_active(_name_format)
|
||||
name_option.set_menu(name_menu)
|
||||
|
||||
prefsTop.get_widget("resname").set_text(owner.getName())
|
||||
prefsTop.get_widget("resaddr").set_text(owner.getAddress())
|
||||
prefsTop.get_widget("rescity").set_text(owner.getCity())
|
||||
prefsTop.get_widget("resstate").set_text(owner.getState())
|
||||
prefsTop.get_widget("rescountry").set_text(owner.getCountry())
|
||||
prefsTop.get_widget("respostal").set_text(owner.getPostalCode())
|
||||
prefsTop.get_widget("resphone").set_text(owner.getPhone())
|
||||
prefsTop.get_widget("resemail").set_text(owner.getEmail())
|
||||
|
||||
cwidget = prefsTop.get_widget(ODDFGCOLOR)
|
||||
cwidget.set_i16(ListColors.oddfg[0],ListColors.oddfg[1],\
|
||||
ListColors.oddfg[2],0xffff)
|
||||
|
||||
cwidget = prefsTop.get_widget(ODDBGCOLOR)
|
||||
cwidget.set_i16(ListColors.oddbg[0],ListColors.oddbg[1],\
|
||||
ListColors.oddbg[2],0xffff)
|
||||
|
||||
cwidget = prefsTop.get_widget(EVENFGCOLOR)
|
||||
cwidget.set_i16(ListColors.evenfg[0],ListColors.evenfg[1],\
|
||||
ListColors.evenfg[2],0xffff)
|
||||
|
||||
cwidget = prefsTop.get_widget(EVENBGCOLOR)
|
||||
cwidget.set_i16(ListColors.evenbg[0],ListColors.evenbg[1],\
|
||||
ListColors.evenbg[2],0xffff)
|
||||
|
||||
cwidget = prefsTop.get_widget(ANCESTORFGCOLOR)
|
||||
cwidget.set_i16(ListColors.ancestorfg[0],ListColors.ancestorfg[1],\
|
||||
ListColors.ancestorfg[2],0xffff)
|
||||
|
||||
prefsTop.get_widget("enableColors").set_active(ListColors.get_enable())
|
||||
prefsTop.get_widget(ODDFGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
prefsTop.get_widget(ODDBGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
prefsTop.get_widget(EVENBGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
prefsTop.get_widget(EVENFGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
prefsTop.get_widget(ANCESTORFGCOLOR).set_sensitive(ListColors.get_enable())
|
||||
|
||||
prefsTop.get_widget("dbdir").gtk_entry().set_text(db_dir)
|
||||
prefsTop.get_widget("repdir").gtk_entry().set_text(report_dir)
|
||||
prefsTop.get_widget("htmldir").gtk_entry().set_text(web_dir)
|
||||
|
||||
pbox.set_modified(0)
|
||||
pbox.show()
|
||||
GrampsPreferences(db)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -73,6 +73,7 @@ bookFile = "%s/bookmarks.glade" % rootDir
|
||||
pluginsFile = "%s/plugins.glade" % rootDir
|
||||
editnoteFile = "%s/editnote.glade" % rootDir
|
||||
configFile = "%s/config.glade" % rootDir
|
||||
prefsFile = "%s/preferences.glade" % rootDir
|
||||
stylesFile = "%s/styles.glade" % rootDir
|
||||
dialogFile = "%s/dialog.glade" % rootDir
|
||||
revisionFile = "%s/revision.glade" % rootDir
|
||||
|
3066
gramps/src/preferences.glade
Normal file
3066
gramps/src/preferences.glade
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user