summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pinto <markybob@dipconsultants.com>2007-10-18 23:15:52 +0000
committerMarcos Pinto <markybob@dipconsultants.com>2007-10-18 23:15:52 +0000
commit589c007386a91dd1816830b29570fd20a3105f16 (patch)
treefc806c95d3c9bd0d0e3e53c141a0e9b9918d47d9
parentc70721aeac4850262eb7488ff8bbfce511b4670c (diff)
downloaddeluge-589c007386a91dd1816830b29570fd20a3105f16.tar.gz
deluge-589c007386a91dd1816830b29570fd20a3105f16.tar.bz2
deluge-589c007386a91dd1816830b29570fd20a3105f16.zip
windows tweaks to prevent error on win32
-rw-r--r--plugins/TorrentNotification/__init__.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/plugins/TorrentNotification/__init__.py b/plugins/TorrentNotification/__init__.py
index 65ad0cf0c..bd8e3fc03 100644
--- a/plugins/TorrentNotification/__init__.py
+++ b/plugins/TorrentNotification/__init__.py
@@ -32,6 +32,7 @@ def enable(core, interface):
### The Plugin ###
import deluge
+import deluge.common
import gtk
class TorrentNotification:
@@ -48,11 +49,18 @@ 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,
- defaults={'enable_tray_blink' : True,
- 'enable_notification' : True,
- 'enable_sound' : False,
- 'sound_path' : os.path.expanduser("~/")})
+ if deluge.common.windows_check():
+ self.config = deluge.pref.Preferences(self.config_file, False,
+ defaults={'enable_tray_blink' : True,
+ 'enable_notification' : False,
+ 'enable_sound' : False,
+ 'sound_path' : os.path.expanduser("~")})
+ else:
+ 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:
@@ -88,10 +96,8 @@ class TorrentNotification:
self.interface.tray_icon.set_blinking(True)
def show_notification(self, event):
- import platform
- if platform.system() != "Windows":
+ if not deluge.common.windows_check():
import pynotify
-
file_info = self.interface.manager.get_torrent_file_info(event['unique_ID'])
filelist = ""
for file in file_info[:10]:
@@ -133,8 +139,7 @@ class TorrentNotification:
self.glade.get_widget("sound_path_button").set_sensitive(value)
def play_sound(self):
- import platform
- if platform.system() != "Windows":
+ if not deluge.common.windows_check():
import pygame
import os.path
import sys