示例#1
0
def main():
    # sys.setrecursionlimit(1500)
    app = QApplication(sys.argv)
    print("starting...")
    Language.setTrans()
    from ui.splash import SplashScreen
    splash = SplashScreen("res/splash.png")
    splash.loadProgress()
    from ui.mainwin import MainWin
    win = MainWin()
    win.show()
    splash.finish(win)
    sys.exit(app.exec_())
示例#2
0
 def run(self, pytest=False):
     """run the app
     :param pytest: if run is true start event loop, else just for test
     """
     print("starting...")
     Language.setTrans()
     splash = SplashScreen("res/splash.png")
     splash.loadProgress()
     from ui.mainwin import MainWin
     self.windows["main"] = MainWin()
     self.windows["main"].show()
     splash.finish(self.windows["main"])
     if not pytest:
         sys.exit(self.exec_())
示例#3
0
 def fillLangItems(self, combo):
     """set combo list for language
     """
     from i18n.language import Language
     langs = Language.getLangs()
     for l in langs:
         combo.addItem(l["nativename"], l["lang"])
     return True
示例#4
0
 def updateLangCombo(self, lang=None):
     """update setting ui to lang"""
     from i18n.language import Language
     if not lang:
         lang = Language.lang
     for l in Language.getLangs():
         if l["lang"].replace("-", "_") == lang.replace("-", "_"):
             self.langCombo.setCurrentText(l["nativename"])
             break
示例#5
0
 def showEvent(self, QShowEvent):
     # default value
     self.fontsizespin.setValue(self.win.editor.font().pointSize())
     self.recentcountspin.setValue(self.win.recent.maxcount)
     lang = self.win.config.getSec("general").get("language", None)
     if lang is None:
         lang = "en"
     from i18n.language import Language
     for l in Language.getLangs():
         if l["lang"] == lang:
             self.langCombo.setCurrentText(l["nativename"])
             break
示例#6
0
 def initConfOptions(self):
     """load option and display on ui when dialog first start"""
     count = self.win.config["file.recentcount"]
     if count:
         self.recentcountspin.setValue(count)
     # lang = self.win.config.get("general.language","en") #self.win.config.getSec("general").get("language", "en")
     # lang = self.win.config["general.language"]
     # if lang is None:
     #     lang = "en"
     from i18n.language import Language
     lang = Language.lang
     for l in Language.getLangs():
         if l["lang"].replace("-", "_") == lang.replace("-", "_"):
             self.langCombo.setCurrentText(l["nativename"])
             break
     self.checkboxAutoExportQss.setChecked(
         bool(self.win.config["advance.autoexportqss"]))
示例#7
0
 def setLangItems(self, combo):
     from i18n.language import Language
     langs = Language.getLangs()
     for l in langs:
         combo.addItem(l["nativename"], l["lang"])
     return True