OwnerEditor.py: convert to use gtkbuilder instead of libglade

svn: r12418
This commit is contained in:
Gerald Britton 2009-04-09 18:33:49 +00:00
parent ee253d1868
commit db1884afc9
2 changed files with 557 additions and 595 deletions

View File

@ -36,7 +36,6 @@ import os
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
#-------------------------------------------------------------------------
#
@ -100,21 +99,22 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow):
glade_file = os.path.join(base, "ownereditor.glade")
# get the main window from glade
top_xml = glade.XML(glade_file, "top", "gramps")
topDialog = gtk.Builder()
topDialog.add_from_file(glade_file)
# set gramps style title for the window
window = top_xml.get_widget("top")
window = topDialog.get_object("top")
self.set_window(window,
top_xml.get_widget("title"),
topDialog.get_object("title"),
_("Database Owner Editor"))
# move help button to the left side
action_area = top_xml.get_widget("action_area")
help_button = top_xml.get_widget("help_button")
action_area = topDialog.get_object("action_area")
help_button = topDialog.get_object("help_button")
action_area.set_child_secondary(help_button, True)
# connect signals
top_xml.signal_autoconnect({
topDialog.connect_signals({
"on_ok_button_clicked": self.on_ok_button_clicked,
"on_cancel_button_clicked": self.close,
"on_help_button_clicked": self.on_help_button_clicked,
@ -122,9 +122,10 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow):
})
# fetch the popup menu
popup_xml = glade.XML(glade_file, "popup-menu", "gramps")
self.menu = popup_xml.get_widget("popup-menu")
popup_xml.signal_connect("on_menu_activate", self.on_menu_activate)
popup_menu = gtk.Builder()
popup_menu.add_from_file(glade_file)
self.menu = popup_menu.get_object("popup-menu")
popup_menu.connect_signals({"on_menu_activate": self.on_menu_activate})
# get current db owner and attach it to the entries of the window
self.owner = self.db.get_researcher()
@ -142,7 +143,7 @@ class OwnerEditor(Tool.Tool, ManagedWindow.ManagedWindow):
]
for (name,set_fn,get_fn) in entry:
self.entries.append(MonitoredEntry(top_xml.get_widget(name),
self.entries.append(MonitoredEntry(topDialog.get_object(name),
set_fn,
get_fn,
self.db.readonly))

View File

@ -1,10 +1,36 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="top">
<property name="title" translatable="yes"></property>
<?xml version="1.0"?>
<!--*- mode: xml -*-->
<interface>
<object class="GtkUIManager" id="uimanager1">
<child>
<object class="GtkActionGroup" id="actiongroup1">
<child>
<object class="GtkAction" id="copy_from_db_to_preferences">
<property name="stock_id">gtk-go-back</property>
<property name="name">copy_from_db_to_preferences</property>
<property name="label" translatable="yes">Copy from DB to Preferences</property>
<signal handler="on_menu_activate" last_modification_time="Tue, 30 Jan 2007 21:31:57 GMT" name="activate"/>
</object>
</child>
<child>
<object class="GtkAction" id="copy_from_preferences_to_db">
<property name="stock_id">gtk-go-forward</property>
<property name="name">copy_from_preferences_to_db</property>
<property name="label" translatable="yes">Copy from Preferences to DB</property>
<signal handler="on_menu_activate" last_modification_time="Tue, 30 Jan 2007 21:32:09 GMT" name="activate"/>
</object>
</child>
</object>
</child>
<ui>
<popup name="popup-menu">
<menuitem action="copy_from_db_to_preferences"/>
<menuitem action="copy_from_preferences_to_db"/>
</popup>
</ui>
</object>
<object class="GtkWindow" id="top">
<property name="title" translatable="yes"/>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
@ -18,30 +44,26 @@
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="delete_event" handler="on_delete_event" last_modification_time="Mon, 10 May 2004 00:32:54 GMT"/>
<signal handler="on_delete_event" last_modification_time="Mon, 10 May 2004 00:32:54 GMT" name="delete_event"/>
<child>
<widget class="GtkEventBox" id="eventbox">
<object class="GtkEventBox" id="eventbox">
<property name="visible">True</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<signal name="button_press_event" handler="on_eventbox_button_press_event" last_modification_time="Tue, 30 Jan 2007 21:18:53 GMT"/>
<signal handler="on_eventbox_button_press_event" last_modification_time="Tue, 30 Jan 2007 21:18:53 GMT" name="button_press_event"/>
<child>
<widget class="GtkVBox" id="vbox2">
<object class="GtkVBox" id="vbox2">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkHButtonBox" id="action_area">
<object class="GtkHButtonBox" id="action_area">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="cancel_button">
<object class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -49,12 +71,11 @@
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Tue, 30 Jan 2007 17:27:10 GMT"/>
</widget>
<signal handler="on_cancel_button_clicked" last_modification_time="Tue, 30 Jan 2007 17:27:10 GMT" name="clicked"/>
</object>
</child>
<child>
<widget class="GtkButton" id="ok_button">
<object class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -62,12 +83,11 @@
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_ok_button_clicked" last_modification_time="Tue, 30 Jan 2007 17:27:02 GMT"/>
</widget>
<signal handler="on_ok_button_clicked" last_modification_time="Tue, 30 Jan 2007 17:27:02 GMT" name="clicked"/>
</object>
</child>
<child>
<widget class="GtkButton" id="help_button">
<object class="GtkButton" id="help_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -75,10 +95,10 @@
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_help_button_clicked" last_modification_time="Tue, 30 Jan 2007 17:26:52 GMT"/>
</widget>
<signal handler="on_help_button_clicked" last_modification_time="Tue, 30 Jan 2007 17:26:52 GMT" name="clicked"/>
</object>
</child>
</widget>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -86,11 +106,10 @@
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkHSeparator" id="hseparator1">
<object class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
</widget>
</object>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
@ -98,11 +117,10 @@
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="title">
<object class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="label" translatable="yes"/>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -116,16 +134,15 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<packing>
<property name="padding">6</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table1">
<object class="GtkTable" id="table1">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="n_rows">8</property>
@ -133,9 +150,8 @@
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<widget class="GtkLabel" id="label1">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Name:</property>
<property name="use_underline">False</property>
@ -151,19 +167,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Address:</property>
<property name="use_underline">False</property>
@ -179,19 +194,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label3">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">City:</property>
<property name="use_underline">False</property>
@ -207,19 +221,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">State/Province:</property>
<property name="use_underline">False</property>
@ -235,19 +248,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">Country:</property>
<property name="use_underline">False</property>
@ -263,19 +275,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">ZIP/Postal Code:</property>
<property name="use_underline">False</property>
@ -291,19 +302,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label7">
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="label" translatable="yes">Phone:</property>
<property name="use_underline">False</property>
@ -319,19 +329,18 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label8">
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="label" translatable="yes">Email:</property>
<property name="use_underline">False</property>
@ -347,240 +356,192 @@
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</object>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry1">
<object class="GtkEntry" id="entry1">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry2">
<object class="GtkEntry" id="entry2">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry3">
<object class="GtkEntry" id="entry3">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry4">
<object class="GtkEntry" id="entry4">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</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>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry5">
<object class="GtkEntry" id="entry5">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry6">
<object class="GtkEntry" id="entry6">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry7">
<object class="GtkEntry" id="entry7">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry8">
<object class="GtkEntry" id="entry8">
<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="text" translatable="yes"/>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="invisible_char">&#x2022;</property>
<property name="activates_default">False</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
</widget>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</object>
</child>
</widget>
</object>
</child>
</widget>
</object>
<object class="GtkMenu" constructor="uimanager1" id="popup-menu">
<widget class="GtkMenu" id="popup-menu">
<child>
<widget class="GtkImageMenuItem" id="copy_from_db_to_preferences">
<property name="visible">True</property>
<property name="label" translatable="yes">Copy from DB to Preferences</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_activate" last_modification_time="Tue, 30 Jan 2007 21:31:57 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="stock">gtk-go-back</property>
<property name="icon_size">1</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>
</child>
<child>
<widget class="GtkImageMenuItem" id="copy_from_preferences_to_db">
<property name="visible">True</property>
<property name="label" translatable="yes">Copy from Preferences to DB</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_activate" last_modification_time="Tue, 30 Jan 2007 21:32:09 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">1</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>
</child>
</widget>
</glade-interface>
</object>
</interface>