Exemplo n.º 1
0
    def handle_timeout():
        nonlocal ok
        if ok:
            QCoreApplication.installTranslator(py_tranlator)
            QCoreApplication.installTranslator(qml_tranlator)
            # QCoreApplication.installTranslator(global_tranlator)
        else:
            QCoreApplication.removeTranslator(py_tranlator)
            QCoreApplication.removeTranslator(qml_tranlator)
            # QCoreApplication.removeTranslator(global_tranlator)

        engine.retranslate()

        ok = not ok
    def setLanguage(self, language):
        """
        setLanguage set the language locale

        Args:
            language (str): desired language for now ("en", "es")

        Returns:
            bool: True if everything is ok, False otherwise.
        """

        self.__errorFound = False

        #
        # English
        #
        if language == 'en':
            self.removeTranslators()

            if QCoreApplication.installTranslator(self.enBaseTranslator):
                self.loadedTranslations.append(self.enBaseTranslator)
            else:
                self.__errorFound = True

            if QCoreApplication.installTranslator(self.enTranslator):
                self.loadedTranslations.append(self.enTranslator)
            else:
                self.__errorFound = True

        #
        # Español
        #
        if language == 'es':
            self.removeTranslators()

            if QCoreApplication.installTranslator(self.esBaseTranslator):
                self.loadedTranslations.append(self.esBaseTranslator)
            else:
                self.__errorFound = True

            if QCoreApplication.installTranslator(self.esTranslator):
                self.loadedTranslations.append(self.esTranslator)
            else:
                self.__errorFound = True

        return not self.__errorFound
Exemplo n.º 3
0
 def change_language(self, lang):
     """ DOCSTRING """
     if lang == "Polski":
         QCoreApplication.installTranslator(self.trans)
         self.axis_x.setTitleText("Częstotliwość [MHz]")
         self.freeze_check.setText("Zamróź")
         self.load_data_check.setText("Otwórz dane archiwalne")
         self.load_data_combo.removeItem(
             self.load_data_combo.findText("No data found"))
         self.load_data_combo.addItem("Nie znaleziono danych")
         self.load_data_btn.setText("Otwórz")
         self.next_button.setText("Następny")
         self.prev_button.setText("Poprzedni")
         self.column_axis.setTitle('Kanały')
         self.column_axis.setLabels([
             'Kanał 1', 'Kanał 2', 'Kanał 3', 'Kanał 4', 'Kanał 5',
             'Kanał 6', 'Kanał 7', 'Kanał 8', 'Kanał 9', 'Kanał 10',
             'Kanał 11', 'Kanał 12', 'Kanał 13'
         ])
         self.row_axis.setTitle('Oś czasu')
         self.bars.setColumnAxis(self.column_axis)
         self.bars.setRowAxis(self.row_axis)
     else:
         QCoreApplication.removeTranslator(self.trans)
         self.axis_x.setTitleText("Frequency [MHz]")
         self.freeze_check.setText("Freeze")
         self.load_data_check.setText("Load archival data")
         self.load_data_combo.removeItem(
             self.load_data_combo.findText("Nie znaleziono danych"))
         self.load_data_combo.addItem("No data found")
         self.load_data_btn.setText("Load")
         self.next_button.setText("Next")
         self.prev_button.setText("Previous")
         self.column_axis.setTitle('Channels')
         self.column_axis.setLabels([
             'Channel 1', 'Channel 2', 'Channel 3', 'Channel 4',
             'Channel 5', 'Channel 6', 'Channel 7', 'Channel 8',
             'Channel 9', 'Channel 10', 'Channel 11', 'Channel 12',
             'Channel 13'
         ])
         self.row_axis.setTitle('Timeline')
         self.bars.setColumnAxis(self.column_axis)
         self.bars.setRowAxis(self.row_axis)