def main(): sys.setrecursionlimit(60) # to find infinite signal loops? app = QApplication(sys.argv) QCoreApplication.setOrganizationName("testPrintFramework") QCoreApplication.setOrganizationDomain("testPrintFramework.com") QCoreApplication.setApplicationName("testPrintFramework") # To test translations, in shell >export LANG=es or >export LANG=cn translator = QTranslator() result = translator.load("/home/bootch/Downloads/SubprojectsPensool/qtPrintFramework/resources/translations/qtPrintFramework_es.qm") if not result: print("Not load translation") # Not a failure nor exception: program continues in default (usually English) if not app.installTranslator(translator): print("Not install translator.") if config.useQML: from qtEmbeddedQmlFramework.resourceManager import resourceMgr resourceMgr.setResourceRoot(__file__, 'qtPrintFramework') mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
def main(): # establish location of resources (either platform file system or embedded resource file system (.qrc) resourceMgr.setResourceRoot(fileMainWasLoadedFrom=__file__, appPackageName='demoPyQtQML') app = createApp() print("Created app") # Qt Main loop sys.exit(app.exec_()) # !!! C exec => Python exec_
def __init__(self, args): super(App, self).__init__(args) self.setOrganizationName("DocumentStyle") self.setOrganizationDomain("lloyd konneker") self.setApplicationName("testStyling") print( "To test i18n localization in Spanish, set OS locale or temporarily >export LANGUAGE=es" ) self._establishTranslator() # i18n global mainWindow # for access by ToolStyler mainWindow = MainWindow() mainWindow.setGeometry(100, 100, 500, 400) mainWindow.show() self.mainWindow = mainWindow if config.useQML: windowMgr.findRootWindow() # needed as parent of QQuickViews """ qtEmbeddedQmlFramework knows how to locate qml resources, even if embedded. Alternative old code: resourceRoot = QFileInfo(__file__).absolutePath() + '/documentStyle' self.cascadion = StyleSheetCascadion(resourceRoot=resourceRoot) """ resourceMgr.setResourceRoot(fileMainWasLoadedFrom=__file__, appPackageName='documentStyle') # cacadion might use global resourceMgr, but it is not passed. self.cascadion = StyleSheetCascadion() self.cascadion.preGui(parentWindow=mainWindow) mainWindow.newToolStyler() # depends on cascadion self.documentView = mainWindow.newDocument() # depends on cascadion # Arrange that changes to styleSheets will polish doc self.cascadion.connectSignals(mainWindow.scene.polish) # Initial polishing (using Styleable) mainWindow.scene.polish() self.exec_()
def __init__(self, args): super(App, self).__init__(args) self.setOrganizationName("DocumentStyle") self.setOrganizationDomain("lloyd konneker") self.setApplicationName("testStyling") print("To test i18n localization in Spanish, set OS locale or temporarily >export LANGUAGE=es") self._establishTranslator() # i18n global mainWindow # for access by ToolStyler mainWindow = MainWindow() mainWindow.setGeometry(100, 100, 500, 400) mainWindow.show() self.mainWindow = mainWindow if config.useQML: windowMgr.findRootWindow() # needed as parent of QQuickViews """ qtEmbeddedQmlFramework knows how to locate qml resources, even if embedded. Alternative old code: resourceRoot = QFileInfo(__file__).absolutePath() + '/documentStyle' self.cascadion = StyleSheetCascadion(resourceRoot=resourceRoot) """ resourceMgr.setResourceRoot(fileMainWasLoadedFrom=__file__, appPackageName='documentStyle') # cacadion might use global resourceMgr, but it is not passed. self.cascadion = StyleSheetCascadion() self.cascadion.preGui(parentWindow=mainWindow) mainWindow.newToolStyler() # depends on cascadion self.documentView = mainWindow.newDocument() # depends on cascadion # Arrange that changes to styleSheets will polish doc self.cascadion.connectSignals(mainWindow.scene.polish) # Initial polishing (using Styleable) mainWindow.scene.polish() self.exec_()