diff options
author | Paweł Jastrzębski <pawelj@vulturis.eu> | 2013-11-13 11:27:26 +0100 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@vulturis.eu> | 2013-11-13 11:27:26 +0100 |
commit | ddd223c2ec83e46421859d825d142c6ea7568fd2 (patch) | |
tree | b2be5bea32d935df8f9ecba67656152e5776bea1 /kcc.py | |
parent | OS specific tweaks to status bar style (diff) | |
download | kcc-ddd223c2ec83e46421859d825d142c6ea7568fd2.tar.gz kcc-ddd223c2ec83e46421859d825d142c6ea7568fd2.tar.bz2 kcc-ddd223c2ec83e46421859d825d142c6ea7568fd2.zip |
Code cleanup
Diffstat (limited to 'kcc.py')
-rw-r--r-- | kcc.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/kcc.py b/kcc.py index 9476090..4d60f5e 100644 --- a/kcc.py +++ b/kcc.py @@ -39,22 +39,19 @@ except ImportError: exit(1) from kcc import KCC_gui from multiprocessing import freeze_support + +# OS specific PATH variable workarounds if sys.platform.startswith('darwin'): if 'RESOURCEPATH' in os.environ: os.environ['PATH'] = os.environ['RESOURCEPATH'] + ':' + os.environ['PATH'] else: os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/:' + os.environ['PATH'] - from kcc import KCC_ui_osx as KCC_ui -elif sys.platform.startswith('linux'): - from kcc import KCC_ui_linux as KCC_ui -else: - # Workaround for Windows file association mechanism +elif sys.platform.startswith('win'): if getattr(sys, 'frozen', False): os.chdir(os.path.dirname(os.path.abspath(sys.executable))) else: os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/;' + os.environ['PATH'] os.chdir(os.path.dirname(os.path.abspath(__file__))) - from kcc import KCC_ui # Implementing detection of already running KCC instance and forwarding argv to it @@ -98,10 +95,10 @@ class QApplicationMessaging(QtGui.QApplication): return False freeze_support() -APP = QApplicationMessaging(sys.argv) -if APP.isRunning(): +KCCAplication = QApplicationMessaging(sys.argv) +if KCCAplication.isRunning(): if len(sys.argv) > 1: - APP.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding())) + KCCAplication.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding())) sys.exit(0) else: messageBox = QtGui.QMessageBox() @@ -110,13 +107,8 @@ if APP.isRunning(): messageBox.setWindowIcon(icon) QtGui.QMessageBox.critical(messageBox, 'KCC - Error', 'KCC is already running!', QtGui.QMessageBox.Ok) sys.exit(1) -KCC = QtGui.QMainWindow() -UI = KCC_ui.Ui_KCC() -UI.setupUi(KCC) -GUI = KCC_gui.Ui_KCC(UI, KCC, APP) -KCC.setWindowTitle("Kindle Comic Converter " + __version__) -KCC.show() -KCC.raise_() +KCCWindow = QtGui.QMainWindow() +KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow) if len(sys.argv) > 1: - GUI.handleMessage(sys.argv[1].decode(sys.getfilesystemencoding())) -sys.exit(APP.exec_()) + KCCUI.handleMessage(sys.argv[1].decode(sys.getfilesystemencoding())) +sys.exit(KCCAplication.exec_()) |