mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-05 08:03:40 +00:00
windows tweaks
This commit is contained in:
parent
ccf5f91dc2
commit
da60769933
@ -94,7 +94,11 @@ class FilesTabManager(FilesBaseManager):
|
||||
convert_path_to_child_path(path)
|
||||
file_name = self.file_store.get_value(
|
||||
self.file_store.get_iter(child_path), 0)
|
||||
exec_command(self.file_viewer,
|
||||
import platform
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
os.startfile(os.path.join(save_dir, file_name))
|
||||
else:
|
||||
exec_command(self.file_viewer,
|
||||
os.path.join(save_dir, file_name))
|
||||
except KeyError:
|
||||
pass
|
||||
|
@ -33,13 +33,11 @@
|
||||
import gettext
|
||||
import locale
|
||||
import os
|
||||
import platform
|
||||
|
||||
from common import INSTALL_PREFIX
|
||||
import common
|
||||
|
||||
APP = 'deluge'
|
||||
DIR = os.path.join(INSTALL_PREFIX, 'share', 'locale')
|
||||
if not platform.system() in ('Windows', 'Microsoft'):
|
||||
DIR = os.path.join(common.INSTALL_PREFIX, 'share', 'locale')
|
||||
if not common.windows_check():
|
||||
locale.setlocale(locale.LC_MESSAGES, '')
|
||||
locale.bindtextdomain(APP, DIR)
|
||||
locale.textdomain(APP)
|
||||
|
@ -36,8 +36,15 @@ PROGRAM_VERSION = "0.5.5.95"
|
||||
|
||||
CLIENT_CODE = "DE"
|
||||
CLIENT_VERSION = "".join(PROGRAM_VERSION.split('.'))+"0"*(4 - len(PROGRAM_VERSION.split('.')))
|
||||
import platform
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
|
||||
def windows_check():
|
||||
import platform
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
if windows_check():
|
||||
CONFIG_DIR = os.path.join(os.path.expanduser("~\\"), 'deluge')
|
||||
if not os.path.exists(CONFIG_DIR):
|
||||
os.mkdir(CONFIG_DIR)
|
||||
@ -135,8 +142,7 @@ def get_pixmap(fname):
|
||||
|
||||
def get_logo(size):
|
||||
import gtk
|
||||
import platform
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
if windows_check():
|
||||
return gtk.gdk.pixbuf_new_from_file_at_size(get_pixmap("deluge.png"), \
|
||||
size, size)
|
||||
else:
|
||||
|
@ -53,7 +53,8 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import platform
|
||||
if not platform.system() in ('Windows', 'Microsoft'):
|
||||
import common
|
||||
if not common.windows_check():
|
||||
import statvfs
|
||||
import time
|
||||
|
||||
@ -300,7 +301,7 @@ class Manager:
|
||||
deluge_core.quit()
|
||||
|
||||
#kill dbus on windows
|
||||
if platform.system() in ('Windows', 'Microsoft'):
|
||||
if common.windows_check():
|
||||
import os
|
||||
os.popen4('tskill.exe dbus-daemon-deluge')
|
||||
|
||||
@ -404,14 +405,12 @@ class Manager:
|
||||
def save_fastresume_data(self, uid=None):
|
||||
if uid == None:
|
||||
for unique_ID in self.unique_IDs:
|
||||
import common
|
||||
try:
|
||||
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
||||
except:
|
||||
pass
|
||||
deluge_core.save_fastresume(unique_ID, self.unique_IDs[unique_ID].filename)
|
||||
else:
|
||||
import common
|
||||
try:
|
||||
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
|
||||
except:
|
||||
@ -798,7 +797,7 @@ class Manager:
|
||||
# Functions for checking if enough space is available
|
||||
|
||||
def calc_free_space(self, directory):
|
||||
if not platform.system() in ('Windows', 'Microsoft'):
|
||||
if not common.windows_check():
|
||||
dir_stats = os.statvfs(directory)
|
||||
block_size = dir_stats[statvfs.F_BSIZE]
|
||||
avail_blocks = dir_stats[statvfs.F_BAVAIL]
|
||||
|
@ -146,8 +146,7 @@ class DelugeGTK:
|
||||
|
||||
signal.signal(signal.SIGINT, self.manager.quit)
|
||||
signal.signal(signal.SIGTERM, self.manager.quit)
|
||||
import platform
|
||||
if not platform.system() in ('Windows', 'Microsoft'):
|
||||
if not common.windows_check():
|
||||
signal.signal(signal.SIGHUP, self.manager.quit)
|
||||
else:
|
||||
from win32api import SetConsoleCtrlHandler
|
||||
|
Loading…
x
Reference in New Issue
Block a user