Ejemplo n.º 1
0
 def langSelect(self, lang):
     for k, v in self.lang_list.items():
         if lang == v:
             self.parent.lilii_settings["lang"] = k
             translator = QTranslator(qApp)
             translator.load("/usr/share/lilii/languages/{}.qm".format(k.split(".")[0]))
             qApp.installTranslator(translator)
 def cambiar(self, id, module):
     from PyQt5.QtCore import QTranslator
     from PyQt5.QtWidgets import qApp
     if self.qtranslator!=None:
         qApp.removeTranslator(self.qtranslator)
     self.qtranslator=QTranslator(qApp)
     filename=package_filename(module, "i18n/{}_{}.qm".format(module,id))
     self.qtranslator.load(filename)
     info("TranslationLanguage changed to {}".format(id))
     qApp.installTranslator(self.qtranslator)
Ejemplo n.º 3
0
 def langSelect(self, lang):
     for k, v in self.lang_list.items():
         if lang == v:
             self.parent.lilii_settings["lang"] = k
             translator = QTranslator(qApp)
             path = "/usr/share/lime-installer/languages/{}.qm".format(k.split(".")[0])
             if QFile().exists(path):
                 translator.load(path)
             else:
                 translator.load("languages/{}.qm".format(k.split(".")[0]))
             qApp.installTranslator(translator)
             self.parent.languageChanged.emit()
Ejemplo n.º 4
0
    def schedule_lang_changed(self) -> None:
        """
        Method to change the language of the schedule.
        """
        Settings.ScheduleLang = self.combo_box_sch_lang.currentData()

        translator = QTranslator()
        translator.load(":/translations/schedule_" +
                        Settings.ScheduleLang)

        qApp.removeTranslator(Settings.ScheduleTranslator)
        qApp.installTranslator(translator)
        Settings.ScheduleTranslator = translator
Ejemplo n.º 5
0
    def application_lang_changed(self) -> None:
        """
        Method to change the application language.
        """
        Settings.ApplicationLang = self.combo_box_app_lang.currentData()

        translator = QTranslator()
        translator.load(":/translations/application_" +
                        Settings.ApplicationLang)

        qApp.removeTranslator(Settings.ApplicationTranslator)
        qApp.installTranslator(translator)
        Settings.ApplicationTranslator = translator
Ejemplo n.º 6
0
 def loadTranslator(self, lang):
     translator = QtCore.QTranslator()
     ret = translator.load(lang, 'i18n/')
     qt_translator = QtCore.QTranslator()
     qt_qm = 'qtbase_' + lang.split('_')[0]
     qt_translator.load(qt_qm, 'i18n/')
     if ret:
         if self.translator:
             qApp.removeTranslator(self.translator)
         if self.qt_translator:
             qApp.removeTranslator(self.qt_translator)
         self.qt_translator = qt_translator
         self.translator = translator
         qApp.installTranslator(self.qt_translator)
         qApp.installTranslator(self.translator)
Ejemplo n.º 7
0
    def loadLang(self, index=0, lang=None):
        try:
            qApp.removeTranslator(self.translator)
        except:
            pass

        if not lang:
            if self.ui.comboBox.findData(index) < 0:
                lang = self.ui.comboBox.itemData(index)
            
        ctx.lang = lang
        
        qmFile = os.path.join(str(self._path), "{lang}.qm".format(lang=lang))
        if not os.path.exists(qmFile):
            return
        
        self.translator = QTranslator()

        self.translator.load(qmFile)
        qApp.installTranslator(self.translator)
        self.retranslateUi()
        
        ctx.mainScreen.retranslateUi()
        
        try:
            ctx.mainScreen.stackMove(0)
        except:
            pass
        
        try:
            hata_sayisi = 0
            
            for widget in qApp.allWidgets():
                try:
                    widget.ui.retranslateUi(widget)
                except:
                    pass
        except:
            print("hata ")
Ejemplo n.º 8
0
 def dillerComboDegisti(self, dil):
     self.ebeveyn.sistemDili = self.diller[dil]
     translator = QTranslator(qApp)
     translator.load("/usr/share/milis-kur/languages/%s.qm" % (str(dil)))
     qApp.installTranslator(translator)
Ejemplo n.º 9
0
    splash = QSplashScreen(
        QPixmap.fromImage(QImage("LaserQt_Ui/logo_128px.png")))
    splash.setDisabled(True)
    splash.show()

    # 读取样式表
    file = open("LaserQt_Gui/LaserQt_Gui_Style.qss", 'r')
    styleSheet = file.read()
    file.close()
    # 设置全局样式
    qApp.setStyleSheet(styleSheet)

    # 汉化处理
    tran = QTranslator()
    tran.load("qt_zh_CN.qm", "LaserQt_Font/")
    qApp.installTranslator(tran)

    myLaserQtMainWindow = LaserQtMainWindow()
    myLaserQtSecondWindow = LaserQtSecondWindow()
    myLaserQtThirdWindow = LaserQtThirdWindow()
    myLaserQtFourthWindow = LaserQtFourthWindow()
    myLaserQtImageWindow = None

    # 对实例方法进行动态修改
    overLoad = OverLoadClassMethod()

    myLaserQtMainWindow.next_page = overLoad.laser_qt_main_window_next_page
    # 按钮绑定回调函数
    myLaserQtMainWindow.nextButton.clicked.connect(
        myLaserQtMainWindow.next_page)