Updates and revert mainwindow.py from last change
This commit is contained in:
parent
bcf70c3e0f
commit
7cd0ba0a6c
|
@ -127,6 +127,13 @@ class Core(dbus.service.Object):
|
|||
log.debug("Pausing torrent %s", torrent_id)
|
||||
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",
|
||||
|
@ -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")
|
||||
|
|
|
@ -135,8 +135,14 @@ 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"""
|
||||
state = TorrentManagerState()
|
||||
|
|
|
@ -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
|
@ -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": \
|
||||
|
@ -126,6 +127,11 @@ class MenuBar:
|
|||
log.debug("on_menuitem_pause_activate")
|
||||
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")
|
||||
|
|
|
@ -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": \
|
||||
|
@ -81,6 +82,11 @@ class ToolBar:
|
|||
log.debug("on_toolbutton_pause_clicked")
|
||||
# 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")
|
||||
|
|
Loading…
Reference in New Issue