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 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)
def removeTranslators(self): for translator in self.loadedTranslations: QCoreApplication.removeTranslator(translator) self.loadedTranslations = []