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