Updates and revert mainwindow.py from last change

This commit is contained in:
Andrew Resch 2007-08-02 18:52:33 +00:00
parent bcf70c3e0f
commit 7cd0ba0a6c
7 changed files with 957 additions and 2069 deletions

View File

@ -128,6 +128,13 @@ class Core(dbus.service.Object):
if self.torrents.pause(torrent_id):
self.torrent_paused(torrent_id)
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="s", out_signature="")
def resume_torrent(self, torrent_id):
log.debug("Resuming torrent %s", torrent_id)
if self.torrents.resume(torrent_id):
self.torrent_resumed(torrent_id)
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="sas",
out_signature="ay")
@ -200,3 +207,7 @@ class Core(dbus.service.Object):
def torrent_paused(self, torrent_id):
"""Emitted when a torrent is paused"""
log.debug("torrent_paused signal emitted")
def torrent_resumed(self, torrent_id):
"""Emitted when a torrent is resumed"""
log.debug("torrent_resumed signal emitted")

View File

@ -135,7 +135,13 @@ class TorrentManager:
return True
def resume(self, torrent_id):
pass
"""Resume a torrent"""
try:
self.torrents[torrent_id].handle.resume()
except:
return False
return True
def save_state(self):
"""Save the state of the TorrentManager to the torrents.state file"""

View File

@ -97,6 +97,12 @@ def pause_torrent(torrent_ids):
for torrent_id in torrent_ids:
core.pause_torrent(torrent_id)
def resume_torrent(torrent_ids):
"""Resume torrent_ids"""
core = get_core()
for torrent_id in torrent_ids:
core.resume_torrent(torrent_id)
def queue_top(torrent_ids):
"""Attempts to queue all torrent_ids to the top"""
log.debug("Attempting to queue to top these torrents: %s", torrent_ids)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,7 @@ class MenuBar:
self.torrentmenu.signal_autoconnect({
## Torrent Menu
"on_menuitem_pause_activate": self.on_menuitem_pause_activate,
"on_menuitem_resume_activate": self.on_menuitem_resume_activate,
"on_menuitem_updatetracker_activate": \
self.on_menuitem_updatetracker_activate,
"on_menuitem_edittrackers_activate": \
@ -127,6 +128,11 @@ class MenuBar:
functions.pause_torrent(
self.window.torrentview.get_selected_torrents())
def on_menuitem_resume_activate(self, data=None):
log.debug("on_menuitem_resume_activate")
functions.resume_torrent(
self.window.torrentview.get_selected_torrents())
def on_menuitem_updatetracker_activate(self, data=None):
log.debug("on_menuitem_updatetracker_activate")

View File

@ -51,6 +51,7 @@ class ToolBar:
"on_toolbutton_remove_clicked": self.on_toolbutton_remove_clicked,
"on_toolbutton_clear_clicked": self.on_toolbutton_clear_clicked,
"on_toolbutton_pause_clicked": self.on_toolbutton_pause_clicked,
"on_toolbutton_resume_clicked": self.on_toolbutton_resume_clicked,
"on_toolbutton_queueup_clicked": \
self.on_toolbutton_queueup_clicked,
"on_toolbutton_queuedown_clicked": \
@ -82,6 +83,11 @@ class ToolBar:
# Use the menubar's callbacks
self.window.menubar.on_menuitem_pause_activate(data)
def on_toolbutton_resume_clicked(self, data):
log.debug("on_toolbutton_resume_clicked")
# Use the menubar's calbacks
self.window.menubar.on_menuitem_resume_activate(data)
def on_toolbutton_queueup_clicked(self, data):
log.debug("on_toolbutton_queueup_clicked")
# Use the menubar's callbacks