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> <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>

View File

@ -421,7 +421,7 @@ 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: if self.auto_seed_ratio != -1:
for unique_ID in self.unique_IDs: for unique_ID in self.unique_IDs:
if self.get_core_torrent_state(unique_ID, efficient)['is_seed']: if self.get_core_torrent_state(unique_ID, efficient)['is_seed']:
@ -430,6 +430,7 @@ class Manager:
if ratio >= self.auto_seed_ratio: if ratio >= self.auto_seed_ratio:
self.queue_bottom(unique_ID) 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]
@ -440,6 +441,8 @@ class Manager:
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

View File

@ -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