Mult surname interface changes:

* buttons on line of label
 * configurable height surname table


svn: r16435
This commit is contained in:
Benny Malengier 2011-01-22 15:07:29 +00:00
parent ef9254e0f9
commit a877138bcb
9 changed files with 96 additions and 83 deletions

View File

@ -250,6 +250,7 @@ register('interface.url-height', 150)
register('interface.url-width', 600)
register('interface.view', True)
register('interface.width', 775)
register('interface.surname-box-height', 150)
register('paths.recent-export-dir', '')
register('paths.recent-file', '')

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 -->
@ -30,6 +30,7 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">8</property>
<property name="position">0</property>
</packing>
@ -40,6 +41,7 @@
<property name="tooltip_text" translatable="yes">An identification of what type of Name this is, eg. Birth Name, Married Name.</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
@ -70,6 +72,8 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">6</property>
</packing>
@ -164,7 +168,7 @@
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="tooltip_text" translatable="yes">The person's given names</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
@ -194,7 +198,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Part of the Given name that is the normally used name.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">5</property>
@ -206,7 +210,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
@ -220,7 +224,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">An optional suffix to the name, such as "Jr." or "III"</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">3</property>
@ -234,7 +238,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A descriptive name given in place of or in addition to the official given name.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">5</property>
@ -311,7 +315,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A non official name given to a family to distinguish them of people with the same family name. Often referred to as eg. Farm name.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<property name="width_chars">25</property>
</object>
<packing>
@ -509,7 +513,7 @@ Here you can make sure this person is sorted according to a custom name format (
<property name="tooltip_text" translatable="yes">The Person Tree view groups people under the primary surname. You can override this by setting here a group value.
You will be asked if you want to group this person only, or all people with this specific primary surname.</property>
<property name="editable">False</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="position">0</property>
@ -543,7 +547,7 @@ You will be asked if you want to group this person only, or all people with this
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A Date associated with this name. Eg. for a Married Name, date the name is first used or marriage date.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">2</property>

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-requires grampswidgets 0.0 -->
@ -21,7 +21,7 @@
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">9</property>
<property name="n_rows">8</property>
<property name="n_columns">9</property>
<child>
<object class="GtkLabel" id="label21">
@ -51,7 +51,7 @@
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="tooltip_text" translatable="yes">The person's given names</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<signal name="focus_out_event" handler="on_given_focus_out"/>
</object>
<packing>
@ -89,7 +89,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Part of the Given name that is the normally used name.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">7</property>
@ -126,7 +126,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A title used to refer to the person, such as 'Dr.' or 'Rev.'</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">2</property>
@ -145,7 +145,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">An optional suffix to the name, such as "Jr." or "III"</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">7</property>
@ -180,7 +180,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A descriptive name given in place of or in addition to the official given name.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">4</property>
@ -262,7 +262,6 @@
</child>
<child>
<object class="GtkHBox" id="hboxmultsurnames">
<property name="height_request">150</property>
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Click on a table cell to edit.</property>
<child>
@ -274,10 +273,10 @@
</object>
<packing>
<property name="right_attach">9</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="x_padding">6</property>
<property name="x_padding">3</property>
<property name="y_padding">3</property>
</packing>
</child>
@ -287,7 +286,7 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Use Multiple Surnames
Indicate that the surname consists of different parts. Every surname has its own prefix and a possible connector to the next surname. Eg., the surname Ram&#xF3;n y Cajal can be stored as Ram&#xF3;n, which is inherited from the father, the connector y, and Cajal, which is inherited from the mother.</property>
Indicate that the surname consists of different parts. Every surname has its own prefix and a possible connector to the next surname. Eg., the surname Ramón y Cajal can be stored as Ramón, which is inherited from the father, the connector y, and Cajal, which is inherited from the mother.</property>
<property name="image">image2</property>
<property name="use_underline">True</property>
</object>
@ -300,23 +299,6 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="surnlabel">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">&lt;b&gt;Multiple Surnames&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_SHRINK</property>
<property name="y_padding">3</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
@ -352,8 +334,8 @@ Indicate that the surname consists of different parts. Every surname has its own
</object>
<packing>
<property name="right_attach">9</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">3</property>
@ -408,7 +390,7 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">An optional prefix for the family that is not used in sorting, such as "de" or "van".</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="expand">False</property>
@ -421,7 +403,7 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Part of a person's name indicating the family to which the person belongs</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="position">2</property>
@ -562,7 +544,7 @@ Indicate that the surname consists of different parts. Every surname has its own
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">A unique ID for the person.</property>
<property name="invisible_char">&#x25CF;</property>
<property name="invisible_char"></property>
<property name="width_chars">6</property>
</object>
<packing>
@ -607,8 +589,8 @@ Indicate that the surname consists of different parts. Every surname has its own
</object>
<packing>
<property name="right_attach">9</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="y_options"></property>
</packing>
</child>
@ -624,24 +606,6 @@ Indicate that the surname consists of different parts. Every surname has its own
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="padding">2</property>

View File

@ -317,7 +317,7 @@ class ConfigureDialog(ManagedWindow.ManagedWindow):
table.attach(entry, 1, 2, index, index+1, yoptions=0)
def add_pos_int_entry(self, table, label, index, constant, callback=None,
config=None):
config=None, col_attach=1):
""" entry field for positive integers
"""
if not config:
@ -327,9 +327,10 @@ class ConfigureDialog(ManagedWindow.ManagedWindow):
entry.set_text(str(config.get(constant)))
if callback:
entry.connect('changed', callback, constant)
table.attach(lwidget, 1, 2, index, index+1, yoptions=0,
xoptions=gtk.FILL)
table.attach(entry, 2, 3, index, index+1, yoptions=0)
table.attach(lwidget, col_attach, col_attach+1, index, index+1,
yoptions=0, xoptions=gtk.FILL)
table.attach(entry, col_attach+1, col_attach+2, index, index+1,
yoptions=0)
def add_color(self, table, label, index, constant, config=None):
if not config:
@ -404,7 +405,7 @@ class GrampsPreferences(ConfigureDialog):
def __init__(self, uistate, dbstate):
page_funcs = (
self.add_behavior_panel,
self.add_database_panel,
self.add_famtree_panel,
self.add_formats_panel,
self.add_text_panel,
self.add_prefix_panel,
@ -604,7 +605,7 @@ class GrampsPreferences(ConfigureDialog):
def __change_name(self, text, path, new_text):
"""
If the new string is empty, do nothing. Otherwise, renaming the
database is simply changing the contents of the name file.
family tree is simply changing the contents of the name file.
"""
if len(new_text) > 0 and text != new_text:
# build a pattern from translated pattern:
@ -865,6 +866,13 @@ class GrampsPreferences(ConfigureDialog):
table.attach(lwidget, 0, 1, row, row+1, yoptions=0)
table.attach(obox, 1, 3, row, row+1, yoptions=0)
row += 1
#height multiple surname table
self.add_pos_int_entry(table,
_('Height multiple surname box (pixels)'),
row, 'interface.surname-box-height', self.update_surn_height,
col_attach=0)
row += 1
# Status bar:
obox = gtk.combo_box_new_text()
@ -1054,20 +1062,20 @@ class GrampsPreferences(ConfigureDialog):
return _('General'), table
def add_database_panel(self, configdialog):
def add_famtree_panel(self, configdialog):
table = gtk.Table(2, 2)
table.set_border_width(12)
table.set_col_spacings(6)
table.set_row_spacings(6)
self.add_entry(table,
_('Database path'),
_('Family Tree Database path'),
0, 'behavior.database-path')
self.add_checkbox(table,
_('Automatically load last database'),
_('Automatically load last family tree'),
1, 'behavior.autoload')
return _('Database'), table
return _('Family Tree'), table
def set_mediapath(self, *obj):
if self.path_entry.get_text().strip():
@ -1126,6 +1134,23 @@ class GrampsPreferences(ConfigureDialog):
else:
obj.set_text(str(intval))
def update_surn_height(self, obj, constant):
ok = True
if not obj.get_text():
return
try:
intval = int(obj.get_text())
except:
intval = config.get(constant)
ok = False
if intval < 0 :
intval = config.get(constant)
ok = False
if ok:
config.set(constant, intval)
else:
obj.set_text(str(intval))
def build_menu_names(self, obj):
return (_('Preferences'), None)

View File

@ -75,7 +75,7 @@ class ButtonTab(GrampsTab):
}
def __init__(self, dbstate, uistate, track, name, share_button=False,
move_buttons=False, jump_button=False):
move_buttons=False, jump_button=False, top_label=None):
"""
Similar to the base class, except after Build.
@ -96,19 +96,30 @@ class ButtonTab(GrampsTab):
@type name: bool
@param move_buttons: Add up and down button to the Notebook tab or not
@type name: bool
@param jump_button: Add a goto button
@type name: bool
@param top_label: Add a label in front of the buttons if given
@type top_label: string or None for no label
"""
self.dirty_selection = False
GrampsTab.__init__(self,dbstate, uistate, track, name)
self.create_buttons(share_button, move_buttons, jump_button)
self.__create_buttons(share_button, move_buttons, jump_button, top_label)
def create_buttons(self, share_button, move_buttons, jump_button):
def __create_buttons(self, share_button, move_buttons, jump_button,
top_label):
"""
Create a button box consisting of three buttons, one for Add,
one for Edit, and one for Delete.
Add buttons for Share, Move and Jump depending on parameters. This
button box is then appended hbox (self).
Prepend a label if top_label given
"""
if top_label:
self.top_label = gtk.Label(top_label)
self.top_label.set_use_markup(True)
self.track_ref_for_deletion("top_label")
self.add_btn = SimpleButton(gtk.STOCK_ADD, self.add_button_clicked)
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
self.del_btn = SimpleButton(gtk.STOCK_REMOVE, self.del_button_clicked)
@ -148,6 +159,8 @@ class ButtonTab(GrampsTab):
hbox = gtk.HBox()
hbox.set_spacing(6)
if top_label:
hbox.pack_start(self.top_label, False)
hbox.pack_start(self.add_btn, False)
if share_button:
hbox.pack_start(self.share_btn, False)

