ScratchPad.py: convert to use gtkbuilder instead of libglade

svn: r12444
This commit is contained in:
Gerald Britton 2009-04-13 19:26:29 +00:00
parent 85e9b4dd1b
commit 8a66aa053a
2 changed files with 127 additions and 137 deletions

View File

@ -43,7 +43,6 @@ except:
#-------------------------------------------------------------------------
import gtk
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, ACTION_MOVE
from gtk import glade
#-------------------------------------------------------------------------
#
@ -1202,17 +1201,17 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
self.width_key = Config.CLIPBOARD_WIDTH
self.height_key = Config.CLIPBOARD_HEIGHT
self.glade_file = os.path.join(const.GLADE_DIR, "scratchpad.glade")
self.top = glade.XML(self.glade_file,"scratch_pad","gramps")
self.set_window(self.top.get_widget("scratch_pad"),
self.top = gtk.Builder()
self.top.add_from_file(self.glade_file)
self.set_window(self.top.get_object("scratch_pad"),
None, None, msg=_("Clipboard"))
self._set_size()
self.clear_all_btn = self.top.get_widget("btn_clear_all")
self.clear_btn = self.top.get_widget("btn_clear")
self.clear_all_btn = self.top.get_object("btn_clear_all")
self.clear_btn = self.top.get_object("btn_clear")
self.object_list = ScratchPadListView(
self.dbstate,self.top.get_widget('objectlist'))
self.dbstate,self.top.get_object('objectlist'))
self.object_list.get_selection().connect('changed',
self.set_clear_btn_sensitivity)
self.set_clear_btn_sensitivity(sel=self.object_list.get_selection())
@ -1229,7 +1228,7 @@ class ScratchPadWindow(ManagedWindow.ManagedWindow):
self.object_list.set_model(ScratchPadWindow.otree)
self.top.signal_autoconnect({
self.top.connect_signals({
"on_close_scratchpad" : self.close,
"on_clear_clicked": self.on_clear_clicked,
"on_help_clicked": self.on_help_clicked,

View File

@ -1,129 +1,120 @@
<?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="scratch_pad">
<property name="visible">True</property>
<property name="title" translatable="yes">Clipboard</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">500</property>
<property name="default_height">300</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="has_separator">True</property>
<signal name="delete_event" handler="on_scratch_pad_delete_event" last_modification_time="Wed, 25 May 2005 13:26:32 GMT"/>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="helpbutton1">
<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_clicked" last_modification_time="Sat, 19 Mar 2005 22:47:16 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_clear_all">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Clear _All</property>
<property name="use_underline">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_clear_all_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:57 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_clear">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-clear</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">0</property>
<signal name="clicked" handler="on_clear_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:29 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</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">-7</property>
<signal name="clicked" handler="on_close_scratchpad" last_modification_time="Sat, 19 Mar 2005 22:42:52 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="GtkScrolledWindow" id="scrolledwindow86">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="objectlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</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>
<?xml version="1.0"?>
<!--*- mode: xml -*-->
<interface>
<object class="GtkDialog" id="scratch_pad">
<property name="visible">True</property>
<property name="title" translatable="yes">Clipboard</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">500</property>
<property name="default_height">300</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="has_separator">True</property>
<signal handler="on_scratch_pad_delete_event" last_modification_time="Wed, 25 May 2005 13:26:32 GMT" name="delete_event"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<object class="GtkButton" id="helpbutton1">
<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>
<signal handler="on_help_clicked" last_modification_time="Sat, 19 Mar 2005 22:47:16 GMT" name="clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="btn_clear_all">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Clear _All</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal handler="on_clear_all_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:57 GMT" name="clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="btn_clear">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-clear</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal handler="on_clear_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:29 GMT" name="clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="btn_close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal handler="on_close_scratchpad" last_modification_time="Sat, 19 Mar 2005 22:42:52 GMT" name="clicked"/>
</object>
</child>
</object>
<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>
<object class="GtkScrolledWindow" id="scrolledwindow86">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<object class="GtkTreeView" id="objectlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</object>
</child>
</object>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-11">helpbutton1</action-widget>
<action-widget response="0">btn_clear_all</action-widget>
<action-widget response="0">btn_clear</action-widget>
<action-widget response="-7">btn_close</action-widget>
</action-widgets>
</object>
</interface>