* src/Config/_GrampsConfigKeys.py: Re-generate file.
* src/GrampsCfg.py: More name display prefs. svn: r6896
This commit is contained in:
parent
0e141aacd4
commit
55884a56d3
@ -1,4 +1,6 @@
|
||||
2006-06-15 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Config/_GrampsConfigKeys.py: Re-generate file.
|
||||
* src/GrampsCfg.py: More name display prefs.
|
||||
* src/GrampsLogger/_ErrorReportAssistant.py (__init__): Adapt to
|
||||
the Assistant change.
|
||||
* src/Assistant.py: Convert to working both with and without
|
||||
|
@ -404,13 +404,19 @@
|
||||
<key>/schemas/apps/gramps/preferences/name-format</key>
|
||||
<applyto>/apps/gramps/preferences/name-format</applyto>
|
||||
<owner>gramps</owner>
|
||||
<type>int</type>
|
||||
<type>string</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Name display format</short>
|
||||
<long>This key determines the name display format. Use 0
|
||||
for "Firstname Surname", 1 for "Surname, Firstname",
|
||||
2 for "Firstname SURNAME", and 3 for "SURNAME, Firstname" style. </long>
|
||||
<long>This key determines the name display format.
|
||||
Use "0" for "Surname, Firstname",
|
||||
"1" for "Firstname Surname",
|
||||
"2" for "Patronymic Firstname",
|
||||
and "3" for "Firstname" style.
|
||||
For custom styles, use a string where every character denotes
|
||||
the name component as follows: "f" for firstname, "s" for surname,
|
||||
"t" for title, "p" for prefix", "u" for suffix", "a" for patronymic,
|
||||
"c" for callname". </long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
|
@ -30,7 +30,7 @@ PAPER_PREFERENCE = ('preferences','paper-preference', 2)
|
||||
RECENT_FILE = ('paths','recent-file', 2)
|
||||
RECENT_IMPORT_DIR = ('paths','recent-import-dir', 2)
|
||||
RECENT_EXPORT_DIR = ('paths','recent-export-dir', 2)
|
||||
NAME_FORMAT = ('preferences','name-format', 1)
|
||||
NAME_FORMAT = ('preferences','name-format', 2)
|
||||
REPORT_DIRECTORY = ('paths','report-directory', 2)
|
||||
RESEARCHER_ADDR = ('researcher','researcher-addr', 2)
|
||||
RESEARCHER_CITY = ('researcher','researcher-city', 2)
|
||||
@ -86,7 +86,7 @@ default_value = {
|
||||
RECENT_FILE : '',
|
||||
RECENT_IMPORT_DIR : '',
|
||||
RECENT_EXPORT_DIR : '',
|
||||
NAME_FORMAT : 0,
|
||||
NAME_FORMAT : '0',
|
||||
REPORT_DIRECTORY : './',
|
||||
RESEARCHER_ADDR : '',
|
||||
RESEARCHER_CITY : '',
|
||||
|
@ -33,7 +33,6 @@ from gettext import gettext as _
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gtk.glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -43,6 +42,7 @@ import gtk.glade
|
||||
import Config
|
||||
import DateHandler
|
||||
import NameDisplay
|
||||
from RelLib import Name
|
||||
import ManagedWindow
|
||||
from GrampsWidgets import *
|
||||
|
||||
@ -209,24 +209,81 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
||||
table.set_col_spacings(6)
|
||||
table.set_row_spacings(6)
|
||||
|
||||
self.name_exp = gtk.expander_new_with_mnemonic(
|
||||
_('C_ustom format details'))
|
||||
self.name_exp.set_sensitive(False)
|
||||
|
||||
obox = gtk.combo_box_new_text()
|
||||
for key,value in NameDisplay.formats.items():
|
||||
obox.append_text(value)
|
||||
|
||||
active = Config.get(Config.NAME_FORMAT)
|
||||
if active >= len(NameDisplay.formats):
|
||||
active = 0
|
||||
obox.set_active(active)
|
||||
obox.connect('changed',
|
||||
lambda obj: Config.set(Config.NAME_FORMAT,
|
||||
obj.get_active()))
|
||||
try:
|
||||
active = int(Config.get(Config.NAME_FORMAT))
|
||||
if active >= len(NameDisplay.formats):
|
||||
active = 0
|
||||
except ValueError: # not an integer-convertible string => custom
|
||||
active = len(NameDisplay.formats)
|
||||
self.name_exp.set_sensitive(True)
|
||||
|
||||
obox.set_active(active)
|
||||
obox.connect('changed', self.name_changed)
|
||||
lwidget = BasicLabel("%s: " % _('Preset format'))
|
||||
|
||||
custom_ui = self.build_custom_name_ui()
|
||||
self.name_exp.add(custom_ui)
|
||||
|
||||
table.attach(lwidget, 0, 1, 0, 1, yoptions=0)
|
||||
table.attach(obox, 1,3,0, 1, yoptions=0)
|
||||
table.attach(self.name_exp, 0,3,1, 2, yoptions=0)
|
||||
return table
|
||||
|
||||
def build_custom_name_ui(self):
|
||||
table = gtk.Table(2,3)
|
||||
table.set_border_width(6)
|
||||
table.set_col_spacings(6)
|
||||
table.set_row_spacings(6)
|
||||
|
||||
avail_sw = gtk.ScrolledWindow()
|
||||
avail_sw.set_policy(gtk.POLICY_NEVER,gtk.POLICY_NEVER)
|
||||
avail_tree = gtk.TreeView()
|
||||
avail_sw.add(avail_tree)
|
||||
|
||||
use_sw = gtk.ScrolledWindow()
|
||||
use_sw.set_policy(gtk.POLICY_NEVER,gtk.POLICY_NEVER)
|
||||
use_tree = gtk.TreeView()
|
||||
use_sw.add(use_tree)
|
||||
|
||||
button_table = gtk.Table(3,3)
|
||||
|
||||
up_button = _set_button(gtk.STOCK_GO_UP)
|
||||
down_button = _set_button(gtk.STOCK_GO_DOWN)
|
||||
add_button = _set_button(gtk.STOCK_ADD)
|
||||
remove_button = _set_button(gtk.STOCK_REMOVE)
|
||||
button_table.attach(up_button, 1, 2, 0, 1, xoptions = 0, yoptions=0)
|
||||
button_table.attach(remove_button, 2, 3, 1, 2, xoptions = 0,yoptions=0)
|
||||
button_table.attach(down_button, 1, 2, 2, 3, xoptions = 0, yoptions=0)
|
||||
button_table.attach(add_button, 0, 1, 1, 2, xoptions = 0,yoptions=0)
|
||||
|
||||
example_label = gtk.Label('<b>%s</b>' % _('Example'))
|
||||
example_label.set_use_markup(True)
|
||||
|
||||
table.attach(example_label,0,3,0,1,xoptions = 0,yoptions=0)
|
||||
table.attach(avail_sw, 0,1,1,2, yoptions=gtk.FILL)
|
||||
table.attach(button_table, 1, 2, 1, 2, xoptions = 0, yoptions=0)
|
||||
table.attach(use_sw, 2,3,1,2, yoptions=gtk.FILL)
|
||||
|
||||
return table
|
||||
|
||||
def name_changed(self,obj):
|
||||
custom_text = NameDisplay.formats[Name.CUSTOM]
|
||||
if obj.get_active_text() == custom_text:
|
||||
self.name_exp.set_sensitive(True)
|
||||
self.name_exp.set_expanded(True)
|
||||
else:
|
||||
Config.set(Config.NAME_FORMAT,str(obj.get_active()))
|
||||
self.name_exp.set_expanded(False)
|
||||
self.name_exp.set_sensitive(False)
|
||||
|
||||
def add_formats_panel(self):
|
||||
table = gtk.Table(3,8)
|
||||
table.set_border_width(12)
|
||||
@ -345,3 +402,12 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (_('Preferences'),None)
|
||||
|
||||
def _set_button(stock):
|
||||
button = gtk.Button()
|
||||
image = gtk.Image()
|
||||
image.set_from_stock(stock, gtk.ICON_SIZE_BUTTON)
|
||||
image.show()
|
||||
button.add(image)
|
||||
button.show()
|
||||
return button
|
||||
|
Loading…
Reference in New Issue
Block a user