diff options
author | Pedro Algarvio <pedro@algarvio.me> | 2011-07-06 19:09:25 +0100 |
---|---|---|
committer | Pedro Algarvio <pedro@algarvio.me> | 2011-07-06 19:09:25 +0100 |
commit | b4cc1d43580d7292e2b6f3ac403702cf8d6eacbd (patch) | |
tree | 2758c8a977aa1f354f21a18ba6eb7dbfb92b9fc0 | |
parent | 39ad5a35964a81917b256a03c7ee37ba21bccdba (diff) | |
download | deluge-b4cc1d43580d7292e2b6f3ac403702cf8d6eacbd.tar.gz deluge-b4cc1d43580d7292e2b6f3ac403702cf8d6eacbd.tar.bz2 deluge-b4cc1d43580d7292e2b6f3ac403702cf8d6eacbd.zip |
Splited `dgtkpopups.glade` into `other_dialog.ui` and `connect_peer_dialog.ui` which are now using GtkBuilder.
-rw-r--r-- | deluge/ui/gtkui/common.py | 19 | ||||
-rw-r--r-- | deluge/ui/gtkui/glade/dgtkpopups.glade | 263 | ||||
-rw-r--r-- | deluge/ui/gtkui/glade/other_dialog.ui | 197 | ||||
-rw-r--r-- | deluge/ui/gtkui/peers_tab.py | 11 |
4 files changed, 213 insertions, 277 deletions
diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index ee0aa372c..1bd5a903e 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -151,26 +151,27 @@ def show_other_dialog(header, type_str, image_stockid=None, image_filename=None, if type(default) != int and type(default) != float: raise TypeError("default value needs to be an int or float") - glade = gtk.glade.XML(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "dgtkpopups.glade")) - ) - dialog = glade.get_widget("other_dialog") + builder = gtk.Builder() + builder.add_from_file(deluge.common.resource_filename( + "deluge.ui.gtkui", os.path.join("glade", "other_dialog.ui") + )) + dialog = builder.get_object("other_dialog") dialog.set_transient_for(component.get("MainWindow").window) dialog.set_position(gtk.WIN_POS_CENTER_ON_PARENT) dialog.set_title("") - glade.get_widget("label_header").set_markup("<b>" + header + "</b>") - glade.get_widget("label_type").set_text(type_str) + builder.get_object("label_header").set_markup("<b>" + header + "</b>") + builder.get_object("label_type").set_text(type_str) if image_stockid: - glade.get_widget("image").set_from_stock(image_stockid, gtk.ICON_SIZE_LARGE_TOOLBAR) + builder.get_object("image").set_from_stock(image_stockid, gtk.ICON_SIZE_LARGE_TOOLBAR) if image_filename: # Hack for Windows since it doesn't support svg if os.path.splitext(image_filename)[1] == ".svg" and (deluge.common.windows_check() or deluge.common.osx_check()): image_filename = os.path.splitext(image_filename)[0] + "16.png" pixbuf = gtk.gdk.pixbuf_new_from_file_at_size( deluge.common.get_pixmap(image_filename), 32, 32) - glade.get_widget("image").set_from_pixbuf(pixbuf) + builder.get_object("image").set_from_pixbuf(pixbuf) - spinbutton = glade.get_widget("spinbutton") + spinbutton = builder.get_object("spinbutton") if type(default) == float: spinbutton.set_digits(1) diff --git a/deluge/ui/gtkui/glade/dgtkpopups.glade b/deluge/ui/gtkui/glade/dgtkpopups.glade deleted file mode 100644 index 68f2c4b0a..000000000 --- a/deluge/ui/gtkui/glade/dgtkpopups.glade +++ /dev/null @@ -1,263 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> -<!--Generated with glade3 3.4.5 on Wed Nov 26 20:02:15 2008 --> -<glade-interface> - <widget class="GtkDialog" id="other_dialog"> - <property name="app_paintable">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="border_width">5</property> - <property name="modal">True</property> - <property name="window_position">GTK_WIN_POS_MOUSE</property> - <property name="destroy_with_parent">True</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">5</property> - <child> - <widget class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <property name="spacing">10</property> - <child> - <widget class="GtkImage" id="image"> - <property name="visible">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_header"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="no">label</property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkHSeparator" id="hseparator2"> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">2</property> - </packing> - </child> - <child> - <widget class="GtkHBox" id="hbox4"> - <property name="visible">True</property> - <property name="spacing">5</property> - <child> - <widget class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <child> - <placeholder/> - </child> - </widget> - </child> - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">1</property> - <child> - <widget class="GtkSpinButton" id="spinbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="max_length">6</property> - <property name="activates_default">True</property> - <property name="width_chars">6</property> - <property name="xalign">1</property> - <property name="adjustment">-1 -1 99999 1 10 0</property> - </widget> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label_type"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">label</property> - </widget> - <packing> - <property name="position">2</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">4</property> - </packing> - </child> - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area2"> - <property name="visible">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <child> - <widget class="GtkButton" id="button3"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="response_id">-6</property> - </widget> - </child> - <child> - <widget class="GtkButton" id="button4"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="response_id">-5</property> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="GtkDialog" id="connect_peer_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Add Peer</property> - <property name="window_position">GTK_WIN_POS_MOUSE</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="skip_taskbar_hint">True</property> - <property name="skip_pager_hint">True</property> - <property name="decorated">False</property> - <property name="has_separator">False</property> - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox3"> - <property name="visible">True</property> - <property name="spacing">2</property> - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="spacing">2</property> - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="spacing">5</property> - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes"><b>Add Peer</b></property> - <property name="use_markup">True</property> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - </widget> - </child> - <child> - <widget class="GtkHSeparator" id="hseparator1"> - <property name="visible">True</property> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <widget class="GtkEntry" id="txt_ip"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="activates_default">True</property> - <property name="width_chars">39</property> - <property name="text" translatable="yes">hostname:port</property> - </widget> - <packing> - <property name="position">2</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area3"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <child> - <widget class="GtkButton" id="button2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="response_id">0</property> - </widget> - </child> - <child> - <widget class="GtkButton" id="button1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="receives_default">True</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="response_id">1</property> - </widget> - <packing> - <property name="position">1</property> - </packing> - </child> - </widget> - <packing> - <property name="expand">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - </child> - </widget> -</glade-interface> diff --git a/deluge/ui/gtkui/glade/other_dialog.ui b/deluge/ui/gtkui/glade/other_dialog.ui new file mode 100644 index 000000000..b36de7135 --- /dev/null +++ b/deluge/ui/gtkui/glade/other_dialog.ui @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <requires lib="gtk+" version="2.16"/> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">-1</property> + <property name="upper">99999</property> + <property name="value">-1</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkDialog" id="other_dialog"> + <property name="app_paintable">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="border_width">5</property> + <property name="modal">True</property> + <property name="window_position">mouse</property> + <property name="destroy_with_parent">True</property> + <property name="type_hint">dialog</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">True</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="button3"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button4"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="use_action_appearance">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">10</property> + <child> + <object class="GtkImage" id="image"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_header"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label">label</property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkHSeparator" id="hseparator2"> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">5</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <child> + <object class="GtkSpinButton" id="spinbutton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="max_length">6</property> + <property name="activates_default">True</property> + <property name="width_chars">6</property> + <property name="xalign">1</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="primary_icon_sensitive">True</property> + <property name="secondary_icon_sensitive">True</property> + <property name="adjustment">adjustment1</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label_type"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">label</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">4</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-6">button3</action-widget> + <action-widget response="-5">button4</action-widget> + </action-widgets> + </object> +</interface> diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index 99a85e405..2a4235a56 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -380,11 +380,12 @@ class PeersTab(Tab): def _on_menuitem_add_peer_activate(self, menuitem): """This is a callback for manually adding a peer""" log.debug("on_menuitem_add_peer") - dialog_glade = gtk.glade.XML(deluge.common.resource_filename( - "deluge.ui.gtkui", os.path.join("glade", "dgtkpopups.glade")) - ) - peer_dialog = dialog_glade.get_widget("connect_peer_dialog") - txt_ip = dialog_glade.get_widget("txt_ip") + builder = gtk.Builder() + builder.add_from_file(deluge.common.resource_filename( + "deluge.ui.gtkui", os.path.join("glade", "connect_peer_dialog.ui") + )) + peer_dialog = builder.get_object("connect_peer_dialog") + txt_ip = builder.get_object("txt_ip") response = peer_dialog.run() if response: value = txt_ip.get_text() |