diff --git a/kcc.py b/kcc.py index ea8fe68..74a02e6 100644 --- a/kcc.py +++ b/kcc.py @@ -87,8 +87,7 @@ class QApplicationMessaging(QtWidgets.QApplication): self._running = True else: self._running = False - if not self._memory.create(1): - raise RuntimeError(self._memory.errorString().toLocal8Bit().data()) + self._memory.create(1) self._key = 'KCC' self._timeout = 1000 self._server = QtNetwork.QLocalServer(self) @@ -96,6 +95,10 @@ class QApplicationMessaging(QtWidgets.QApplication): self._server.newConnection.connect(self.handleMessage) self._server.listen(self._key) + def __del__(self): + if self._memory.isAttached(): + self._memory.detach() + def isRunning(self): return self._running @@ -137,13 +140,8 @@ if __name__ == "__main__": KCCAplication.sendMessage(sys.argv[1]) sys.exit(0) else: - messageBox = QtWidgets.QMessageBox() - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(':/Icon/icons/comic2ebook.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) - messageBox.setWindowIcon(icon) - QtWidgets.QMessageBox.critical(messageBox, 'KCC - Error', 'KCC is already running!', - QtWidgets.QMessageBox.Ok) - sys.exit(1) + KCCAplication.sendMessage('ARISE') + sys.exit(0) KCCWindow = QMainWindowKCC() KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow) if len(sys.argv) > 1: diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index bc72681..03618af 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -945,7 +945,8 @@ class KCCGUI(KCC_ui.Ui_KCC): def handleMessage(self, message): MW.raise_() MW.activateWindow() - if not self.conversionAlive: + message = message.decode('UTF-8') + if not self.conversionAlive and message != 'ARISE': if self.needClean: self.needClean = False GUI.JobList.clear() diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index ff9199d..d3d45e7 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -1079,4 +1079,4 @@ def checkOptions(): (int(X*1.5), int(Y*1.5))) image.ProfileData.Profiles["Custom"] = newProfile options.profile = "Custom" - options.profileData = image.ProfileData.Profiles[options.profile] \ No newline at end of file + options.profileData = image.ProfileData.Profiles[options.profile] \ No newline at end of file