continue adding to the editname GUI
svn: r15999
This commit is contained in:
parent
b3d8e3c857
commit
90379b7b42
@ -273,6 +273,8 @@ src/gui/editors/displaytabs/reporefmodel.py
|
||||
src/gui/editors/displaytabs/sourcebackreflist.py
|
||||
src/gui/editors/displaytabs/sourceembedlist.py
|
||||
src/gui/editors/displaytabs/sourcerefmodel.py
|
||||
src/gui/editors/displaytabs/surnametab.py
|
||||
src/gui/editors/displaytabs/surnamemodel.py
|
||||
src/gui/editors/displaytabs/webembedlist.py
|
||||
src/gui/editors/displaytabs/webmodel.py
|
||||
src/gui/editors/displaytabs/__init__.py
|
||||
|
@ -133,6 +133,7 @@ class _DdTargets(object):
|
||||
self.SOURCEREF = _DdType(self, 'srcref')
|
||||
self.SOURCE_LINK = _DdType(self, 'source-link')
|
||||
self.URL = _DdType(self, 'url')
|
||||
self.SURNAME = _DdType(self, 'surname')
|
||||
|
||||
# List of all types that are used between
|
||||
# gramps widgets but should not be exported
|
||||
@ -159,6 +160,7 @@ class _DdTargets(object):
|
||||
self.SOURCEREF,
|
||||
self.SOURCE_LINK,
|
||||
self.URL,
|
||||
self.SURNAME
|
||||
]
|
||||
|
||||
self.CHILD = _DdType(self, 'child')
|
||||
|
@ -507,6 +507,19 @@ class ScratchName(ScratchObjWrapper):
|
||||
self._title = str(self._obj.get_type())
|
||||
self._value = self._obj.get_name()
|
||||
|
||||
class ScratchSurname(ScratchObjWrapper):
|
||||
|
||||
DROP_TARGETS = [DdTargets.SURNAME]
|
||||
DRAG_TARGET = DdTargets.SURNAME
|
||||
ICON = ICONS['name']
|
||||
|
||||
def __init__(self, dbstate, obj):
|
||||
super(ScratchSurname, self).__init__(dbstate, obj)
|
||||
self._type = _("Surname")
|
||||
if self._obj:
|
||||
self._title = self._obj.get_surname()
|
||||
self._value = self._obj.get_surname()
|
||||
|
||||
class ScratchText(ScratchWrapper):
|
||||
|
||||
DROP_TARGETS = DdTargets.all_text()
|
||||
|
@ -12,275 +12,331 @@
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox33">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table65">
|
||||
<object class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="n_rows">4</property>
|
||||
<property name="n_columns">5</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label592">
|
||||
<object class="GtkHBox" id="hbox110">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Given:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">alt_given</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label597">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">P_atronymic:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">patronymic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="patronymic">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label598">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Family:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">alt_surname</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="alt_surname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label596">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Prefix:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">alt_prefix</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label595">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Tit_le:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">alt_title</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="alt_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label593">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Suffi_x:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">alt_suffix</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label594">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="xpad">1</property>
|
||||
<property name="label" translatable="yes">_Type:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">name_type</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="alt_prefix">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxEntry" id="name_type">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="alt_suffix">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="priv">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">none</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2683">
|
||||
<object class="GtkLabel" id="label269">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon_name">gtk-dialog-authentication</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="xpad">4</property>
|
||||
<property name="label" translatable="yes">_Type:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">ntype</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">8</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxEntry" id="ntype">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="priv">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="relief">none</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2683">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon_name">gtk-dialog-authentication</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">3</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="givenframe">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0.029999999329447746</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table2">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">6</property>
|
||||
<property name="column_spacing">7</property>
|
||||
<property name="row_spacing">7</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label21">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Given:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">given_name</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="titlelabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">T_itle:</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Suffi_x:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">suffix</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label444">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">C_all Name:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">call</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="given_name">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Nick Name:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">nickname</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ValidatableMaskedEntry" id="call">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="right_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="title_field">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="suffix">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="nickname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="right_attach">6</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><i>Given Name(s) </i></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">3</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="alt_given">
|
||||
<object class="GtkFrame" id="multsurnamefr">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="label_xalign">0.029999999329447746</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hboxmultsurnames">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Family Nick Name:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">familynickname</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="familynickname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="width_chars">25</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">3</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">3</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><i>Family Names </i></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label654">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Call _Name:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">call</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="call">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">5</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@ -288,6 +344,12 @@
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebook" id="notebook">
|
||||
<property name="visible">True</property>
|
||||
@ -367,7 +429,6 @@
|
||||
<child>
|
||||
<object class="GtkComboBox" id="display_as">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">liststore2</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||
<attributes>
|
||||
@ -405,7 +466,6 @@
|
||||
<child>
|
||||
<object class="GtkComboBox" id="sort_as">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">liststore1</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
@ -555,7 +615,7 @@
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@ -591,7 +651,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup">Accept changes and close window</property>
|
||||
@ -634,16 +693,4 @@
|
||||
<action-widget response="-11">button131</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore2">
|
||||
<columns>
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
</interface>
|
||||
|
@ -134,7 +134,7 @@
|
||||
<object class="GtkLabel" id="label21">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Gi_ven:</property>
|
||||
<property name="label" translatable="yes">_Given:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">given_name</property>
|
||||
@ -148,7 +148,7 @@
|
||||
<object class="GtkLabel" id="titlelabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Title:</property>
|
||||
<property name="label" translatable="yes">T_itle:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">title</property>
|
||||
</object>
|
||||
@ -180,7 +180,7 @@
|
||||
<object class="GtkLabel" id="label444">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Call _Name:</property>
|
||||
<property name="label" translatable="yes">C_all Name:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">call</property>
|
||||
</object>
|
||||
@ -209,7 +209,7 @@
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">N_ick Name:</property>
|
||||
<property name="label" translatable="yes">_Nick Name:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">nickname</property>
|
||||
</object>
|
||||
@ -716,7 +716,7 @@
|
||||
<object class="GtkLabel" id="label436">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Gender:</property>
|
||||
<property name="label" translatable="yes">G_ender:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">gender</property>
|
||||
</object>
|
||||
@ -729,12 +729,6 @@
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
@ -759,6 +753,12 @@
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -42,6 +42,8 @@ pkgdata_PYTHON = \
|
||||
sourcebackreflist.py \
|
||||
sourceembedlist.py \
|
||||
sourcerefmodel.py \
|
||||
surnamemodel.py \
|
||||
surnametab.py \
|
||||
webembedlist.py \
|
||||
webmodel.py \
|
||||
__init__.py
|
||||
|
@ -55,6 +55,7 @@ from personrefembedlist import PersonRefEmbedList
|
||||
from personbackreflist import PersonBackRefList
|
||||
from placebackreflist import PlaceBackRefList
|
||||
from repoembedlist import RepoEmbedList
|
||||
from surnametab import SurnameTab
|
||||
from sourcebackreflist import SourceBackRefList
|
||||
from sourceembedlist import SourceEmbedList
|
||||
from webembedlist import WebEmbedList
|
||||
|
55
src/gui/editors/displaytabs/surnamemodel.py
Normal file
55
src/gui/editors/displaytabs/surnamemodel.py
Normal file
@ -0,0 +1,55 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
# Copyright (C) 2010 Benny Malengier
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gobject
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# SurnamModel
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SurnameModel(gtk.ListStore):
|
||||
|
||||
def __init__(self, surn_list, db):
|
||||
#setup model for the treeview
|
||||
gtk.ListStore.__init__(self, str, str, str, gobject.TYPE_PYOBJECT,
|
||||
bool, object)
|
||||
for surn in surn_list:
|
||||
# fill the liststore
|
||||
self.append(row=[surn.get_prefix(), surn.get_surname(),
|
||||
surn.get_connector(), surn.get_origintype(),
|
||||
surn.get_primary(), surn])
|
||||
self.db = db
|
214
src/gui/editors/displaytabs/surnametab.py
Normal file
214
src/gui/editors/displaytabs/surnametab.py
Normal file
@ -0,0 +1,214 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||
# Copyright (C) 2010 Benny Malengier
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.ggettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
_TAB = gtk.gdk.keyval_from_name("Tab")
|
||||
_ENTER = gtk.gdk.keyval_from_name("Enter")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from surnamemodel import SurnameModel
|
||||
from embeddedlist import EmbeddedList
|
||||
from DdTargets import DdTargets
|
||||
from gen.lib import Surname, NameOriginType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# SurnameTab
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SurnameTab(EmbeddedList):
|
||||
|
||||
_HANDLE_COL = 5
|
||||
_DND_TYPE = DdTargets.SURNAME
|
||||
|
||||
_MSG = {
|
||||
'add' : _('Create and add a new surname'),
|
||||
'del' : _('Remove the selected surname'),
|
||||
'edit' : _('Edit the selected surname'),
|
||||
'up' : _('Move the selected surname upwards'),
|
||||
'down' : _('Move the selected surname downwards'),
|
||||
}
|
||||
|
||||
#index = column in model. Value =
|
||||
# (name, sortcol in model, width, markup/text
|
||||
_column_names = [
|
||||
(_('Prefix'), 0, 150, 0, -1),
|
||||
(_('Surname'), 1, 250, 0, -1),
|
||||
(_('Connector'), 2, 100, 0, -1),
|
||||
]
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name):
|
||||
self.obj = name
|
||||
self.curr_col = -1
|
||||
self.curr_cellr = None
|
||||
|
||||
EmbeddedList.__init__(self, dbstate, uistate, track, _('Family Surnames'),
|
||||
SurnameModel, move_buttons=True)
|
||||
|
||||
def build_columns(self):
|
||||
#first the standard text columns with normal method
|
||||
EmbeddedList.build_columns(self)
|
||||
|
||||
# Need to add attributes to renderers
|
||||
# and connect renderers to the 'edited' signal
|
||||
for colno in range(len(self.columns)):
|
||||
for renderer in self.columns[colno].get_cell_renderers():
|
||||
renderer.set_property('editable', not self.dbstate.db.readonly)
|
||||
renderer.connect('editing_started', self.edit_start, colno)
|
||||
renderer.connect('edited', self.edit_inline, colno)
|
||||
|
||||
# now we add the two special columns
|
||||
# TODO
|
||||
|
||||
def get_data(self):
|
||||
return self.obj.get_surname_list()
|
||||
|
||||
def is_empty(self):
|
||||
return len(self.model)==0
|
||||
|
||||
def _get_surn_from_model(self):
|
||||
"""
|
||||
Return new surname_list for storing in the name based on content of
|
||||
the model
|
||||
"""
|
||||
new_list = []
|
||||
for idx in range(len(self.model)):
|
||||
node = self.model.get_iter(idx)
|
||||
surn = self.model.get_value(node, 5)
|
||||
surn.set_prefix(unicode(self.model.get_value(node, 0)))
|
||||
surn.set_surname(unicode(self.model.get_value(node, 1)))
|
||||
surn.set_connector(unicode(self.model.get_value(node, 2)))
|
||||
surn.set_primary(self.model.get_value(node, 4))
|
||||
new_list += [surn]
|
||||
return new_list
|
||||
|
||||
def update(self):
|
||||
new_map = self._get_surn_from_model()
|
||||
self.obj.set_surname_list(new_map)
|
||||
# update name in title name editor
|
||||
# TODO
|
||||
|
||||
def column_order(self):
|
||||
# order of columns for EmbeddedList. Only the text columns here
|
||||
return ((1, 0), (1, 1), (1, 2))
|
||||
|
||||
def add_button_clicked(self, obj):
|
||||
prim = False
|
||||
if len(self.obj.get_surname_list()) == 0:
|
||||
prim = true
|
||||
node = self.model.append(row=['', '', '', NameOriginType(), prim,
|
||||
Surname()])
|
||||
self.selection.select_iter(node)
|
||||
path = self.model.get_path(node)
|
||||
self.tree.set_cursor_on_cell(path,
|
||||
focus_column=self.columns[0],
|
||||
focus_cell=None,
|
||||
start_editing=True)
|
||||
|
||||
def del_button_clicked(self, obj):
|
||||
(model, node) = self.selection.get_selected()
|
||||
if node:
|
||||
self.model.remove(node)
|
||||
self.update()
|
||||
|
||||
def edit_start(self, cellr, obj, path, colnr):
|
||||
self.curr_col = colnr
|
||||
self.curr_cellr = cellr
|
||||
|
||||
def edit_inline(self, cell, path, new_text, colnr):
|
||||
node = self.model.get_iter(path)
|
||||
self.model.set_value(node, colnr, new_text)
|
||||
self.update()
|
||||
|
||||
def edit_button_clicked(self, obj):
|
||||
(model, node) = self.selection.get_selected()
|
||||
if node:
|
||||
path = self.model.get_path(node)
|
||||
self.tree.set_cursor_on_cell(path,
|
||||
focus_column=self.columns[0],
|
||||
focus_cell=None,
|
||||
start_editing=True)
|
||||
|
||||
def key_pressed(self, obj, event):
|
||||
"""
|
||||
Handles the key being pressed.
|
||||
Here we make sure tab moves to next value in row
|
||||
"""
|
||||
if not EmbeddedList.key_pressed(self, obj, event):
|
||||
if event.type == gtk.gdk.KEY_PRESS and event.keyval in (_TAB,):
|
||||
if event.state not in (gtk.gdk.SHIFT_MASK, gtk.gdk.CONTROL_MASK):
|
||||
self.next_cell()
|
||||
elif event.state in (gtk.gdk.SHIFT_MASK, gtk.gdk.CONTROL_MASK):
|
||||
self.prev_cell()
|
||||
else:
|
||||
return
|
||||
elif event.type == gtk.gdk.KEY_PRESS and event.keyval in (_ENTER,):
|
||||
self.next_cell()
|
||||
else:
|
||||
return
|
||||
return True
|
||||
|
||||
def next_cell(self):
|
||||
"""
|
||||
Move to the next cell to edit it
|
||||
"""
|
||||
print 'captured tab'
|
||||
(model, node) = self.selection.get_selected()
|
||||
if node:
|
||||
path = self.model.get_path(node)
|
||||
if self.curr_col+1 < len(self.columns):
|
||||
self.tree.set_cursor_on_cell(path,
|
||||
focus_column=self.columns[self.curr_col+1],
|
||||
focus_cell=None,
|
||||
start_editing=True)
|
||||
elif self.curr_col+1 == len(self.columns):
|
||||
#go to next line if there is one
|
||||
if path[0]+1 < len(self.obj.get_surname_list()):
|
||||
newpath = (path[0]+1,)
|
||||
self.selection.select_path(newpath)
|
||||
self.tree.set_cursor_on_cell(newpath,
|
||||
focus_column=self.columns[0],
|
||||
focus_cell=None,
|
||||
start_editing=True)
|
||||
else:
|
||||
#stop editing
|
||||
self.curr_cellr.stop_editing(True)
|
||||
|
||||
def prev_cell(self):
|
||||
print 'captured tab prev'
|
@ -28,7 +28,9 @@
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gobject
|
||||
from gen.ggettext import gettext as _
|
||||
from copy import copy
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -45,7 +47,7 @@ import gtk
|
||||
from gen.display.name import displayer as name_displayer
|
||||
from editsecondary import EditSecondary
|
||||
from gen.lib import NoteType
|
||||
from displaytabs import GrampsTab,SourceEmbedList,NoteTab
|
||||
from displaytabs import GrampsTab, SourceEmbedList, NoteTab, SurnameTab
|
||||
from gui.widgets import (MonitoredEntry, MonitoredMenu, MonitoredDate,
|
||||
MonitoredDataType, PrivacyButton)
|
||||
from glade import Glade
|
||||
@ -111,12 +113,13 @@ class EditName(EditSecondary):
|
||||
|
||||
self.top = Glade()
|
||||
|
||||
self.set_window(self.top.toplevel,
|
||||
self.top.get_object("title"),
|
||||
_("Name Editor"))
|
||||
self.set_window(self.top.toplevel, None, _("Name Editor"))
|
||||
|
||||
tblgnam = self.top.get_object('table23')
|
||||
notebook = self.top.get_object('notebook')
|
||||
hbox_surn = self.top.get_object('hboxmultsurnames')
|
||||
hbox_surn.pack_start(SurnameTab(self.dbstate, self.uistate, self.track,
|
||||
self.obj))
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.gennam = GeneralNameTab(self.dbstate, self.uistate, self.track,
|
||||
@ -147,7 +150,19 @@ class EditName(EditSecondary):
|
||||
def _connect_signals(self):
|
||||
self.define_cancel_button(self.top.get_object('button119'))
|
||||
self.define_help_button(self.top.get_object('button131'))
|
||||
self.define_ok_button(self.top.get_object('button118'),self.save)
|
||||
self.define_ok_button(self.top.get_object('button118'), self.save)
|
||||
|
||||
def _validate_call(self, widget, text):
|
||||
""" a callname must be a part of the given name, see if this is the
|
||||
case """
|
||||
validcall = self.given_field.obj.get_text().split()
|
||||
dummy = copy(validcall)
|
||||
for item in dummy:
|
||||
validcall += item.split('-')
|
||||
if text in validcall:
|
||||
return
|
||||
return ValidationError(_("Call name must be the given name that "
|
||||
"is normally used."))
|
||||
|
||||
def _setup_fields(self):
|
||||
self.group_as = MonitoredEntry(
|
||||
@ -180,7 +195,7 @@ class EditName(EditSecondary):
|
||||
self.db.readonly)
|
||||
|
||||
self.given_field = MonitoredEntry(
|
||||
self.top.get_object("alt_given"),
|
||||
self.top.get_object("given_name"),
|
||||
self.obj.set_first_name,
|
||||
self.obj.get_first_name,
|
||||
self.db.readonly)
|
||||
@ -190,39 +205,42 @@ class EditName(EditSecondary):
|
||||
self.obj.set_call_name,
|
||||
self.obj.get_call_name,
|
||||
self.db.readonly)
|
||||
self.call_field.connect("validate", self._validate_call)
|
||||
#force validation now with initial entry
|
||||
self.call_field.obj.validate(force=True)
|
||||
|
||||
self.title_field = MonitoredEntry(
|
||||
self.top.get_object("alt_title"),
|
||||
self.top.get_object("title_field"),
|
||||
self.obj.set_title,
|
||||
self.obj.get_title,
|
||||
self.db.readonly)
|
||||
|
||||
self.suffix_field = MonitoredEntry(
|
||||
self.top.get_object("alt_suffix"),
|
||||
self.top.get_object("suffix"),
|
||||
self.obj.set_suffix,
|
||||
self.obj.get_suffix,
|
||||
self.db.readonly)
|
||||
|
||||
self.patronymic_field = MonitoredEntry(
|
||||
self.top.get_object("patronymic"),
|
||||
self.obj.set_patronymic,
|
||||
self.obj.get_patronymic,
|
||||
self.nick = MonitoredEntry(
|
||||
self.top.get_object("nickname"),
|
||||
self.obj.set_nick_name,
|
||||
self.obj.get_nick_name,
|
||||
self.db.readonly)
|
||||
|
||||
self.surname_field = MonitoredEntry(
|
||||
self.top.get_object("alt_surname"),
|
||||
self.obj.set_surname,
|
||||
self.obj.get_surname,
|
||||
self.db.readonly,
|
||||
autolist=self.db.get_surname_list() if not self.db.readonly else [],
|
||||
changed=self.update_group_as)
|
||||
|
||||
self.prefix_field = MonitoredEntry(
|
||||
self.top.get_object("alt_prefix"),
|
||||
self.obj.set_surname_prefix,
|
||||
self.obj.get_surname_prefix,
|
||||
self.famnick = MonitoredEntry(
|
||||
self.top.get_object("familynickname"),
|
||||
self.obj.set_family_nick_name,
|
||||
self.obj.get_family_nick_name,
|
||||
self.db.readonly)
|
||||
|
||||
#self.surname_field = MonitoredEntry(
|
||||
# self.top.get_object("alt_surname"),
|
||||
# self.obj.set_surname,
|
||||
# self.obj.get_surname,
|
||||
# self.db.readonly,
|
||||
# autolist=self.db.get_surname_list() if not self.db.readonly else [],
|
||||
# changed=self.update_group_as)
|
||||
|
||||
self.date = MonitoredDate(
|
||||
self.top.get_object("date_entry"),
|
||||
self.top.get_object("date_stat"),
|
||||
@ -232,7 +250,7 @@ class EditName(EditSecondary):
|
||||
self.db.readonly)
|
||||
|
||||
self.obj_combo = MonitoredDataType(
|
||||
self.top.get_object("name_type"),
|
||||
self.top.get_object("ntype"),
|
||||
self.obj.set_type,
|
||||
self.obj.get_type,
|
||||
self.db.readonly,
|
||||
@ -322,7 +340,7 @@ class EditName(EditSecondary):
|
||||
surname = self.obj.get_surname()
|
||||
self.group_as.set_text(surname)
|
||||
|
||||
def save(self,*obj):
|
||||
def save(self, *obj):
|
||||
"""Save the name setting. All is ok, except grouping. We need to
|
||||
consider:
|
||||
1/ global set, not local set --> unset (ask if global unset)
|
||||
|
@ -31,6 +31,7 @@ to edit information about a particular Person.
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from copy import copy
|
||||
from gen.ggettext import sgettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -63,7 +64,7 @@ from Errors import ValidationError
|
||||
from displaytabs import (PersonEventEmbedList, NameEmbedList, SourceEmbedList,
|
||||
AttrEmbedList, AddrEmbedList, NoteTab, GalleryTab,
|
||||
WebEmbedList, PersonRefEmbedList, LdsEmbedList,
|
||||
PersonBackRefList)
|
||||
PersonBackRefList, SurnameTab)
|
||||
from gen.plug import CATEGORY_QR_PERSON
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -150,6 +151,9 @@ class EditPerson(EditPrimary):
|
||||
self.singsurnfr = self.top.get_object("surnamefr")
|
||||
self.multsurnfr = self.top.get_object("multsurnamefr")
|
||||
self.singlesurn_active = True
|
||||
self.surntab = SurnameTab(self.dbstate, self.uistate, self.track,
|
||||
self.obj.get_primary_name())
|
||||
self.top.get_object("hboxmultsurnames").pack_start(self.surntab)
|
||||
|
||||
self.set_contexteventbox(self.top.get_object("eventboxtop"))
|
||||
|
||||
@ -166,7 +170,12 @@ class EditPerson(EditPrimary):
|
||||
self.load_person_image()
|
||||
self.given.grab_focus()
|
||||
|
||||
self.multsurnfr.hide_all()
|
||||
if len(self.obj.get_primary_name().get_surname_list()) > 1:
|
||||
self.singsurnfr.hide_all()
|
||||
self.singlesurn_active = False
|
||||
else:
|
||||
self.multsurnfr.hide_all()
|
||||
self.singlesurn_active = True
|
||||
#if self.pname.get_surname() and not self.pname.get_first_name():
|
||||
# self.given.grab_focus()
|
||||
#else:
|
||||
@ -184,6 +193,8 @@ class EditPerson(EditPrimary):
|
||||
self.given.connect("focus_out_event", self._given_focus_out_event)
|
||||
self.top.get_object("editnamebtn").connect("clicked",
|
||||
self._edit_name_clicked)
|
||||
self.top.get_object("multsurnamebtn").connect("clicked",
|
||||
self._mult_surn_clicked)
|
||||
|
||||
self.eventbox.connect('button-press-event',
|
||||
self._image_button_press)
|
||||
@ -241,8 +252,13 @@ class EditPerson(EditPrimary):
|
||||
def _validate_call(self, widget, text):
|
||||
""" a callname must be a part of the given name, see if this is the
|
||||
case """
|
||||
if not text in self.given.obj.get_text().split():
|
||||
return ValidationError(_("Call name must be the given name that "
|
||||
validcall = self.given.obj.get_text().split()
|
||||
dummy = copy(validcall)
|
||||
for item in dummy:
|
||||
validcall += item.split('-')
|
||||
if text in validcall:
|
||||
return
|
||||
return ValidationError(_("Call name must be the given name that "
|
||||
"is normally used."))
|
||||
|
||||
def _setup_fields(self):
|
||||
@ -811,6 +827,14 @@ class EditPerson(EditPrimary):
|
||||
EditName(self.dbstate, self.uistate, self.track,
|
||||
self.pname, self._update_name)
|
||||
|
||||
def _mult_surn_clicked(self, obj):
|
||||
"""
|
||||
Show the list entry of multiple surnames
|
||||
"""
|
||||
self.singsurnfr.hide_all()
|
||||
self.singlesurn_active = False
|
||||
self.multsurnfr.show_all()
|
||||
|
||||
def _update_name(self, name):
|
||||
"""
|
||||
Called when the primary name has been changed by the EditName
|
||||
@ -819,9 +843,15 @@ class EditPerson(EditPrimary):
|
||||
This allows us to update the main form in response to any changes.
|
||||
|
||||
"""
|
||||
for obj in (self.prefix_suffix, self.patro_title, self.given,
|
||||
self.ntype_field, self.surname_field, self.call):
|
||||
for obj in (self.ntype_field, self.given, self.call, self.title,
|
||||
self.suffix, self.nick, self.surname_field, self.prefix,
|
||||
self.ortype_field):
|
||||
obj.update()
|
||||
if len(self.obj.get_primary_name().get_surname_list()) > 1:
|
||||
#TODO: multiple surname must be activated if not yet the case
|
||||
print 'person editor TODO'
|
||||
#TODO: update list of surnames
|
||||
print 'person editor TODO 2'
|
||||
|
||||
def load_person_image(self):
|
||||
"""
|
||||
|
@ -32,6 +32,7 @@ class EditSecondary(ManagedWindow.ManagedWindow, DbGUIElement):
|
||||
"""Create an edit window. Associates a person with the window."""
|
||||
|
||||
self.obj = obj
|
||||
self.old_obj = obj.serialize()
|
||||
self.dbstate = state
|
||||
self.uistate = uistate
|
||||
self.db = state.db
|
||||
@ -113,13 +114,20 @@ class EditSecondary(ManagedWindow.ManagedWindow, DbGUIElement):
|
||||
button.set_sensitive(not self.db.readonly)
|
||||
|
||||
def define_cancel_button(self,button):
|
||||
button.connect('clicked',self.close)
|
||||
button.connect('clicked', self.canceledits)
|
||||
|
||||
def define_help_button(self, button, webpage='', section=''):
|
||||
button.connect('clicked', lambda x: GrampsDisplay.help(webpage,
|
||||
section))
|
||||
|
||||
def close(self,*obj):
|
||||
def canceledits(self, *obj):
|
||||
"""
|
||||
Undo the edits that happened on this secondary object
|
||||
"""
|
||||
self.obj.unserialize(self.old_obj)
|
||||
self.close(obj)
|
||||
|
||||
def close(self, *obj):
|
||||
self._cleanup_db_connects()
|
||||
self._cleanup_on_exit()
|
||||
ManagedWindow.ManagedWindow.close(self)
|
||||
|
Loading…
Reference in New Issue
Block a user