Example #1
0
File: qt.py Project: renemilk/pyMor
 def _doit(factory):
     try:
         app = QApplication([])
     except RuntimeError:
         app = QCoreApplication.instance()
     main_window = factory()
     if getattr(sys, '_called_from_test', False) and is_windows_platform():
         QTimer.singleShot(500, app, Slot('quit()'))
     main_window.show()
     app.exec_()
Example #2
0
 def _doit(factory):
     try:
         app = QApplication([])
     except RuntimeError:
         app = QCoreApplication.instance()
     main_window = factory()
     if getattr(sys, '_called_from_test', False) and is_windows_platform():
         QTimer.singleShot(500, app, Slot('quit()'))
     main_window.show()
     app.exec_()
Example #3
0
        def _func(*args, **kwargs):
            app = QCoreApplication.instance()
            if app is None:
                return func(*args, **kwargs)

            runner = Runner()
            try:
                runner.moveToThread(app.thread())
                app.notify(runner, Event(func, args, kwargs))
                return runner.result.get()
            finally:
                runner.deleteLater()
Example #4
0
 def _doit(factory):
     # for windows these needs to be repeated due to multiprocessing (?)
     from Qt.QtWidgets import QApplication
     from Qt.QtCore import QCoreApplication
     try:
         app = QApplication([])
     except RuntimeError:
         app = QCoreApplication.instance()
     main_window = factory()
     if getattr(sys, '_called_from_test',
                False) and (is_windows_platform() or is_macos_platform()):
         QTimer.singleShot(1000, app.quit)
     main_window.show()
     app.exec_()
Example #5
0
 def start(self):
     self._background_thread.start()
     QCoreApplication.instance().aboutToQuit.connect(self.stop)