diff --git a/deluge/plugins/Label/deluge/plugins/label/data/label_add.ui b/deluge/plugins/Label/deluge/plugins/label/data/label_add.ui new file mode 100644 index 000000000..1e46cfcae --- /dev/null +++ b/deluge/plugins/Label/deluge/plugins/label/data/label_add.ui @@ -0,0 +1,174 @@ + + + + + + False + 5 + Add Label + False + True + mouse + True + dialog + True + + + True + False + 2 + + + True + False + end + + + gtk-cancel + False + True + True + True + True + + + + False + False + 0 + + + + + gtk-ok + False + True + True + True + True + True + True + + + + False + False + 1 + + + + + False + True + end + 0 + + + + + True + False + 5 + + + True + False + 5 + + + True + False + gtk-add + + + False + False + 0 + + + + + True + False + <b>Add Label</b> + True + + + False + False + 1 + + + + + False + False + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Name: + + + False + False + 0 + + + + + True + True + True + False + False + True + True + + + True + True + 1 + + + + + False + False + 2 + + + + + True + True + 1 + + + + + + button2 + button1 + + + diff --git a/deluge/plugins/Label/deluge/plugins/label/data/label_options.glade b/deluge/plugins/Label/deluge/plugins/label/data/label_options.ui similarity index 69% rename from deluge/plugins/Label/deluge/plugins/label/data/label_options.glade rename to deluge/plugins/Label/deluge/plugins/label/data/label_options.ui index f0317726b..883476115 100644 --- a/deluge/plugins/Label/deluge/plugins/label/data/label_options.glade +++ b/deluge/plugins/Label/deluge/plugins/label/data/label_options.ui @@ -1,172 +1,43 @@ - - + + - - False - 5 - Add Label - False - True - mouse - True - dialog - True - - - - True - False - 2 - - - True - False - end - - - gtk-cancel - True - True - True - True - - - - False - False - 0 - - - - - gtk-ok - True - True - True - True - True - True - - - - False - False - 1 - - - - - False - True - end - 0 - - - - - True - False - 5 - - - True - False - 5 - - - True - False - gtk-add - - - False - False - 0 - - - - - True - False - <b>Add Label</b> - True - - - False - False - 1 - - - - - False - False - 0 - - - - - True - False - - - False - True - 1 - - - - - True - False - 5 - - - True - False - Name: - - - False - False - 0 - - - - - True - True - True - False - False - True - True - - - True - True - 1 - - - - - False - False - 2 - - - - - True - True - 1 - - - - - - + + -1 + 9999 + -1 + 1 + 10 + + + -1 + 9999 + -1 + 1 + 10 + + + -1 + 9999 + -1 + 1 + 10 + + + -1 + 9999 + -1 + 1 + 10 + + + 0.10000000000000001 + 100 + 2 + 1 + 10 + + False 5 Label Options @@ -176,24 +47,25 @@ dialog True - + True False 5 - + True False end - + gtk-cancel + False True True True True - - + + False False @@ -201,21 +73,22 @@ - + gtk-ok + False True True True True - - + + False False 1 - + False True @@ -224,16 +97,16 @@ - + True False 5 - + True False gtk-preferences - + False False @@ -241,20 +114,20 @@ - + True False 0 <b>Label Options</b> True - + False False 1 - + False False @@ -262,10 +135,10 @@ - + True False - + False False @@ -273,23 +146,23 @@ - + True True - + True False 2 0 none - + True False 12 - + True False 5 @@ -297,10 +170,10 @@ 5 5 - + True False - + 3 4 @@ -308,15 +181,15 @@ - + True True False False True True - -1 -1 9999 1 10 0 - + adjustment1 + 1 2 @@ -327,11 +200,11 @@ - + True False KiB/s - + 2 3 @@ -340,15 +213,15 @@ - + True True False False True True - -1 -1 9999 1 10 0 - + adjustment2 + 1 2 @@ -357,12 +230,12 @@ - + True False 0 Upload Slots: - + 2 3 @@ -371,12 +244,12 @@ - + True False 0 Upload Speed: - + 1 2 @@ -385,24 +258,24 @@ - + True False 0 Download Speed: True - + GTK_FILL GTK_FILL - + True False KiB/s - + 2 3 @@ -413,16 +286,16 @@ - + True True False False True True - -1 -1 9999 1 10 0 + adjustment3 True - + 1 2 @@ -433,12 +306,12 @@ - + True False 0 Connections: - + 3 4 @@ -447,16 +320,16 @@ - + True True False False True True - -1 -1 9999 1 10 0 + adjustment4 True - + 1 2 @@ -467,10 +340,10 @@ - + True False - + 2 4 @@ -499,58 +372,55 @@ - + - + - - + + Apply per torrent max settings: + False True True False True - - - label_item - + - + - - + + True False Maximum - + False - tab - + True False 2 0 none - + True False 12 - + True False 4 3 - + True False - + 2 3 @@ -560,26 +430,28 @@ - + Auto Managed + False True True False True - + GTK_FILL - + Stop seed at ratio: + False True True False True - + 1 2 @@ -588,13 +460,14 @@ - + Remove at ratio + False True True False True - + 2 3 @@ -603,16 +476,16 @@ - + True True False False True True - 2 0.10000000000000001 100 1 10 0 + adjustment5 2 - + 1 2 @@ -623,10 +496,10 @@ - + True False - + 2 3 @@ -649,65 +522,63 @@ - + - + - - + + Apply Queue settings: + False True True False True - - - label_item - + - + 1 - - + + True False Queue - + 1 False - tab - + True False 2 0 none - + True False 12 - + True False 3 2 - + Move completed to: + False True True False True - + 2 GTK_FILL @@ -715,10 +586,10 @@ - + True False - + 2 2 @@ -726,11 +597,11 @@ - + True False select-folder - + 1 2 @@ -738,13 +609,13 @@ - + True False False True True - + 1 2 @@ -753,70 +624,67 @@ GTK_FILL - + - + - - + + Apply folder settings: + False True True False True - - - label_item - + - + 2 - - + + True False Folders - + 2 False - tab - + True False 2 0 none - + True False 12 - + True False - + True True automatic automatic in - + True True - tracker1.org - + textbuffer1 + - + True True @@ -824,60 +692,64 @@ - + True False <i>(1 line per tracker)</i> True - + False True 1 - + - + - - + + Automatically apply label: + False True True False True True - - - label_item - + - + 3 - - + + True False Trackers - + 3 False - tab - + True True 3 - + - - + + button4 + button3 + + + + tracker1.org + + diff --git a/deluge/plugins/Label/deluge/plugins/label/data/label_pref.glade b/deluge/plugins/Label/deluge/plugins/label/data/label_pref.ui similarity index 72% rename from deluge/plugins/Label/deluge/plugins/label/data/label_pref.glade rename to deluge/plugins/Label/deluge/plugins/label/data/label_pref.ui index edd0ea7db..4123f33da 100644 --- a/deluge/plugins/Label/deluge/plugins/label/data/label_pref.glade +++ b/deluge/plugins/Label/deluge/plugins/label/data/label_pref.ui @@ -1,55 +1,52 @@ - - + + - + False - + True False 5 - + True False 0 none - + True False 12 - + True False <i>Use the sidebar to add,edit and remove labels. </i> True - + - + - - + + True False <b>Labels</b> True - - - label_item - + - + True True 0 - + - - + + diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py index 213a78566..22446e18f 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py @@ -12,9 +12,8 @@ from __future__ import unicode_literals import logging import os -import gtk -import gtk.glade import pkg_resources # access plugin egg +from gtk import Builder from deluge.ui.client import client @@ -31,9 +30,10 @@ class LabelConfig(object): def load(self): log.debug('Adding Label Preferences page') - self.glade = gtk.glade.XML(self.get_resource('label_pref.glade')) + builder = Builder() + builder.add_from_file(self.get_resource('label_pref.glade')) - self.plugin.add_preferences_page(_('Label'), self.glade.get_widget('label_prefs_box')) + self.plugin.add_preferences_page(_('Label'), builder.get_object('label_prefs_box')) self.plugin.register_hook('on_show_prefs', self.load_settings) self.plugin.register_hook('on_apply_prefs', self.on_apply_prefs) diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py index 07a4f2b1f..e3cf8bd70 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py @@ -13,7 +13,6 @@ from __future__ import unicode_literals import logging import gtk -import gtk.glade import deluge.component as component from deluge.ui.client import client @@ -114,22 +113,20 @@ class AddDialog(object): pass def show(self): - self.glade = gtk.glade.XML(get_resource('label_options.glade')) - self.dialog = self.glade.get_widget('dlg_label_add') + self.builder = gtk.Builder() + self.builder.add_from_file(get_resource('label_add.ui')) + self.dialog = self.builder.get_object('dlg_label_add') self.dialog.set_transient_for(component.get('MainWindow').window) - self.glade.signal_autoconnect({ - 'on_add_ok': self.on_ok, - 'on_add_cancel': self.on_cancel, - }) + self.builder.connect_signals(self) self.dialog.run() - def on_ok(self, event=None): - value = self.glade.get_widget('txt_add').get_text() + def on_add_ok(self, event=None): + value = self.builder.get_object('txt_add').get_text() client.label.add(value) self.dialog.destroy() - def on_cancel(self, event=None): + def on_add_cancel(self, event=None): self.dialog.destroy() @@ -154,19 +151,16 @@ class OptionsDialog(object): def show(self, label): self.label = label - self.glade = gtk.glade.XML(get_resource('label_options.glade')) - self.dialog = self.glade.get_widget('dlg_label_options') + self.builder = gtk.Builder() + self.builder.add_from_file(get_resource('label_options.ui')) + self.dialog = self.builder.get_object('dlg_label_options') self.dialog.set_transient_for(component.get('MainWindow').window) - self.glade.signal_autoconnect({ - 'on_options_ok': self.on_ok, - 'on_options_cancel': self.on_cancel, - }) - + self.builder.connect_signals(self) # Show the label name in the header label - self.glade.get_widget('label_header').set_markup('%s: %s' % (_('Label Options'), self.label)) + self.builder.get_object('label_header').set_markup('%s: %s' % (_('Label Options'), self.label)) for chk_id, group in self.sensitive_groups: - chk = self.glade.get_widget(chk_id) + chk = self.builder.get_object(chk_id) chk.connect('toggled', self.apply_sensitivity) client.label.get_options(self.label).addCallback(self.load_options) @@ -177,40 +171,40 @@ class OptionsDialog(object): log.debug(list(options)) for spin_id in self.spin_ids + self.spin_int_ids: - self.glade.get_widget(spin_id).set_value(options[spin_id]) + self.builder.get_object(spin_id).set_value(options[spin_id]) for chk_id in self.chk_ids: - self.glade.get_widget(chk_id).set_active(bool(options[chk_id])) + self.builder.get_object(chk_id).set_active(bool(options[chk_id])) if client.is_localhost(): - self.glade.get_widget('move_completed_path').set_filename(options['move_completed_path']) - self.glade.get_widget('move_completed_path').show() - self.glade.get_widget('move_completed_path_entry').hide() + self.builder.get_object('move_completed_path').set_filename(options['move_completed_path']) + self.builder.get_object('move_completed_path').show() + self.builder.get_object('move_completed_path_entry').hide() else: - self.glade.get_widget('move_completed_path_entry').set_text(options['move_completed_path']) - self.glade.get_widget('move_completed_path_entry').show() - self.glade.get_widget('move_completed_path').hide() + self.builder.get_object('move_completed_path_entry').set_text(options['move_completed_path']) + self.builder.get_object('move_completed_path_entry').show() + self.builder.get_object('move_completed_path').hide() - self.glade.get_widget('auto_add_trackers').get_buffer().set_text('\n'.join(options['auto_add_trackers'])) + self.builder.get_object('auto_add_trackers').get_buffer().set_text('\n'.join(options['auto_add_trackers'])) self.apply_sensitivity() - def on_ok(self, event=None): + def on_options_ok(self, event=None): 'save options..' options = {} for spin_id in self.spin_ids: - options[spin_id] = self.glade.get_widget(spin_id).get_value() + options[spin_id] = self.builder.get_object(spin_id).get_value() for spin_int_id in self.spin_int_ids: - options[spin_int_id] = self.glade.get_widget(spin_int_id).get_value_as_int() + options[spin_int_id] = self.builder.get_object(spin_int_id).get_value_as_int() for chk_id in self.chk_ids: - options[chk_id] = self.glade.get_widget(chk_id).get_active() + options[chk_id] = self.builder.get_object(chk_id).get_active() if client.is_localhost(): - options['move_completed_path'] = self.glade.get_widget('move_completed_path').get_filename() + options['move_completed_path'] = self.builder.get_object('move_completed_path').get_filename() else: - options['move_completed_path'] = self.glade.get_widget('move_completed_path_entry').get_text() + options['move_completed_path'] = self.builder.get_object('move_completed_path_entry').get_text() - buff = self.glade.get_widget('auto_add_trackers').get_buffer() # sometimes I hate gtk... + buff = self.builder.get_object('auto_add_trackers').get_buffer() # sometimes I hate gtk... tracker_lst = buff.get_text(buff.get_start_iter(), buff.get_end_iter()).strip().split('\n') options['auto_add_trackers'] = [x for x in tracker_lst if x] # filter out empty lines. @@ -220,10 +214,10 @@ class OptionsDialog(object): def apply_sensitivity(self, event=None): for chk_id, sensitive_list in self.sensitive_groups: - chk = self.glade.get_widget(chk_id) + chk = self.builder.get_object(chk_id) sens = chk.get_active() and chk.get_property('sensitive') for widget_id in sensitive_list: - self.glade.get_widget(widget_id).set_sensitive(sens) + self.builder.get_object(widget_id).set_sensitive(sens) - def on_cancel(self, event=None): + def on_options_cancel(self, event=None): self.dialog.destroy()