QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads, True) from PyQt5.QtWidgets import QApplication app = QApplication(sys.argv) app.setOrganizationName("Deepin") app.setApplicationName("Deepin Screenshot") app.setApplicationVersion("3.1.0") app.setQuitOnLastWindowClosed(False) from app_controller import AppController from dbus_services import is_service_exist, register_object from dbus_interfaces import screenshotInterface if __name__ == "__main__": if is_service_exist(): screenshotInterface.runWithArguments(app.arguments()) # TODO: maybe there will never be a situation that # the following should be executed. # notificationsInterface.notify(_("Deepin Screenshot"), # _("Deepin Screenshot has been started!")) else: controller = AppController() returncode = controller.runWithArguments(app.arguments()) if returncode == 0: register_object(controller) signal.signal(signal.SIGINT, signal.SIG_DFL) sys.exit(app.exec_()) else: sys.exit(1)
from PyQt5 import QtCore from PyQt5.QtCore import QCoreApplication if os.name == 'posix': QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads, True) from PyQt5.QtWidgets import QApplication app = QApplication(sys.argv) app.setOrganizationName("Deepin") app.setApplicationName("Deepin Screenshot") app.setApplicationVersion("3.0") app.setQuitOnLastWindowClosed(False) from app_controller import AppController from dbus_services import is_service_exist, register_object from dbus_interfaces import screenshotInterface if __name__ == "__main__": if is_service_exist(): screenshotInterface.runWithArguments(app.arguments()) # TODO: maybe there will never be a situation that # the following should be executed. # notificationsInterface.notify(_("Deepin Screenshot"), # _("Deepin Screenshot has been started!")) else: controller = AppController() controller.runWithArguments(app.arguments()) register_object(controller) signal.signal(signal.SIGINT, signal.SIG_DFL) sys.exit(app.exec_())