ScratchPad.py: convert to use gtkbuilder instead of libglade
svn: r12444
This commit is contained in:
		@@ -43,7 +43,6 @@ except:
 | 
				
			|||||||
#-------------------------------------------------------------------------
 | 
					#-------------------------------------------------------------------------
 | 
				
			||||||
import gtk
 | 
					import gtk
 | 
				
			||||||
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, ACTION_MOVE
 | 
					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.width_key = Config.CLIPBOARD_WIDTH
 | 
				
			||||||
        self.height_key = Config.CLIPBOARD_HEIGHT
 | 
					        self.height_key = Config.CLIPBOARD_HEIGHT
 | 
				
			||||||
        self.glade_file = os.path.join(const.GLADE_DIR, "scratchpad.glade")
 | 
					        self.glade_file = os.path.join(const.GLADE_DIR, "scratchpad.glade")
 | 
				
			||||||
 | 
					        self.top = gtk.Builder()
 | 
				
			||||||
        self.top = glade.XML(self.glade_file,"scratch_pad","gramps")
 | 
					        self.top.add_from_file(self.glade_file)
 | 
				
			||||||
        self.set_window(self.top.get_widget("scratch_pad"),
 | 
					        self.set_window(self.top.get_object("scratch_pad"),
 | 
				
			||||||
                        None, None, msg=_("Clipboard"))
 | 
					                        None, None, msg=_("Clipboard"))
 | 
				
			||||||
        self._set_size()
 | 
					        self._set_size()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.clear_all_btn = self.top.get_widget("btn_clear_all")
 | 
					        self.clear_all_btn = self.top.get_object("btn_clear_all")
 | 
				
			||||||
        self.clear_btn = self.top.get_widget("btn_clear")
 | 
					        self.clear_btn = self.top.get_object("btn_clear")
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        self.object_list = ScratchPadListView(
 | 
					        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.object_list.get_selection().connect('changed',
 | 
				
			||||||
                                                 self.set_clear_btn_sensitivity)
 | 
					                                                 self.set_clear_btn_sensitivity)
 | 
				
			||||||
        self.set_clear_btn_sensitivity(sel=self.object_list.get_selection())
 | 
					        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.object_list.set_model(ScratchPadWindow.otree)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        self.top.signal_autoconnect({
 | 
					        self.top.connect_signals({
 | 
				
			||||||
            "on_close_scratchpad" : self.close,
 | 
					            "on_close_scratchpad" : self.close,
 | 
				
			||||||
            "on_clear_clicked": self.on_clear_clicked,
 | 
					            "on_clear_clicked": self.on_clear_clicked,
 | 
				
			||||||
            "on_help_clicked": self.on_help_clicked,
 | 
					            "on_help_clicked": self.on_help_clicked,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,7 @@
 | 
				
			|||||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
 | 
					<?xml version="1.0"?>
 | 
				
			||||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
 | 
					<!--*- mode: xml -*-->
 | 
				
			||||||
 | 
					<interface>
 | 
				
			||||||
<glade-interface>
 | 
					  <object class="GtkDialog" id="scratch_pad">
 | 
				
			||||||
 | 
					 | 
				
			||||||
<widget class="GtkDialog" id="scratch_pad">
 | 
					 | 
				
			||||||
    <property name="visible">True</property>
 | 
					    <property name="visible">True</property>
 | 
				
			||||||
    <property name="title" translatable="yes">Clipboard</property>
 | 
					    <property name="title" translatable="yes">Clipboard</property>
 | 
				
			||||||
    <property name="type">GTK_WINDOW_TOPLEVEL</property>
 | 
					    <property name="type">GTK_WINDOW_TOPLEVEL</property>
 | 
				
			||||||
@@ -19,21 +17,18 @@
 | 
				
			|||||||
    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
 | 
					    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
 | 
				
			||||||
    <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
 | 
					    <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
 | 
				
			||||||
    <property name="has_separator">True</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"/>
 | 
					    <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">
 | 
					    <child internal-child="vbox">
 | 
				
			||||||
    <widget class="GtkVBox" id="dialog-vbox1">
 | 
					      <object class="GtkVBox" id="dialog-vbox1">
 | 
				
			||||||
        <property name="visible">True</property>
 | 
					        <property name="visible">True</property>
 | 
				
			||||||
        <property name="homogeneous">False</property>
 | 
					        <property name="homogeneous">False</property>
 | 
				
			||||||
        <property name="spacing">0</property>
 | 
					        <property name="spacing">0</property>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <child internal-child="action_area">
 | 
					        <child internal-child="action_area">
 | 
				
			||||||
	<widget class="GtkHButtonBox" id="dialog-action_area1">
 | 
					          <object class="GtkHButtonBox" id="dialog-action_area1">
 | 
				
			||||||
            <property name="visible">True</property>
 | 
					            <property name="visible">True</property>
 | 
				
			||||||
            <property name="layout_style">GTK_BUTTONBOX_END</property>
 | 
					            <property name="layout_style">GTK_BUTTONBOX_END</property>
 | 
				
			||||||
 | 
					 | 
				
			||||||
            <child>
 | 
					            <child>
 | 
				
			||||||
	    <widget class="GtkButton" id="helpbutton1">
 | 
					              <object class="GtkButton" id="helpbutton1">
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can_default">True</property>
 | 
					                <property name="can_default">True</property>
 | 
				
			||||||
                <property name="can_focus">True</property>
 | 
					                <property name="can_focus">True</property>
 | 
				
			||||||
@@ -41,13 +36,11 @@
 | 
				
			|||||||
                <property name="use_stock">True</property>
 | 
					                <property name="use_stock">True</property>
 | 
				
			||||||
                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
					                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
				
			||||||
                <property name="focus_on_click">True</property>
 | 
					                <property name="focus_on_click">True</property>
 | 
				
			||||||
	      <property name="response_id">-11</property>
 | 
					                <signal handler="on_help_clicked" last_modification_time="Sat, 19 Mar 2005 22:47:16 GMT" name="clicked"/>
 | 
				
			||||||
	      <signal name="clicked" handler="on_help_clicked" last_modification_time="Sat, 19 Mar 2005 22:47:16 GMT"/>
 | 
					              </object>
 | 
				
			||||||
	    </widget>
 | 
					 | 
				
			||||||
            </child>
 | 
					            </child>
 | 
				
			||||||
 | 
					 | 
				
			||||||
            <child>
 | 
					            <child>
 | 
				
			||||||
	    <widget class="GtkButton" id="btn_clear_all">
 | 
					              <object class="GtkButton" id="btn_clear_all">
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can_default">True</property>
 | 
					                <property name="can_default">True</property>
 | 
				
			||||||
                <property name="can_focus">True</property>
 | 
					                <property name="can_focus">True</property>
 | 
				
			||||||
@@ -55,13 +48,11 @@
 | 
				
			|||||||
                <property name="use_underline">True</property>
 | 
					                <property name="use_underline">True</property>
 | 
				
			||||||
                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
					                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
				
			||||||
                <property name="focus_on_click">True</property>
 | 
					                <property name="focus_on_click">True</property>
 | 
				
			||||||
	      <property name="response_id">0</property>
 | 
					                <signal handler="on_clear_all_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:57 GMT" name="clicked"/>
 | 
				
			||||||
	      <signal name="clicked" handler="on_clear_all_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:57 GMT"/>
 | 
					              </object>
 | 
				
			||||||
	    </widget>
 | 
					 | 
				
			||||||
            </child>
 | 
					            </child>
 | 
				
			||||||
 | 
					 | 
				
			||||||
            <child>
 | 
					            <child>
 | 
				
			||||||
	    <widget class="GtkButton" id="btn_clear">
 | 
					              <object class="GtkButton" id="btn_clear">
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can_default">True</property>
 | 
					                <property name="can_default">True</property>
 | 
				
			||||||
                <property name="can_focus">True</property>
 | 
					                <property name="can_focus">True</property>
 | 
				
			||||||
@@ -69,13 +60,11 @@
 | 
				
			|||||||
                <property name="use_stock">True</property>
 | 
					                <property name="use_stock">True</property>
 | 
				
			||||||
                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
					                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
				
			||||||
                <property name="focus_on_click">True</property>
 | 
					                <property name="focus_on_click">True</property>
 | 
				
			||||||
	      <property name="response_id">0</property>
 | 
					                <signal handler="on_clear_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:29 GMT" name="clicked"/>
 | 
				
			||||||
	      <signal name="clicked" handler="on_clear_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:29 GMT"/>
 | 
					              </object>
 | 
				
			||||||
	    </widget>
 | 
					 | 
				
			||||||
            </child>
 | 
					            </child>
 | 
				
			||||||
 | 
					 | 
				
			||||||
            <child>
 | 
					            <child>
 | 
				
			||||||
	    <widget class="GtkButton" id="btn_close">
 | 
					              <object class="GtkButton" id="btn_close">
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can_default">True</property>
 | 
					                <property name="can_default">True</property>
 | 
				
			||||||
                <property name="can_focus">True</property>
 | 
					                <property name="can_focus">True</property>
 | 
				
			||||||
@@ -83,11 +72,10 @@
 | 
				
			|||||||
                <property name="use_stock">True</property>
 | 
					                <property name="use_stock">True</property>
 | 
				
			||||||
                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
					                <property name="relief">GTK_RELIEF_NORMAL</property>
 | 
				
			||||||
                <property name="focus_on_click">True</property>
 | 
					                <property name="focus_on_click">True</property>
 | 
				
			||||||
	      <property name="response_id">-7</property>
 | 
					                <signal handler="on_close_scratchpad" last_modification_time="Sat, 19 Mar 2005 22:42:52 GMT" name="clicked"/>
 | 
				
			||||||
	      <signal name="clicked" handler="on_close_scratchpad" last_modification_time="Sat, 19 Mar 2005 22:42:52 GMT"/>
 | 
					              </object>
 | 
				
			||||||
	    </widget>
 | 
					 | 
				
			||||||
            </child>
 | 
					            </child>
 | 
				
			||||||
	</widget>
 | 
					          </object>
 | 
				
			||||||
          <packing>
 | 
					          <packing>
 | 
				
			||||||
            <property name="padding">0</property>
 | 
					            <property name="padding">0</property>
 | 
				
			||||||
            <property name="expand">False</property>
 | 
					            <property name="expand">False</property>
 | 
				
			||||||
@@ -95,35 +83,38 @@
 | 
				
			|||||||
            <property name="pack_type">GTK_PACK_END</property>
 | 
					            <property name="pack_type">GTK_PACK_END</property>
 | 
				
			||||||
          </packing>
 | 
					          </packing>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <child>
 | 
					        <child>
 | 
				
			||||||
	<widget class="GtkScrolledWindow" id="scrolledwindow86">
 | 
					          <object class="GtkScrolledWindow" id="scrolledwindow86">
 | 
				
			||||||
            <property name="visible">True</property>
 | 
					            <property name="visible">True</property>
 | 
				
			||||||
            <property name="can_focus">True</property>
 | 
					            <property name="can_focus">True</property>
 | 
				
			||||||
            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
					            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
				
			||||||
            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
					            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
 | 
				
			||||||
            <property name="shadow_type">GTK_SHADOW_IN</property>
 | 
					            <property name="shadow_type">GTK_SHADOW_IN</property>
 | 
				
			||||||
            <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 | 
					            <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 | 
				
			||||||
 | 
					 | 
				
			||||||
            <child>
 | 
					            <child>
 | 
				
			||||||
	    <widget class="GtkTreeView" id="objectlist">
 | 
					              <object class="GtkTreeView" id="objectlist">
 | 
				
			||||||
                <property name="visible">True</property>
 | 
					                <property name="visible">True</property>
 | 
				
			||||||
                <property name="can_focus">True</property>
 | 
					                <property name="can_focus">True</property>
 | 
				
			||||||
                <property name="headers_visible">True</property>
 | 
					                <property name="headers_visible">True</property>
 | 
				
			||||||
                <property name="rules_hint">False</property>
 | 
					                <property name="rules_hint">False</property>
 | 
				
			||||||
                <property name="reorderable">False</property>
 | 
					                <property name="reorderable">False</property>
 | 
				
			||||||
                <property name="enable_search">True</property>
 | 
					                <property name="enable_search">True</property>
 | 
				
			||||||
	    </widget>
 | 
					              </object>
 | 
				
			||||||
            </child>
 | 
					            </child>
 | 
				
			||||||
	</widget>
 | 
					          </object>
 | 
				
			||||||
          <packing>
 | 
					          <packing>
 | 
				
			||||||
            <property name="padding">0</property>
 | 
					            <property name="padding">0</property>
 | 
				
			||||||
            <property name="expand">True</property>
 | 
					            <property name="expand">True</property>
 | 
				
			||||||
            <property name="fill">True</property>
 | 
					            <property name="fill">True</property>
 | 
				
			||||||
          </packing>
 | 
					          </packing>
 | 
				
			||||||
        </child>
 | 
					        </child>
 | 
				
			||||||
    </widget>
 | 
					      </object>
 | 
				
			||||||
    </child>
 | 
					    </child>
 | 
				
			||||||
</widget>
 | 
					    <action-widgets>
 | 
				
			||||||
 | 
					      <action-widget response="-11">helpbutton1</action-widget>
 | 
				
			||||||
</glade-interface>
 | 
					      <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>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user