about summary refs log tree commit diff
path: root/kindlecomicconverter
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@iosphe.re>2017-03-17 10:55:56 +0100
committerPaweł Jastrzębski <pawelj@iosphe.re>2017-03-17 10:55:56 +0100
commit8048b91fa86428d71329b15275d3134230a06019 (patch)
tree8d1f2c06c18f9aee0c28bcfee902729501e0ad7c /kindlecomicconverter
parentCode cleanup (diff)
downloadkcc-8048b91fa86428d71329b15275d3134230a06019.tar.gz
kcc-8048b91fa86428d71329b15275d3134230a06019.tar.bz2
kcc-8048b91fa86428d71329b15275d3134230a06019.zip
Overhauled startup functions for PyPI packaging
Diffstat (limited to 'kindlecomicconverter')
-rw-r--r--kindlecomicconverter/startup.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/kindlecomicconverter/startup.py b/kindlecomicconverter/startup.py
new file mode 100644
index 0000000..4c47a17
--- /dev/null
+++ b/kindlecomicconverter/startup.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2012-2014 Ciro Mattia Gonano <ciromattia@gmail.com>
+# Copyright (c) 2013-2017 Pawel Jastrzebski <pawelj@iosphe.re>
+#
+# Permission to use, copy, modify, and/or distribute this software for
+# any purpose with or without fee is hereby granted, provided that the
+# above copyright notice and this permission notice appear in all
+# copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
+# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+
+import os
+import sys
+from . import __version__
+from .shared import dependencyCheck
+
+def start():
+    dependencyCheck(3)
+    from . import KCC_gui
+    os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = "1"
+    KCCAplication = KCC_gui.QApplicationMessaging(sys.argv)
+    if KCCAplication.isRunning():
+        if len(sys.argv) > 1:
+            KCCAplication.sendMessage(sys.argv[1])
+        else:
+            KCCAplication.sendMessage('ARISE')
+    else:
+        KCCWindow = KCC_gui.QMainWindowKCC()
+        KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow)
+        if len(sys.argv) > 1:
+            KCCUI.handleMessage(sys.argv[1])
+        sys.exit(KCCAplication.exec_())
+
+def startC2E():
+    dependencyCheck(2)
+    from .comic2ebook import main
+    print('comic2ebook v' + __version__ + ' - Written by Ciro Mattia Gonano and Pawel Jastrzebski.')
+    sys.exit(main(sys.argv[1:]))
+
+def startC2P():
+    dependencyCheck(1)
+    from .comic2panel import main
+    print('comic2panel v' + __version__ + ' - Written by Ciro Mattia Gonano and Pawel Jastrzebski.')
+    sys.exit(main(sys.argv[1:]))
\ No newline at end of file