mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-11 03:55:43 +00:00
-
This commit is contained in:
parent
b846dc00bd
commit
745872efde
@ -16,7 +16,6 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolbar" id="tb_left">
|
<widget class="GtkToolbar" id="tb_left">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
|
|
||||||
<property name="show_arrow">False</property>
|
<property name="show_arrow">False</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolButton" id="toolbutton_add">
|
<widget class="GtkToolButton" id="toolbutton_add">
|
||||||
@ -58,13 +57,22 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolButton" id="toolbutton_update">
|
<widget class="GtkSeparatorToolItem" id="separatortoolitem1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="tooltip" translatable="yes">Update Tracker</property>
|
</widget>
|
||||||
<property name="label">Update Tracker</property>
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="homogeneous">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkToolButton" id="toolbutton_pause">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Start / Pause</property>
|
||||||
|
<property name="label">Start / Pause</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-refresh</property>
|
<property name="stock_id">gtk-media-play</property>
|
||||||
<signal name="clicked" handler="update_tracker"/>
|
<signal name="clicked" handler="start_pause"/>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -421,25 +421,28 @@ class Manager:
|
|||||||
# ___ALL queuing code should be in this function, and ONLY here___
|
# ___ALL queuing code should be in this function, and ONLY here___
|
||||||
def apply_queue(self, efficient = True):
|
def apply_queue(self, efficient = True):
|
||||||
# Handle autoseeding - downqueue as needed
|
# Handle autoseeding - downqueue as needed
|
||||||
|
try:
|
||||||
|
if self.auto_seed_ratio != -1:
|
||||||
|
for unique_ID in self.unique_IDs:
|
||||||
|
if self.get_core_torrent_state(unique_ID, efficient)['is_seed']:
|
||||||
|
torrent_state = self.get_core_torrent_state(unique_ID, efficient)
|
||||||
|
ratio = self.calc_ratio(unique_ID, torrent_state)
|
||||||
|
if ratio >= self.auto_seed_ratio:
|
||||||
|
self.queue_bottom(unique_ID)
|
||||||
|
|
||||||
if self.auto_seed_ratio != -1:
|
|
||||||
for unique_ID in self.unique_IDs:
|
|
||||||
if self.get_core_torrent_state(unique_ID, efficient)['is_seed']:
|
|
||||||
torrent_state = self.get_core_torrent_state(unique_ID, efficient)
|
|
||||||
ratio = self.calc_ratio(unique_ID, torrent_state)
|
|
||||||
if ratio >= self.auto_seed_ratio:
|
|
||||||
self.queue_bottom(unique_ID)
|
|
||||||
|
|
||||||
# Pause and resume torrents
|
# Pause and resume torrents
|
||||||
for index in range(len(self.state.queue)):
|
for index in range(len(self.state.queue)):
|
||||||
unique_ID = self.state.queue[index]
|
unique_ID = self.state.queue[index]
|
||||||
if (index < self.state.max_active_torrents or self.state_max_active_torrents == -1) \
|
if (index < self.state.max_active_torrents or self.state_max_active_torrents == -1) \
|
||||||
and self.get_core_torrent_state(unique_ID, efficient)['is_paused'] \
|
and self.get_core_torrent_state(unique_ID, efficient)['is_paused'] \
|
||||||
and not self.is_user_paused(unique_ID):
|
and not self.is_user_paused(unique_ID):
|
||||||
deluge_core.resume(unique_ID)
|
deluge_core.resume(unique_ID)
|
||||||
elif not self.get_core_torrent_state(unique_ID, efficient)['is_paused'] and \
|
elif not self.get_core_torrent_state(unique_ID, efficient)['is_paused'] and \
|
||||||
(index >= self.state.max_active_torrents or self.is_user_paused(unique_ID)):
|
(index >= self.state.max_active_torrents or self.is_user_paused(unique_ID)):
|
||||||
deluge_core.pause(unique_ID)
|
deluge_core.pause(unique_ID)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Event handling
|
# Event handling
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ class DelugeGTK:
|
|||||||
## Help Menu
|
## Help Menu
|
||||||
"show_about_dialog": self.show_about_dialog,
|
"show_about_dialog": self.show_about_dialog,
|
||||||
## Toolbar
|
## Toolbar
|
||||||
|
"start_pause": self.start_pause,
|
||||||
"update_tracker": self.update_tracker,
|
"update_tracker": self.update_tracker,
|
||||||
"clear_finished": self.clear_finished,
|
"clear_finished": self.clear_finished,
|
||||||
"queue_up": self.q_torrent_up,
|
"queue_up": self.q_torrent_up,
|
||||||
@ -329,6 +330,11 @@ class DelugeGTK:
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def start_pause(self, widget):
|
||||||
|
print "Pause btn clicked"
|
||||||
|
unique_id = self.get_selected_torrent()
|
||||||
|
self.manager.set_user_pause(unique_id, not self.manager.is_user_paused(unique_id))
|
||||||
|
|
||||||
def build_summary_tab(self):
|
def build_summary_tab(self):
|
||||||
#Torrent Summary tab
|
#Torrent Summary tab
|
||||||
# Look into glade's widget prefix function
|
# Look into glade's widget prefix function
|
||||||
@ -586,6 +592,11 @@ class DelugeGTK:
|
|||||||
if not self.torrent_model.iter_is_valid(itr):
|
if not self.torrent_model.iter_is_valid(itr):
|
||||||
itr = None
|
itr = None
|
||||||
|
|
||||||
|
if self.manager.is_user_paused(self.get_selected_torrent()):
|
||||||
|
self.wtree.get_widget("toolbutton_pause").set_stock_id(gtk.STOCK_MEDIA_PLAY)
|
||||||
|
else:
|
||||||
|
self.wtree.get_widget("toolbutton_pause").set_stock_id(gtk.STOCK_MEDIA_PAUSE)
|
||||||
|
|
||||||
self.saved_peer_info = None
|
self.saved_peer_info = None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user