mirror of
https://github.com/ciromattia/kcc
synced 2025-12-20 21:22:05 +00:00
Added support for file association
This commit is contained in:
6
kcc.py
6
kcc.py
@@ -39,6 +39,11 @@ if sys.platform.startswith('darwin'):
|
|||||||
elif sys.platform.startswith('linux'):
|
elif sys.platform.startswith('linux'):
|
||||||
from kcc import KCC_ui_linux as KCC_ui
|
from kcc import KCC_ui_linux as KCC_ui
|
||||||
else:
|
else:
|
||||||
|
# Workaround for Windows file association mechanism
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
|
||||||
|
else:
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
from kcc import KCC_ui
|
from kcc import KCC_ui
|
||||||
|
|
||||||
|
|
||||||
@@ -85,7 +90,6 @@ freeze_support()
|
|||||||
APP = QApplicationMessaging(sys.argv)
|
APP = QApplicationMessaging(sys.argv)
|
||||||
if APP.isRunning():
|
if APP.isRunning():
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
APP.sendMessage('Araise!')
|
|
||||||
APP.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding()))
|
APP.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding()))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -630,8 +630,29 @@ class Ui_KCC(object):
|
|||||||
self.settings.sync()
|
self.settings.sync()
|
||||||
|
|
||||||
def handleMessage(self, message):
|
def handleMessage(self, message):
|
||||||
#TODO
|
MainWindow.raise_()
|
||||||
print message
|
if not self.conversionAlive:
|
||||||
|
if self.needClean:
|
||||||
|
self.needClean = False
|
||||||
|
GUI.JobList.clear()
|
||||||
|
if self.UnRAR:
|
||||||
|
if self.sevenza:
|
||||||
|
formats = ['.cbz', '.cbr', '.cb7', '.zip', '.rar', '.7z', '.pdf']
|
||||||
|
else:
|
||||||
|
formats = ['.cbz', '.cbr', '.zip', '.rar', '.pdf']
|
||||||
|
else:
|
||||||
|
if self.sevenza:
|
||||||
|
formats = ['.cbz', '.cb7', '.zip', '.7z', '.pdf']
|
||||||
|
else:
|
||||||
|
formats = ['.cbz', '.zip', '.pdf']
|
||||||
|
if os.path.isdir(message):
|
||||||
|
GUI.JobList.addItem(message)
|
||||||
|
elif os.path.isfile(message):
|
||||||
|
extension = os.path.splitext(message)
|
||||||
|
if extension[1].lower() in formats:
|
||||||
|
GUI.JobList.addItem(message)
|
||||||
|
else:
|
||||||
|
self.addMessage('This file type is unsupported!', 'error')
|
||||||
|
|
||||||
def __init__(self, UI, KCC, APP):
|
def __init__(self, UI, KCC, APP):
|
||||||
global GUI, MainWindow
|
global GUI, MainWindow
|
||||||
|
|||||||
Reference in New Issue
Block a user