def start(): """ Run Pyzo. """ # Do some imports from pyzo.core import pyzoLogging # to start logging asap from pyzo.core.main import MainWindow # Apply users' preferences w.r.t. date representation etc # this is required for e.g. strftime("%c") # Just using '' does not seem to work on OSX. Thus # this odd loop. #locale.setlocale(locale.LC_ALL, "") for x in ('', 'C', 'en_US', 'en_US.utf8', 'en_US.UTF-8'): try: locale.setlocale(locale.LC_ALL, x) break except locale.Error: pass # Set to be aware of the systems native colors, fonts, etc. QtGui.QApplication.setDesktopSettingsAware(True) # Instantiate the application QtGui.qApp = MyApp([]) # QtGui.QApplication([]) # Choose language, get locale appLocale = setLanguage(config.settings.language) # Create main window, using the selected locale frame = MainWindow(None, appLocale) # Enter the main loop QtGui.qApp.exec_()
def start(): """Run Pyzo.""" # Do some imports import pyzo from pyzo.core import pyzoLogging # noqa - to start logging asap from pyzo.core.main import MainWindow # Apply users' preferences w.r.t. date representation etc # this is required for e.g. strftime("%c") # Just using '' does not seem to work on OSX. Thus # this odd loop. # locale.setlocale(locale.LC_ALL, "") for x in ("", "C", "en_US", "en_US.utf8", "en_US.UTF-8"): try: locale.setlocale(locale.LC_ALL, x) break except Exception: pass # # Set to be aware of the systems native colors, fonts, etc. # QtWidgets.QApplication.setDesktopSettingsAware(True) # Instantiate the application QtWidgets.qApp = MyApp(sys.argv) # QtWidgets.QApplication([]) # Choose language, get locale appLocale = setLanguage(pyzo.config.settings.language) # Create main window, using the selected locale MainWindow(None, appLocale) # In test mode, we close after 5 seconds # We also write "Closed" to the log (if a filename is provided) which we use # in our tests to determine that Pyzo did a successful run. if "--test" in sys.argv: close_signal = lambda: print("Stopping") if os.getenv("PYZO_LOG", ""): close_signal = lambda: open(os.getenv("PYZO_LOG"), "at").write( "Stopping\n") pyzo.test_close_timer = t = QtCore.QTimer() t.setInterval(5000) t.setSingleShot(True) t.timeout.connect(lambda: [close_signal(), pyzo.main.close()]) t.start() # Enter the main loop if hasattr(QtWidgets.qApp, "exec"): QtWidgets.qApp.exec() else: QtWidgets.qApp.exec_()