View File

@ -61,12 +61,13 @@ class EmbeddedList(ButtonTab):
_DND_EXTRA = None
def __init__(self, dbstate, uistate, track, name, build_model,
share_button=False, move_buttons=False, jump_button=False):
share_button=False, move_buttons=False, jump_button=False,
top_label=None):
"""
Create a new list, using the passed build_model to populate the list.
"""
ButtonTab.__init__(self, dbstate, uistate, track, name, share_button,
move_buttons, jump_button)
move_buttons, jump_button, top_label)
self.changed = False
self.model = None

View File

@ -79,7 +79,8 @@ class SurnameTab(EmbeddedList):
_column_combo = (_('Origin'), -1, 150, 3) # name, sort, width, modelcol
_column_toggle = (_('Primary'), -1, 80, 4)
def __init__(self, dbstate, uistate, track, name, on_change=None):
def __init__(self, dbstate, uistate, track, name, on_change=None,
top_label=_('<b>Multiple Surnames</b>')):
self.obj = name
self.on_change = on_change
self.curr_col = -1
@ -87,7 +88,8 @@ class SurnameTab(EmbeddedList):
self.curr_celle = None
EmbeddedList.__init__(self, dbstate, uistate, track, _('Family Surnames'),
SurnameModel, move_buttons=True)
SurnameModel, move_buttons=True,
top_label=top_label)
def build_columns(self):
#first the standard text columns with normal method

