mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 09:46:25 +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'):
|
||||
from kcc import KCC_ui_linux as KCC_ui
|
||||
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
|
||||
|
||||
|
||||
@@ -85,7 +90,6 @@ freeze_support()
|
||||
APP = QApplicationMessaging(sys.argv)
|
||||
if APP.isRunning():
|
||||
if len(sys.argv) > 1:
|
||||
APP.sendMessage('Araise!')
|
||||
APP.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding()))
|
||||
sys.exit(0)
|
||||
else:
|
||||
|
||||
@@ -630,8 +630,29 @@ class Ui_KCC(object):
|
||||
self.settings.sync()
|
||||
|
||||
def handleMessage(self, message):
|
||||
#TODO
|
||||
print message
|
||||
MainWindow.raise_()
|
||||
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):
|
||||
global GUI, MainWindow
|
||||
|
||||
Reference in New Issue
Block a user