restore attr_edit in glade file

svn: r6286
This commit is contained in:
Don Allingham 2006-04-07 04:32:43 +00:00
parent 55ddeae2c7
commit d3cefa135e
4 changed files with 618 additions and 48 deletions

View File

@ -1,4 +1,5 @@
2006-04-06 Don Allingham <don@gramps-project.org>
* src/glade/gramps.glade: restored addr_edit
* src/DataViews/_FamilyView.py: add select parents function
2006-04-06 Alex Roitman <shura@gramps-project.org>

View File

@ -18,15 +18,47 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
_top = '<ui><menubar name="MenuBar"><menu action="GoMenu"><placeholder name="CommonHistory">'
_btm = '</placeholder></menu></menubar></ui>'
"""
Base history navigation class. Builds the action group and ui for the
uimanager. Changes to the associated history objects are tracked. When
the history changes, the UI XML string and the action groups are updated.
"""
__author__ = "Donald N. Allingham"
__revision__ = "$Revision:$"
#-------------------------------------------------------------------
#
# constants
#
#-------------------------------------------------------------------
import gtk
import sys
import NameDisplay
DISABLED = -1
#-------------------------------------------------------------------
#
# UI Manager XML code
#
#-------------------------------------------------------------------
_top = [
'<ui>'
'<menubar name="MenuBar">'
'<menu action="GoMenu">'
'<placeholder name="CommonHistory">'
]
_btm = [
'</placeholder>'
'</menu>'
'</menubar>'
'</ui>'
]
class BaseNavigation:
"""
Base history navigation class. Builds the action group and ui for the
@ -43,16 +75,20 @@ class BaseNavigation:
self.func - array of functions to take action based off of.
"""
def __init__(self,uistate,history,title):
def __init__(self, uistate, history, title):
self.title = title
self.ui = _top+_btm
self.ui = "".join(_top) + "".join(_btm)
self.uistate = uistate
self.action_group = gtk.ActionGroup(self.title)
self.active = DISABLED
self.items = []
self.func = []
self.history = history
def clear(self):
"""
Clears out the specified history
"""
self.history.clear()
def disable(self):
@ -72,23 +108,24 @@ class BaseNavigation:
self.uistate.uimanager.insert_action_group(self.action_group, 1)
self.active = self.uistate.uimanager.add_ui_from_string(self.ui)
def build_item_name(self,handle):
def build_item_name(self, handle):
"""
Builds a string from the passed handle. Must be overridden by the
derrived class.
"""
return "ERROR"
def update_menu(self,items):
def update_menu(self, items):
"""
Builds the UI and action group.
"""
self.items = items
self.disable()
menu_len = min(len(items),10)
data = map(lambda x: '<menuitem action="%s%02d"/>' % (self.title,x), range(0,menu_len))
self.ui = _top + "".join(data) + _btm
menu_len = min(len(items), 10)
entry = '<menuitem action="%s%02d"/>'
data = [ entry % (self.title, index) for index in range(0, menu_len) ]
self.ui = "".join(_top) + "".join(data) + "".join(_btm)
self.action_group = gtk.ActionGroup(self.title)
data = []
index = 0
@ -97,9 +134,9 @@ class BaseNavigation:
mitems.reverse()
for item in mitems[:10]:
name = self.build_item_name(item)
f = self.func[index]
data.append(('%s%02d'%(self.title,index), None, name,
"<alt>%d" % index, None, f))
func = self.func[index]
data.append(('%s%02d'%(self.title, index), None, name,
"<alt>%d" % index, None, func))
index += 1
self.action_group.add_actions(data)
@ -110,15 +147,17 @@ class PersonNavigation(BaseNavigation):
"""
Builds a navigation item for the Person class.
"""
def __init__(self,uistate):
def __init__(self, uistate):
"""
Associates the functions with the associated items. Builds the function
array so that there are unique functions for each possible index (0-9)
The callback simply calls change_active_handle
"""
BaseNavigation.__init__(self,uistate,uistate.phistory,'PersonHistory')
self.func = [ self.f0, self.f1, self.f2, self.f3, self.f4,
self.f5, self.f6, self.f7, self.f8, self.f9 ]
BaseNavigation.__init__(self, uistate, uistate.phistory, 'PersonHistory')
fcn_ptr = self.uistate.dbstate.change_active_handle
self.func = [ generate(fcn_ptr, self.items, index) \
for index in range(0, 10) ]
def build_item_name(self, item):
"""
@ -128,33 +167,8 @@ class PersonNavigation(BaseNavigation):
return "%s [%s]" % (NameDisplay.displayer.display(person),
person.gramps_id)
def f0(self,obj):
self.uistate.dbstate.change_active_handle(self.items[0])
def f1(self,obj):
self.uistate.dbstate.change_active_handle(self.items[1])
def f2(self,obj):
self.uistate.dbstate.change_active_handle(self.items[2])
def f3(self,obj):
self.uistate.dbstate.change_active_handle(self.items[3])
def f4(self,obj):
self.uistate.dbstate.change_active_handle(self.items[4])
def f5(self,obj):
self.uistate.dbstate.change_active_handle(self.items[5])
def f6(self,obj):
self.uistate.dbstate.change_active_handle(self.items[6])
def f7(self,obj):
self.uistate.dbstate.change_active_handle(self.items[7])
def f8(self,obj):
self.uistate.dbstate.change_active_handle(self.items[8])
def f9(self,obj):
self.uistate.dbstate.change_active_handle(self.items[9])
def generate(func, items, index):
"""
Generates a callback function based off the passed arguments
"""
return lambda x: func(items[index])

View File

@ -20,6 +20,11 @@
# $Id$
__author__ = "Donald N. Allingham"
__revision__ = "$Revision$"
#-------------------------------------------------------------------------
#
# internationalization

View File

@ -15803,4 +15803,554 @@ You should select parents before adding any new information. If you select paren
</child>
</widget>
<widget class="GtkDialog" id="addr_edit">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">600</property>
<property name="default_height">450</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<signal name="delete_event" handler="on_addr_edit_delete_event" last_modification_time="Fri, 20 Feb 2004 01:16:24 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox34">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="hbox30">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="on_cancel_addr_clicked" object="addr_edit" last_modification_time="Fri, 20 Feb 2004 01:16:51 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Accept changes and close window</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="on_ok_addr_clicked" last_modification_time="Fri, 20 Feb 2004 01:17:10 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="help">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_addr_clicked" last_modification_time="Tue, 18 Nov 2003 04:04:45 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">10</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table26">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">7</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label209">
<property name="visible">True</property>
<property name="label" translatable="yes">_Date:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">address_start</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label210">
<property name="visible">True</property>
<property name="label" translatable="yes">Add_ress:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">street</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label214">
<property name="visible">True</property>
<property name="label" translatable="yes">_City/County:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">city</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="city">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label215">
<property name="visible">True</property>
<property name="label" translatable="yes">_State/Province:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">state</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<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">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label217">
<property name="visible">True</property>
<property name="label" translatable="yes">_ZIP/Postal code:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">postal</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="postal">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label216">
<property name="visible">True</property>
<property name="label" translatable="yes">Cou_ntry:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">country</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label295">
<property name="visible">True</property>
<property name="label" translatable="yes">P_hone:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">phone</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="phone">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="address_start">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">6</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="state">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">7</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="country">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">7</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="street">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">6</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkToggleButton" id="private">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<child>
<widget class="GtkImage" id="image2685">
<property name="visible">True</property>
<property name="icon_size">1</property>
<property name="icon_name">gtk-dialog-authentication</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">6</property>
<property name="right_attach">7</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="date_stat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkImage" id="date_stat_child">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">6</property>
<property name="right_attach">7</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>