ChangeTypes.py: convert to use gtkbuilder instead of libglade

svn: r12414
This commit is contained in:
Gerald Britton 2009-04-09 14:55:37 +00:00
parent 2d648289fc
commit a59d141063
2 changed files with 239 additions and 251 deletions

View File

@ -37,7 +37,7 @@ from gettext import ngettext
# GNOME/GTK modules
#
#------------------------------------------------------------------------
from gtk import glade
import gtk
#------------------------------------------------------------------------
#
@ -79,10 +79,11 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
base = os.path.dirname(__file__)
glade_file = "%s/%s" % (base,"changetype.glade")
self.glade = glade.XML(glade_file,"top","gramps")
self.glade = gtk.Builder()
self.glade.add_from_file(glade_file)
self.auto1 = self.glade.get_widget("original")
self.auto2 = self.glade.get_widget("new")
self.auto1 = self.glade.get_object("original")
self.auto2 = self.glade.get_object("new")
# Need to display localized event names
etype = EventType()
@ -98,10 +99,10 @@ class ChangeTypes(Tool.BatchTool, ManagedWindow.ManagedWindow):
etype.set_from_xml_str(self.options.handler.options_dict['totype'])
self.auto2.child.set_text(str(etype))
window = self.glade.get_widget('top')
self.set_window(window,self.glade.get_widget('title'),self.title)
window = self.glade.get_object('top')
self.set_window(window,self.glade.get_object('title'),self.title)
self.glade.signal_autoconnect({
self.glade.connect_signals({
"on_close_clicked" : self.close,
"on_apply_clicked" : self.on_apply_clicked,
})

View File

@ -1,11 +1,9 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="top">
<?xml version="1.0"?>
<!--*- mode: xml -*-->
<interface>
<object class="GtkDialog" id="top">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="title" translatable="yes"/>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@ -19,21 +17,18 @@
<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_delete_event" last_modification_time="Thu, 24 Mar 2005 23:20:46 GMT"/>
<signal handler="on_delete_event" last_modification_time="Thu, 24 Mar 2005 23:20:46 GMT" name="delete_event"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<object class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<object class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="button5">
<object class="GtkButton" id="button5">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -41,13 +36,11 @@
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_close_clicked" object="top"/>
</widget>
<signal handler="on_close_clicked" name="clicked" object="top"/>
</object>
</child>
<child>
<widget class="GtkButton" id="button3">
<object class="GtkButton" id="button3">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
@ -55,11 +48,10 @@
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_apply_clicked" object="top"/>
</widget>
<signal handler="on_apply_clicked" name="clicked" object="top"/>
</object>
</child>
</widget>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -67,18 +59,16 @@
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<object class="GtkVBox" id="vbox1">
<property name="border_width">10</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<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_CENTER</property>
@ -92,16 +82,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">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label4">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label" translatable="yes">This tool will rename all events of one type to a different type. Once completed, this cannot be undone by the regular Undo function.</property>
<property name="use_underline">False</property>
@ -117,16 +106,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">0</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">12</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
@ -134,9 +122,8 @@
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label2">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">_Original event type:</property>
<property name="use_underline">True</property>
@ -152,19 +139,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="label3">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">_New event type:</property>
<property name="use_underline">True</property>
@ -180,24 +166,23 @@
<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="GtkComboBoxEntry" id="new">
<object class="GtkComboBoxEntry" id="new">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="has_frame">True</property>
<property name="focus_on_click">True</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -207,14 +192,13 @@
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="original">
<object class="GtkComboBoxEntry" id="original">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
<property name="has_frame">True</property>
<property name="focus_on_click">True</property>
</widget>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
@ -223,22 +207,25 @@
<property name="y_options">fill</property>
</packing>
</child>
</widget>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</object>
</child>
</widget>
</glade-interface>
<action-widgets>
<action-widget response="0">button5</action-widget>
<action-widget response="0">button3</action-widget>
</action-widgets>
</object>
</interface>