mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
cleanup
This commit is contained in:
parent
fc5af09660
commit
462ad22c61
2 changed files with 45 additions and 49 deletions
|
@ -38,6 +38,7 @@ class TorrentNotification:
|
|||
|
||||
def __init__(self, path, core, interface):
|
||||
print "Loading TorrentNotification plugin..."
|
||||
import os.path
|
||||
self.path = path
|
||||
self.core = core
|
||||
self.interface = interface
|
||||
|
@ -47,11 +48,14 @@ class TorrentNotification:
|
|||
|
||||
# Create an options file and try to load existing Values
|
||||
self.config_file = deluge.common.CONFIG_DIR + "/notification.conf"
|
||||
self.config = deluge.pref.Preferences(self.config_file, False)
|
||||
self.config = deluge.pref.Preferences(self.config_file, False,
|
||||
defaults={'enable_tray_blink' : True,
|
||||
'enable_notification' : True,
|
||||
'enable_sound' : False,
|
||||
'sound_path' : os.path.expanduser("~/")})
|
||||
try:
|
||||
self.config.load()
|
||||
except IOError:
|
||||
# File does not exist
|
||||
pass
|
||||
|
||||
self.glade = gtk.glade.XML(path + "/notification_preferences.glade")
|
||||
|
@ -102,18 +106,11 @@ class TorrentNotification:
|
|||
|
||||
def configure(self, window):
|
||||
import os.path
|
||||
try:
|
||||
self.glade.get_widget("chk_tray_blink").set_active(self.config.get("enable_tray_blink"))
|
||||
self.glade.get_widget("chk_notification").set_active(self.config.get("enable_notification"))
|
||||
self.glade.get_widget("chk_sound").set_active(self.config.get("enable_sound"))
|
||||
self.glade.get_widget("sound_path_button").set_sensitive(self.config.get("enable_sound"))
|
||||
self.glade.get_widget("sound_path_button").set_filename(self.config.get("sound_path"))
|
||||
except:
|
||||
self.glade.get_widget("chk_tray_blink").set_active(False)
|
||||
self.glade.get_widget("chk_notification").set_active(False)
|
||||
self.glade.get_widget("chk_sound").set_active(False)
|
||||
self.glade.get_widget("sound_path_button").set_filename(os.path.expanduser("~/"))
|
||||
self.glade.get_widget("sound_path_button").set_sensitive(False)
|
||||
self.glade.get_widget("chk_tray_blink").set_active(self.config.get("enable_tray_blink"))
|
||||
self.glade.get_widget("chk_notification").set_active(self.config.get("enable_notification"))
|
||||
self.glade.get_widget("chk_sound").set_active(self.config.get("enable_sound"))
|
||||
self.glade.get_widget("sound_path_button").set_sensitive(self.config.get("enable_sound"))
|
||||
self.glade.get_widget("sound_path_button").set_filename(self.config.get("sound_path"))
|
||||
self.dialog.set_transient_for(window)
|
||||
self.dialog.show()
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<property name="title" translatable="yes">Torrent Notification Preferences</property>
|
||||
<property name="default_width">400</property>
|
||||
<property name="default_height">150</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="skip_pager_hint">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
@ -17,42 +17,10 @@
|
|||
<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 | GDK_ENTER_NOTIFY_MASK</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="dialog-hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_sound">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Enable event sound (requires pygame)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="sound_path_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_rows">3</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_notification">
|
||||
<property name="visible">True</property>
|
||||
|
@ -77,11 +45,42 @@
|
|||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<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>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="chk_sound">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Enable event sound (requires pygame)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="toggle_ui"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkFileChooserButton" id="sound_path_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
|
|
Loading…
Add table
Reference in a new issue