Inital import of SystemTray
This commit is contained in:
parent
28447f7564
commit
8f62df0732
|
@ -58,6 +58,8 @@ class _ConfigManager:
|
||||||
"""Saves all the configs to disk."""
|
"""Saves all the configs to disk."""
|
||||||
for key in self.config_files.keys():
|
for key in self.config_files.keys():
|
||||||
self.config_files[key].save()
|
self.config_files[key].save()
|
||||||
|
# We need to return True to keep the timer active
|
||||||
|
return True
|
||||||
|
|
||||||
def get_config(self, config_file, defaults=None):
|
def get_config(self, config_file, defaults=None):
|
||||||
"""Get a reference to the Config object for this filename"""
|
"""Get a reference to the Config object for this filename"""
|
||||||
|
|
|
@ -225,6 +225,20 @@ class Core(dbus.service.Object):
|
||||||
if self.torrents.pause(torrent_id):
|
if self.torrents.pause(torrent_id):
|
||||||
self.torrent_paused(torrent_id)
|
self.torrent_paused(torrent_id)
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge")
|
||||||
|
def pause_all_torrents(self):
|
||||||
|
"""Pause all torrents in the session"""
|
||||||
|
if self.torrents.pause_all():
|
||||||
|
# Emit 'torrent_all_paused' signal
|
||||||
|
self.torrent_all_paused()
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge")
|
||||||
|
def resume_all_torrents(self):
|
||||||
|
"""Resume all torrents in the session"""
|
||||||
|
if self.torrents.resume_all():
|
||||||
|
# Emit the 'torrent_all_resumed' signal
|
||||||
|
self.torrent_all_resumed()
|
||||||
|
|
||||||
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
in_signature="s", out_signature="")
|
in_signature="s", out_signature="")
|
||||||
def resume_torrent(self, torrent_id):
|
def resume_torrent(self, torrent_id):
|
||||||
|
@ -282,6 +296,19 @@ class Core(dbus.service.Object):
|
||||||
config = pickle.dumps(config)
|
config = pickle.dumps(config)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
|
in_signature="s",
|
||||||
|
out_signature="ay")
|
||||||
|
def get_config_value(self, key):
|
||||||
|
"""Get the config value for key"""
|
||||||
|
try:
|
||||||
|
value = self.config[key]
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
value = pickle.dumps(value)
|
||||||
|
return value
|
||||||
|
|
||||||
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
@dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
in_signature="ay")
|
in_signature="ay")
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
|
@ -318,10 +345,22 @@ class Core(dbus.service.Object):
|
||||||
"""Emitted when a torrent is paused"""
|
"""Emitted when a torrent is paused"""
|
||||||
log.debug("torrent_paused signal emitted")
|
log.debug("torrent_paused signal emitted")
|
||||||
|
|
||||||
|
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge",
|
||||||
|
signature="s")
|
||||||
def torrent_resumed(self, torrent_id):
|
def torrent_resumed(self, torrent_id):
|
||||||
"""Emitted when a torrent is resumed"""
|
"""Emitted when a torrent is resumed"""
|
||||||
log.debug("torrent_resumed signal emitted")
|
log.debug("torrent_resumed signal emitted")
|
||||||
|
|
||||||
|
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge")
|
||||||
|
def torrent_all_paused(self):
|
||||||
|
"""Emitted when all torrents have been paused"""
|
||||||
|
log.debug("torrent_all_paused signal emitted")
|
||||||
|
|
||||||
|
@dbus.service.signal(dbus_interface="org.deluge_torrent.Deluge")
|
||||||
|
def torrent_all_resumed(self):
|
||||||
|
"""Emitted when all torrents have been resumed"""
|
||||||
|
log.debug("torrent_all_resumed signal emitted")
|
||||||
|
|
||||||
# Config set functions
|
# Config set functions
|
||||||
def on_set_listen_ports(self, key, value):
|
def on_set_listen_ports(self, key, value):
|
||||||
# Only set the listen ports if random_port is not true
|
# Only set the listen ports if random_port is not true
|
||||||
|
|
|
@ -188,6 +188,18 @@ class TorrentManager:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def pause_all(self):
|
||||||
|
"""Pauses all torrents.. Returns a list of torrents paused."""
|
||||||
|
torrent_was_paused = False
|
||||||
|
for key in self.torrents.keys():
|
||||||
|
try:
|
||||||
|
self.torrents[key].handle.pause()
|
||||||
|
torrent_was_paused = True
|
||||||
|
except:
|
||||||
|
log.warning("Unable to pause torrent %s", key)
|
||||||
|
|
||||||
|
return torrent_was_paused
|
||||||
|
|
||||||
def resume(self, torrent_id):
|
def resume(self, torrent_id):
|
||||||
"""Resume a torrent"""
|
"""Resume a torrent"""
|
||||||
try:
|
try:
|
||||||
|
@ -197,6 +209,18 @@ class TorrentManager:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def resume_all(self):
|
||||||
|
"""Resumes all torrents.. Returns a list of torrents resumed"""
|
||||||
|
torrent_was_resumed = False
|
||||||
|
for key in self.torrents.keys():
|
||||||
|
try:
|
||||||
|
self.torrents[key].handle.resume()
|
||||||
|
torrent_was_resumed = True
|
||||||
|
except:
|
||||||
|
log.warning("Unable to resume torrent %s", key)
|
||||||
|
|
||||||
|
return torrent_was_resumed
|
||||||
|
|
||||||
def force_reannounce(self, torrent_id):
|
def force_reannounce(self, torrent_id):
|
||||||
"""Force a tracker reannounce"""
|
"""Force a tracker reannounce"""
|
||||||
try:
|
try:
|
||||||
|
@ -206,7 +230,6 @@ class TorrentManager:
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def load_state(self):
|
def load_state(self):
|
||||||
"""Load the state of the TorrentManager from the torrents.state file"""
|
"""Load the state of the TorrentManager from the torrents.state file"""
|
||||||
state = TorrentManagerState()
|
state = TorrentManagerState()
|
||||||
|
|
|
@ -156,6 +156,14 @@ def get_config(core=None):
|
||||||
config = pickle.loads(config)
|
config = pickle.loads(config)
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
def get_config_value(key, core=None):
|
||||||
|
if core is None:
|
||||||
|
core = get_core()
|
||||||
|
config = core.get_config_value(key)
|
||||||
|
config = "".join(chr(b) for b in config)
|
||||||
|
config = pickle.loads(config)
|
||||||
|
return config
|
||||||
|
|
||||||
def set_config(config, core=None):
|
def set_config(config, core=None):
|
||||||
if config == {}:
|
if config == {}:
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,86 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
<!--Generated with glade3 3.2.2 on Wed Jun 20 16:04:00 2007 by andrew@fractal-->
|
<!--Generated with glade3 3.2.2 on Wed Aug 8 23:27:43 2007 by markybob@peg-->
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
<widget class="GtkMenu" id="torrent_popup">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Size</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="size_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Status</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="status_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Seeders</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="seeders_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem4">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Peers</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="peers_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem5">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Download Speed</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="dl_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem6">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Upload Speed</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="ul_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem7">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Time Remaining</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="eta_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkCheckMenuItem" id="menuitem8">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Share Ratio</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="active">True</property>
|
|
||||||
<signal name="toggled" handler="share_toggle"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<widget class="GtkDialog" id="remove_torrent_dlg">
|
<widget class="GtkDialog" id="remove_torrent_dlg">
|
||||||
<property name="title" translatable="yes">Remove Torrent</property>
|
<property name="title" translatable="yes">Remove Torrent</property>
|
||||||
<property name="destroy_with_parent">True</property>
|
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
<property name="skip_taskbar_hint">True</property>
|
<property name="skip_taskbar_hint">True</property>
|
||||||
<property name="skip_pager_hint">True</property>
|
<property name="skip_pager_hint">True</property>
|
||||||
<property name="has_separator">False</property>
|
<property name="has_separator">False</property>
|
||||||
|
@ -309,14 +234,15 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="GtkDialog" id="rate_dialog">
|
<widget class="GtkDialog" id="speed_dialog">
|
||||||
|
<property name="app_paintable">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="border_width">5</property>
|
<property name="border_width">5</property>
|
||||||
<property name="window_position">GTK_WIN_POS_MOUSE</property>
|
<property name="title" translatable="yes">Speed</property>
|
||||||
<property name="destroy_with_parent">True</property>
|
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||||
<property name="skip_taskbar_hint">True</property>
|
<property name="skip_taskbar_hint">True</property>
|
||||||
<property name="decorated">False</property>
|
<property name="skip_pager_hint">True</property>
|
||||||
<property name="has_separator">False</property>
|
<property name="has_separator">False</property>
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<widget class="GtkVBox" id="dialog-vbox2">
|
<widget class="GtkVBox" id="dialog-vbox2">
|
||||||
|
@ -329,17 +255,16 @@
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="spacing">10</property>
|
<property name="spacing">10</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label2">
|
<widget class="GtkLabel" id="spin_title">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">Rate:</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkSpinButton" id="spin_rate">
|
<widget class="GtkSpinButton" id="spin_speed">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="has_focus">True</property>
|
<property name="has_focus">True</property>
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkCheckMenuItem" id="show_hide_window">
|
<widget class="GtkCheckMenuItem" id="menuitem_show_deluge">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">_Show Deluge</property>
|
<property name="label" translatable="yes">_Show Deluge</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="show_hide_window_toggled"/>
|
<signal name="activate" handler="on_menuitem_show_deluge_activate"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -21,12 +21,12 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="add_torrent">
|
<widget class="GtkImageMenuItem" id="menuitem_add_torrent">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">_Add Torrent</property>
|
<property name="label" translatable="yes">_Add Torrent</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="add_torrent"/>
|
<signal name="activate" handler="on_menuitem_add_torrent_activate"/>
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="menu-item-image1">
|
<widget class="GtkImage" id="menu-item-image1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -38,17 +38,40 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="clear_finished">
|
<widget class="GtkSeparatorMenuItem" id="separatormenuitem5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">_Clear Finished</property>
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="menuitem_pause_all">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">_Pause All</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="clear_finished"/>
|
<signal name="activate" handler="on_menuitem_pause_all_activate"/>
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="menu-item-image2">
|
<widget class="GtkImage" id="menu-item-image6">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="stock">gtk-clear</property>
|
<property name="stock">gtk-media-pause</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="menuitem_resume_all">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">_Resume All</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_menuitem_resume_all_activate"/>
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="menu-item-image7">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="stock">gtk-media-play</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
@ -61,17 +84,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="download_limit">
|
<widget class="GtkImageMenuItem" id="menuitem_download_limit">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">_Download Limit</property>
|
<property name="label" translatable="yes">_Download Speed Limit</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<child>
|
|
||||||
<widget class="GtkMenu" id="menu1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="download-limit-image">
|
<widget class="GtkImage" id="download-limit-image">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -83,10 +100,10 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="upload_limit">
|
<widget class="GtkImageMenuItem" id="menuitem_upload_limit">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">_Upload Limit</property>
|
<property name="label" translatable="yes">_Upload Speed Limit</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="upload-limit-image">
|
<widget class="GtkImage" id="upload-limit-image">
|
||||||
|
@ -105,45 +122,12 @@
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="preferences">
|
<widget class="GtkImageMenuItem" id="menuitem_quit">
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label">gtk-preferences</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<property name="use_stock">True</property>
|
|
||||||
<signal name="activate" handler="preferences"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="plugins">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Plu_gins</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="plugins"/>
|
|
||||||
<child internal-child="image">
|
|
||||||
<widget class="GtkImage" id="menu-item-image3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="stock">gtk-disconnect</property>
|
|
||||||
<property name="icon_size">1</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImageMenuItem" id="quit">
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="label" translatable="yes">_Quit</property>
|
<property name="label" translatable="yes">_Quit</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="quit"/>
|
<signal name="activate" handler="on_menuitem_quit_activate"/>
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="menu-item-image4">
|
<widget class="GtkImage" id="menu-item-image4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -63,7 +63,9 @@ DEFAULT_PREFS = {
|
||||||
"window_x_pos": 0,
|
"window_x_pos": 0,
|
||||||
"window_y_pos": 0,
|
"window_y_pos": 0,
|
||||||
"window_width": 640,
|
"window_width": 640,
|
||||||
"window_height": 480
|
"window_height": 480,
|
||||||
|
"tray_download_speed_list" : [5.0, 10.0, 30.0, 80.0, 300.0],
|
||||||
|
"tray_upload_speed_list" : [5.0, 10.0, 30.0, 80.0, 300.0]
|
||||||
}
|
}
|
||||||
|
|
||||||
class GtkUI:
|
class GtkUI:
|
||||||
|
|
|
@ -43,6 +43,7 @@ from toolbar import ToolBar
|
||||||
from torrentview import TorrentView
|
from torrentview import TorrentView
|
||||||
from torrentdetails import TorrentDetails
|
from torrentdetails import TorrentDetails
|
||||||
from preferences import Preferences
|
from preferences import Preferences
|
||||||
|
from systemtray import SystemTray
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
@ -74,6 +75,7 @@ class MainWindow:
|
||||||
self.torrentview = TorrentView(self)
|
self.torrentview = TorrentView(self)
|
||||||
self.torrentdetails = TorrentDetails(self)
|
self.torrentdetails = TorrentDetails(self)
|
||||||
self.preferences = Preferences(self)
|
self.preferences = Preferences(self)
|
||||||
|
self.systemtray = SystemTray(self)
|
||||||
|
|
||||||
gobject.timeout_add(1000, self.update)
|
gobject.timeout_add(1000, self.update)
|
||||||
|
|
||||||
|
@ -86,11 +88,22 @@ class MainWindow:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
self.window.show_all()
|
self.window.show()
|
||||||
|
|
||||||
def hide(self):
|
def hide(self):
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
||||||
|
def present(self):
|
||||||
|
self.window.present()
|
||||||
|
|
||||||
|
def active(self):
|
||||||
|
"""Returns True if the window is active, False if not."""
|
||||||
|
return self.window.is_active()
|
||||||
|
|
||||||
|
def visible(self):
|
||||||
|
"""Returns True if window is visible, False if not."""
|
||||||
|
return self.window.get_property("visible")
|
||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
del self.menubar
|
del self.menubar
|
||||||
del self.toolbar
|
del self.toolbar
|
||||||
|
|
|
@ -42,6 +42,11 @@ class Signals:
|
||||||
self.core.connect_to_signal("torrent_removed",
|
self.core.connect_to_signal("torrent_removed",
|
||||||
self.torrent_removed_signal)
|
self.torrent_removed_signal)
|
||||||
self.core.connect_to_signal("torrent_paused", self.torrent_paused)
|
self.core.connect_to_signal("torrent_paused", self.torrent_paused)
|
||||||
|
self.core.connect_to_signal("torrent_resumed", self.torrent_resumed)
|
||||||
|
self.core.connect_to_signal("torrent_all_paused",
|
||||||
|
self.torrent_all_paused)
|
||||||
|
self.core.connect_to_signal("torrent_all_resumed",
|
||||||
|
self.torrent_all_resumed)
|
||||||
|
|
||||||
def torrent_added_signal(self, torrent_id):
|
def torrent_added_signal(self, torrent_id):
|
||||||
log.debug("torrent_added signal received..")
|
log.debug("torrent_added signal received..")
|
||||||
|
@ -58,3 +63,15 @@ class Signals:
|
||||||
def torrent_paused(self, torrent_id):
|
def torrent_paused(self, torrent_id):
|
||||||
log.debug("torrent_paused signal received..")
|
log.debug("torrent_paused signal received..")
|
||||||
self.ui.mainwindow.torrentview.update()
|
self.ui.mainwindow.torrentview.update()
|
||||||
|
|
||||||
|
def torrent_resumed(self, torrent_id):
|
||||||
|
log.debug("torrent_resumed signal received..")
|
||||||
|
self.ui.mainwindow.torrentview.update()
|
||||||
|
|
||||||
|
def torrent_all_paused(self):
|
||||||
|
log.debug("torrent_all_paused signal received..")
|
||||||
|
self.ui.mainwindow.torrentview.update()
|
||||||
|
|
||||||
|
def torrent_all_resumed(self):
|
||||||
|
log.debug("torrent_all_resumed signal received..")
|
||||||
|
self.ui.mainwindow.torrentview.update()
|
||||||
|
|
Loading…
Reference in New Issue