This commit is contained in:
Zach Tibbitts 2007-02-27 00:47:22 +00:00
parent b846dc00bd
commit 745872efde
3 changed files with 45 additions and 23 deletions

View File

@ -16,7 +16,6 @@
<child>
<widget class="GtkToolbar" id="tb_left">
<property name="visible">True</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
<property name="show_arrow">False</property>
<child>
<widget class="GtkToolButton" id="toolbutton_add">
@ -58,13 +57,22 @@
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_update">
<widget class="GtkSeparatorToolItem" id="separatortoolitem1">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Update Tracker</property>
<property name="label">Update Tracker</property>
</widget>
<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="stock_id">gtk-refresh</property>
<signal name="clicked" handler="update_tracker"/>
<property name="stock_id">gtk-media-play</property>
<signal name="clicked" handler="start_pause"/>
</widget>
<packing>
<property name="expand">False</property>

View File

@ -421,25 +421,28 @@ class Manager:
# ___ALL queuing code should be in this function, and ONLY here___
def apply_queue(self, efficient = True):
# 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
for index in range(len(self.state.queue)):
unique_ID = self.state.queue[index]
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 not self.is_user_paused(unique_ID):
deluge_core.resume(unique_ID)
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)):
deluge_core.pause(unique_ID)
# Pause and resume torrents
for index in range(len(self.state.queue)):
unique_ID = self.state.queue[index]
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 not self.is_user_paused(unique_ID):
deluge_core.resume(unique_ID)
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)):
deluge_core.pause(unique_ID)
except AttributeError:
pass
# Event handling

View File

@ -140,6 +140,7 @@ class DelugeGTK:
## Help Menu
"show_about_dialog": self.show_about_dialog,
## Toolbar
"start_pause": self.start_pause,
"update_tracker": self.update_tracker,
"clear_finished": self.clear_finished,
"queue_up": self.q_torrent_up,
@ -329,6 +330,11 @@ class DelugeGTK:
else:
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):
#Torrent Summary tab
# Look into glade's widget prefix function
@ -586,6 +592,11 @@ class DelugeGTK:
if not self.torrent_model.iter_is_valid(itr):
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