From a877138bcb39d89baa3ecf0a5f8d28064796dd09 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sat, 22 Jan 2011 15:07:29 +0000 Subject: [PATCH] Mult surname interface changes: * buttons on line of label * configurable height surname table svn: r16435 --- src/config.py | 1 + src/glade/editname.glade | 22 ++++--- src/glade/editperson.glade | 72 ++++++--------------- src/gui/configure.py | 45 ++++++++++--- src/gui/editors/displaytabs/buttontab.py | 19 +++++- src/gui/editors/displaytabs/embeddedlist.py | 5 +- src/gui/editors/displaytabs/surnametab.py | 6 +- src/gui/editors/editname.py | 5 +- src/gui/editors/editperson.py | 4 +- 9 files changed, 96 insertions(+), 83 deletions(-) diff --git a/src/config.py b/src/config.py index e11c39274..3ae28a229 100644 --- a/src/config.py +++ b/src/config.py @@ -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', '') diff --git a/src/glade/editname.glade b/src/glade/editname.glade index 44473d32b..0b9f715a2 100644 --- a/src/glade/editname.glade +++ b/src/glade/editname.glade @@ -1,4 +1,4 @@ - + @@ -30,6 +30,7 @@ False + False 8 0 @@ -40,6 +41,7 @@ An identification of what type of Name this is, eg. Birth Name, Married Name. + False 1 @@ -70,6 +72,8 @@ + False + False end 6 @@ -164,7 +168,7 @@ True True The person's given names - + 1 @@ -194,7 +198,7 @@ True True Part of the Given name that is the normally used name. - + 5 @@ -206,7 +210,7 @@ True True A title used to refer to the person, such as 'Dr.' or 'Rev.' - + 1 @@ -220,7 +224,7 @@ True True An optional suffix to the name, such as "Jr." or "III" - + 3 @@ -234,7 +238,7 @@ True True A descriptive name given in place of or in addition to the official given name. - + 5 @@ -311,7 +315,7 @@ True True 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. - + 25 @@ -509,7 +513,7 @@ Here you can make sure this person is sorted according to a custom name format ( 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. False - + 0 @@ -543,7 +547,7 @@ You will be asked if you want to group this person only, or all people with this True True A Date associated with this name. Eg. for a Married Name, date the name is first used or marriage date. - + 2 diff --git a/src/glade/editperson.glade b/src/glade/editperson.glade index 742c03a8e..70650b4d4 100644 --- a/src/glade/editperson.glade +++ b/src/glade/editperson.glade @@ -1,4 +1,4 @@ - + @@ -21,7 +21,7 @@ True - 9 + 8 9 @@ -51,7 +51,7 @@ True True The person's given names - + @@ -89,7 +89,7 @@ True True Part of the Given name that is the normally used name. - + 7 @@ -126,7 +126,7 @@ True True A title used to refer to the person, such as 'Dr.' or 'Rev.' - + 2 @@ -145,7 +145,7 @@ True True An optional suffix to the name, such as "Jr." or "III" - + 7 @@ -180,7 +180,7 @@ True True A descriptive name given in place of or in addition to the official given name. - + 4 @@ -262,7 +262,6 @@ - 150 True Click on a table cell to edit. @@ -274,10 +273,10 @@ 9 - 6 - 7 + 5 + 6 GTK_FILL - 6 + 3 3 @@ -287,7 +286,7 @@ True True 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ó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. +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. image2 True @@ -300,23 +299,6 @@ Indicate that the surname consists of different parts. Every surname has its own - - - True - 0 - 3 - <b>Multiple Surnames</b> - True - - - 3 - 5 - 6 - GTK_FILL - GTK_SHRINK - 3 - - True @@ -352,8 +334,8 @@ Indicate that the surname consists of different parts. Every surname has its own 9 - 7 - 8 + 6 + 7 GTK_FILL 3 @@ -408,7 +390,7 @@ Indicate that the surname consists of different parts. Every surname has its own True True An optional prefix for the family that is not used in sorting, such as "de" or "van". - + False @@ -421,7 +403,7 @@ Indicate that the surname consists of different parts. Every surname has its own True True Part of a person's name indicating the family to which the person belongs - + 2 @@ -562,7 +544,7 @@ Indicate that the surname consists of different parts. Every surname has its own True True A unique ID for the person. - + 6 @@ -607,8 +589,8 @@ Indicate that the surname consists of different parts. Every surname has its own 9 - 8 - 9 + 7 + 8 @@ -624,24 +606,6 @@ Indicate that the surname consists of different parts. Every surname has its own - - - - - - - - - - - - - - - - - - 2 diff --git a/src/gui/configure.py b/src/gui/configure.py index e3ce85ce0..c45494d18 100644 --- a/src/gui/configure.py +++ b/src/gui/configure.py @@ -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) diff --git a/src/gui/editors/displaytabs/buttontab.py b/src/gui/editors/displaytabs/buttontab.py index 50d6354f5..aca44327f 100644 --- a/src/gui/editors/displaytabs/buttontab.py +++ b/src/gui/editors/displaytabs/buttontab.py @@ -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) diff --git a/src/gui/editors/displaytabs/embeddedlist.py b/src/gui/editors/displaytabs/embeddedlist.py index 8929787e1..1451ae5d6 100644 --- a/src/gui/editors/displaytabs/embeddedlist.py +++ b/src/gui/editors/displaytabs/embeddedlist.py @@ -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 diff --git a/src/gui/editors/displaytabs/surnametab.py b/src/gui/editors/displaytabs/surnametab.py index beb10ac58..5f197f95a 100644 --- a/src/gui/editors/displaytabs/surnametab.py +++ b/src/gui/editors/displaytabs/surnametab.py @@ -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=_('Multiple Surnames')): 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 diff --git a/src/gui/editors/editname.py b/src/gui/editors/editname.py index cdda818b8..112b11e15 100644 --- a/src/gui/editors/editname.py +++ b/src/gui/editors/editname.py @@ -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, diff --git a/src/gui/editors/editperson.py b/src/gui/editors/editperson.py index 6d02dec14..4133f2d96 100644 --- a/src/gui/editors/editperson.py +++ b/src/gui/editors/editperson.py @@ -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(),