コード例 #1
0
    def onLanguageChange(self):
        languageName = self._langBox.currentText()
        if pyzo.config.settings.language == languageName:
            return
        # Save new language
        pyzo.config.settings.language = languageName
        setLanguage(pyzo.config.settings.language)
        # Notify user
        text = translate(
            "wizard",
            """
        The language has been changed for this wizard.
        Pyzo needs to restart for the change to take effect application-wide.
        """,
        )
        m = QtWidgets.QMessageBox(self)
        m.setWindowTitle(translate("wizard", "Language changed"))
        m.setText(text)
        m.setIcon(m.Information)
        m.exec_()

        # Get props of current wizard
        geo = self.wizard().geometry()
        parent = self.wizard().parent()
        # Close ourself!
        self.wizard().close()
        # Start new one
        w = PyzoWizard(parent)
        w.setGeometry(geo)
        w.show()
コード例 #2
0
ファイル: pyzowizard.py プロジェクト: mlzharov/pyzo
 def onLanguageChange(self):
     languageName = self._langBox.currentText()        
     if pyzo.config.settings.language == languageName:
         return
     # Save new language
     pyzo.config.settings.language = languageName
     setLanguage(pyzo.config.settings.language)
     # Notify user
     text = translate('wizard', """
     The language has been changed for this wizard.
     Pyzo needs to restart for the change to take effect application-wide.
     """)
     m = QtWidgets.QMessageBox(self)
     m.setWindowTitle(translate("wizard", "Language changed"))
     m.setText(text)
     m.setIcon(m.Information)
     m.exec_()
     
     # Get props of current wizard
     geo = self.wizard().geometry()
     parent = self.wizard().parent()
     # Close ourself!        
     self.wizard().close()
     # Start new one
     w = PyzoWizard(parent)
     w.setGeometry(geo)
     w.show()
コード例 #3
0
ファイル: __init__.py プロジェクト: ghisvail/pyzo
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(sys.argv)  # 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_()
コード例 #4
0
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_()
コード例 #5
0
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_()