From 90320ff36d428ccb6a8a61964dc8401a3c4a1608 Mon Sep 17 00:00:00 2001
From: Doadin <tbkizle@gmail.com>
Date: Sun, 6 Jul 2014 22:16:23 -0400
Subject: [PATCH] [GTKUI] Add Options for super_seeding
---
deluge/ui/gtkui/glade/main_window.tabs.ui | 16 ++++++++++++++++
deluge/ui/gtkui/glade/torrent_menu.options.ui | 9 +++++++++
deluge/ui/gtkui/menubar.py | 19 +++++++++++++++++++
deluge/ui/gtkui/options_tab.py | 16 ++++++++++++++++
4 files changed, 60 insertions(+)
diff --git a/deluge/ui/gtkui/glade/main_window.tabs.ui b/deluge/ui/gtkui/glade/main_window.tabs.ui
index ddc9ca1..3e1b6eb 100644
a
|
b
|
|
1778 | 1778 | <property name="fill">True</property> |
1779 | 1779 | <property name="position">1</property> |
1780 | 1780 | </packing> |
| 1781 | <child> |
| 1782 | <object class="GtkCheckButton" id="chk_super_seeding"> |
| 1783 | <property name="label" translatable="yes">Super Seeding</property> |
| 1784 | <property name="use_action_appearance">False</property> |
| 1785 | <property name="visible">True</property> |
| 1786 | <property name="can_focus">True</property> |
| 1787 | <property name="receives_default">False</property> |
| 1788 | <property name="draw_indicator">True</property> |
| 1789 | <signal name="toggled" handler="on_chk_toggled" swapped="no"/> |
| 1790 | </object> |
| 1791 | <packing> |
| 1792 | <property name="expand">False</property> |
| 1793 | <property name="fill">False</property> |
| 1794 | <property name="position">0</property> |
| 1795 | </packing> |
| 1796 | </child> |
1781 | 1797 | </child> |
1782 | 1798 | </object> |
1783 | 1799 | </child> |
diff --git a/deluge/ui/gtkui/glade/torrent_menu.options.ui b/deluge/ui/gtkui/glade/torrent_menu.options.ui
index 2044679..4cefb8c 100644
a
|
b
|
|
79 | 79 | </object> |
80 | 80 | </child> |
81 | 81 | <child> |
| 82 | <object class="GtkMenuItem" id="menuitem_super_seeding"> |
| 83 | <property name="visible">True</property> |
| 84 | <property name="can_focus">False</property> |
| 85 | <property name="use_action_appearance">False</property> |
| 86 | <property name="label" translatable="yes">_Super Seeding</property> |
| 87 | <property name="use_underline">True</property> |
| 88 | </object> |
| 89 | </child> |
| 90 | <child> |
82 | 91 | <object class="GtkMenuItem" id="menuitem_change_owner"> |
83 | 92 | <property name="visible">True</property> |
84 | 93 | <property name="can_focus">False</property> |
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index 0501681..eaf8b68 100644
a
|
b
|
def __init__(self):
|
118 | 118 | submenu.append(item) |
119 | 119 | submenu.show_all() |
120 | 120 | self.builder.get_object("menuitem_stop_seed_at_ratio").set_submenu(submenu) |
| 121 | |
| 122 | submenu = gtk.Menu() |
| 123 | item = gtk.MenuItem(_("Disable")) |
| 124 | item.connect("activate", self.on_menuitem_set_super_seeding_disable) |
| 125 | submenu.append(item) |
| 126 | item = gtk.MenuItem(_("Enable...")) |
| 127 | item.set_name("menuitem_super_seeding") |
| 128 | item.connect("activate", self.on_menuitem_set_super_seeding_enable) |
| 129 | submenu.append(item) |
| 130 | submenu.show_all() |
| 131 | self.builder.get_object("menuitem_super_seeding").set_submenu(submenu) |
121 | 132 | |
122 | 133 | self.torrentmenu = self.builder.get_object("torrent_menu") |
123 | 134 | self.menu_torrent = self.main_builder.get_object("menu_torrent") |
… |
… |
def on_menuitem_set_automanaged_off(self, widget):
|
492 | 503 | def on_menuitem_set_stop_seed_at_ratio_disable(self, widget): |
493 | 504 | client.core.set_torrent_options(component.get("TorrentView").get_selected_torrents(), |
494 | 505 | {"stop_at_ratio": False}) |
| 506 | |
| 507 | def on_menuitem_set_super_seeding_disable(self, widget): |
| 508 | client.core.set_torrent_options(component.get("TorrentView").get_selected_torrents(), |
| 509 | {"super_seeding": False}) |
| 510 | |
| 511 | def on_menuitem_set_super_seeding_enable(self, widget): |
| 512 | client.core.set_torrent_options(component.get("TorrentView").get_selected_torrents(), |
| 513 | {"super_seeding": True}) |
495 | 514 | |
496 | 515 | def on_menuitem_sidebar_zero_toggled(self, widget): |
497 | 516 | self.config["sidebar_show_zero"] = widget.get_active() |
diff --git a/deluge/ui/gtkui/options_tab.py b/deluge/ui/gtkui/options_tab.py
index 5595bae..e134ad5 100644
a
|
b
|
def __init__(self):
|
60 | 60 | self.chk_stop_at_ratio = builder.get_object("chk_stop_at_ratio") |
61 | 61 | self.chk_remove_at_ratio = builder.get_object("chk_remove_at_ratio") |
62 | 62 | self.spin_stop_ratio = builder.get_object("spin_stop_ratio") |
| 63 | self.chk_super_seeding = builder.get_object("chk_super_seeding") |
63 | 64 | self.chk_move_completed = builder.get_object("chk_move_completed") |
64 | 65 | self.entry_move_completed = builder.get_object("entry_move_completed") |
65 | 66 | self.chk_shared = builder.get_object("chk_shared") |
… |
… |
def update(self):
|
123 | 124 | "stop_at_ratio", |
124 | 125 | "stop_ratio", |
125 | 126 | "remove_at_ratio", |
| 127 | "super_seeding", |
126 | 128 | "storage_mode", |
127 | 129 | "sequential_download", |
128 | 130 | "move_on_completed", |
… |
… |
def _on_get_torrent_status(self, status):
|
162 | 164 | self.spin_stop_ratio.set_value(status["stop_ratio"]) |
163 | 165 | if status["remove_at_ratio"] != self.prev_status["remove_at_ratio"]: |
164 | 166 | self.chk_remove_at_ratio.set_active(status["remove_at_ratio"]) |
| 167 | if status["super_seeding"] != self.prev_status["super_seeding"]: |
| 168 | self.chk_super_seeding.set_active(status["super_seeding"]) |
165 | 169 | if status["move_on_completed"] != self.prev_status["move_on_completed"]: |
166 | 170 | self.chk_move_completed.set_active(status["move_on_completed"]) |
167 | 171 | if status["move_on_completed_path"] != self.prev_status["move_on_completed_path"]: |
… |
… |
def _on_button_apply_clicked(self, button):
|
237 | 241 | client.core.set_torrent_remove_at_ratio( |
238 | 242 | self.prev_torrent_id, self.chk_remove_at_ratio.get_active() |
239 | 243 | ) |
| 244 | if self.chk_super_seeding.get_active () != self.prev_status["super_seeing"]: |
| 245 | client.core.set_super_seeding( |
| 246 | self.prev_torrent_id, self.chk_super_seeding.get_active() |
| 247 | ) |
240 | 248 | if self.chk_move_completed.get_active() != self.prev_status["move_on_completed"]: |
241 | 249 | client.core.set_torrent_move_completed( |
242 | 250 | self.prev_torrent_id, self.chk_move_completed.get_active() |
… |
… |
def _on_chk_stop_at_ratio_toggled(self, widget):
|
275 | 283 | |
276 | 284 | if not self.button_apply.is_sensitive(): |
277 | 285 | self.button_apply.set_sensitive(True) |
| 286 | |
| 287 | def _on_chk_super_seeding_toggled(self, widget): |
| 288 | value = widget.get_active() |
| 289 | |
| 290 | self.chk_super_seeding.set_sensitive(value) |
| 291 | |
| 292 | if not self.button_apply.is_sensitive(): |
| 293 | self.button_apply.set_sensitive(True) |
278 | 294 | |
279 | 295 | def _on_chk_toggled(self, widget): |
280 | 296 | if not self.button_apply.is_sensitive(): |