diff options
author | Paweł Jastrzębski <pawelj@vulturis.eu> | 2014-01-15 11:32:29 +0100 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@vulturis.eu> | 2014-01-15 11:32:29 +0100 |
commit | cccbd36463fbd3395e200eed0a20e7d7782e549d (patch) | |
tree | bf2005771ac244e187388275f420e3c1d0bd273c /kcc.py | |
parent | Bucket of various tweaks (diff) | |
download | kcc-cccbd36463fbd3395e200eed0a20e7d7782e549d.tar.gz kcc-cccbd36463fbd3395e200eed0a20e7d7782e549d.tar.bz2 kcc-cccbd36463fbd3395e200eed0a20e7d7782e549d.zip |
And one more bucket...
Diffstat (limited to 'kcc.py')
-rw-r--r-- | kcc.py | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/kcc.py b/kcc.py index 397dc0b..c445924 100644 --- a/kcc.py +++ b/kcc.py @@ -94,21 +94,22 @@ class QApplicationMessaging(QtGui.QApplication): return True return False -freeze_support() -KCCAplication = QApplicationMessaging(sys.argv) -if KCCAplication.isRunning(): +if __name__ == "__main__": + freeze_support() + KCCAplication = QApplicationMessaging(sys.argv) + if KCCAplication.isRunning(): + if len(sys.argv) > 1: + KCCAplication.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding())) + sys.exit(0) + else: + messageBox = QtGui.QMessageBox() + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap(':/Icon/icons/comic2ebook.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) + messageBox.setWindowIcon(icon) + QtGui.QMessageBox.critical(messageBox, 'KCC - Error', 'KCC is already running!', QtGui.QMessageBox.Ok) + sys.exit(1) + KCCWindow = QtGui.QMainWindow() + KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow) if len(sys.argv) > 1: - KCCAplication.sendMessage(sys.argv[1].decode(sys.getfilesystemencoding())) - sys.exit(0) - else: - messageBox = QtGui.QMessageBox() - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(':/Icon/icons/comic2ebook.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - messageBox.setWindowIcon(icon) - QtGui.QMessageBox.critical(messageBox, 'KCC - Error', 'KCC is already running!', QtGui.QMessageBox.Ok) - sys.exit(1) -KCCWindow = QtGui.QMainWindow() -KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow) -if len(sys.argv) > 1: - KCCUI.handleMessage(sys.argv[1].decode(sys.getfilesystemencoding())) -sys.exit(KCCAplication.exec_()) + KCCUI.handleMessage(sys.argv[1].decode(sys.getfilesystemencoding())) + sys.exit(KCCAplication.exec_()) |