View File

@ -44,6 +44,7 @@ import gtk
# gramps modules
#
#-------------------------------------------------------------------------
import config
from gen.display.name import displayer as name_displayer
from editsecondary import EditSecondary
from gen.lib import NoteType
@ -119,8 +120,10 @@ class EditName(EditSecondary):
tblgnam = self.top.get_object('table23')
notebook = self.top.get_object('notebook')
hbox_surn = self.top.get_object('hboxmultsurnames')
hbox_surn.set_size_request(-1,
int(config.get('interface.surname-box-height')))
hbox_surn.pack_start(SurnameTab(self.dbstate, self.uistate, self.track,
self.obj))
self.obj, top_label=None))
#recreate start page as GrampsTab
notebook.remove_page(0)
self.gennam = GeneralNameTab(self.dbstate, self.uistate, self.track,

View File

@ -95,7 +95,6 @@ class SingSurn(object):
self.top.get_object('originlabel').hide()
self.top.get_object('cmborigin').hide()
self.top.get_object('multsurnamebtn').hide()
self.top.get_object('surnlabel').show()
def show_all(self):
#self.top.get_object('prefixlabel').show()
@ -106,7 +105,6 @@ class SingSurn(object):
self.top.get_object('originlabel').show()
self.top.get_object('cmborigin').show()
self.top.get_object('multsurnamebtn').show()
self.top.get_object('surnlabel').hide()
class EditPerson(EditPrimary):
"""
@ -190,6 +188,8 @@ class EditPerson(EditPrimary):
self.eventbox = self.top.get_object("eventbox1")
self.singsurnfr = SingSurn(self.top)
self.multsurnfr = self.top.get_object("hboxmultsurnames")
self.multsurnfr.set_size_request(-1,
int(config.get('interface.surname-box-height')))
self.singlesurn_active = True
self.surntab = SurnameTab(self.dbstate, self.uistate, self.track,
self.obj.get_primary_name(),