def translate_ui(self): self.ui.ui_tabs.setTabText(0, tr(self.ui.tab_maid_info)) for group in self.ui.tab_maid_info.findChildren(QGroupBox): group.setTitle(tr(group)) for label in self.ui.tab_maid_info.findChildren(QLabel): label.setText(tr(label)) for label in self.ui.checks_group.findChildren(QCheckBox): label.setText(tr(label)) for i, personality in enumerate(self.personality_names): self.ui.personality_combo.setItemText(i, tr_str(personality)) for i, contract in enumerate(self.contracts_names): self.ui.contract_combo.setItemText(i, tr_str(contract)) for i, relation in enumerate(self.relations_names): self.ui.relation_combo.setItemText(i, tr_str(relation)) for i, relation in enumerate(self.additional_relations_names): self.ui.additional_relation_combo.setItemText(i, tr_str(relation)) for i, seikeiken in enumerate(self.seikeiken_names): self.ui.current_combo.setItemText(i, tr_str(seikeiken)) self.ui.initial_combo.setItemText(i, tr_str(seikeiken)) for i, job_class in enumerate(self.job_classes_names): self.ui.job_class_combo.setItemText(i, tr_str(job_class)) for i, yotogi_class in enumerate(self.yotogi_classes_names): self.ui.yotogi_class_combo.setItemText(i, tr_str(yotogi_class))
def translate_ui(self): self.ui.ui_tabs.setTabText(4, tr(self.ui.tab_yotogi_skills)) for col in range(0, self.ui.yotogi_skills_table.columnCount()): name = self.ui.yotogi_skills_table.horizontalHeaderItem(col) name.setText(tr(name)) for row in range(0, self.ui.yotogi_skills_table.rowCount()): name = self.ui.yotogi_skills_table.item(row, 1) name.setText(tr(name))
def reload(self): for label in self.findChildren(QLabel): label.setText(tr(label)) for button in self.findChildren(QPushButton): button.setText(tr(button)) self.setWindowTitle(tr_str("connect_dialog.title")) self.status_label.setStyleSheet("color: black;") self.status_label.setText(tr_str("connect_dialog.status.wait"))
def __init__(self, silent): super(UpdateDialog, self).__init__() self.setupUi(self) self.layout().setSizeConstraint(QLayout.SetFixedSize) self.silent = silent self.update_data_thread = GetUpdateDataThread() self.download_update_thread = DownloadUpdateThread() self.download_update_thread.chunk_downloaded.connect( self.on_chunk_downloaded) self.download_update_thread.download_complete.connect( self.run_installer) self.download_update_thread.error.connect(self.on_downloader_error) self.update_data_thread.update_available.connect(self.show_update_text) self.update_data_thread.no_update.connect(self.on_no_update) self.update_data_thread.error.connect(self.on_updater_error) self.downloadButton.clicked.connect(self.download_and_run) self.closeButton.clicked.connect(self.update_data_thread.exit) self.closeButton.clicked.connect(self.download_update_thread.exit) self.closeButton.clicked.connect(self.closeEvent) check_on_startup = CONFIG.getboolean("Options", "check_updates_on_startup", fallback=True) CONFIG["Options"][ "check_updates_on_startup"] = "yes" if check_on_startup else "no" save_config() self.checkOnStartupCheckBox.setCheckState( Qt.Checked if check_on_startup else Qt.Unchecked) self.checkOnStartupCheckBox.stateChanged.connect( self.on_startup_check_option_change) icon = QPixmap() icon.loadFromData(APP_ICON) self.setWindowIcon(QIcon(icon)) self.setWindowTitle(tr_str("updater_dialog.title")) self.checkLabel.setText(tr_str("updater_dialog.checking_updates")) self.checkOnStartupCheckBox.setText(tr(self.checkOnStartupCheckBox)) self.downloadButton.setText(tr(self.downloadButton)) self.closeButton.setText(tr(self.closeButton)) self.changelogBrowser.hide() self.progressLabel.hide() self.progressBar.hide() self.downloadButton.hide() self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint) self.adjustSize()
def translate_ui(self): self.ui.ui_tabs.setTabText(5, tr(self.ui.tab_player_info)) for group in self.ui.tab_player_info.findChildren(QGroupBox): group.setTitle(tr(group)) for row in range(0, self.ui.player_params_table.rowCount()): name = self.ui.player_params_table.item(row, 0) name.setText(tr(name)) for col in range(0, self.ui.player_params_table.columnCount()): name = self.ui.player_params_table.horizontalHeaderItem(col) name.setText(tr(name))
def translate_ui(self): self.ui.ui_tabs.setTabText(2, tr(self.ui.tab_feature_propensity)) for group in self.ui.tab_feature_propensity.findChildren(QGroupBox): group.setTitle(tr(group)) self.ui.feature_list.blockSignals(True) for i in range(0, self.ui.feature_list.count()): item = self.ui.feature_list.item(i) item.setText(tr(item)) self.ui.feature_list.blockSignals(False) self.ui.propensity_list.blockSignals(True) for i in range(0, self.ui.propensity_list.count()): item = self.ui.propensity_list.item(i) item.setText(tr(item)) self.ui.propensity_list.blockSignals(False)
def load(self): icon = QPixmap() icon.loadFromData(APP_ICON) self.setWindowIcon(QIcon(icon)) self.description_label.setText(tr(self.description_label)) self.close_button.setText(tr(self.close_button)) error_icon = QPixmap() error_icon.loadFromData(ERR_ICON) self.icon_label.setPixmap(error_icon) self.setWindowTitle(tr_str("error_dialog.title")) self.error_text.setPlainText("".join( traceback.format_exception(self.t, self.error, self.traceback))) self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
def translate_ui(self, language): load_translation(language) CONFIG["Options"]["language"] = language save_config() subtitle = get_random_title() title = BASE_TITLE if subtitle is not None: title += f" -- {subtitle}" self.setWindowTitle(title) for menu_item in self.findChildren(QMenu): menu_item.setTitle(tr(menu_item)) for menu_action in self.findChildren(QAction): if len(menu_action.objectName()) != 0: menu_action.setText(tr(menu_action)) for tab in self.tabs: tab.translate_ui()
def reload(self, core_version): icon = QPixmap() icon.loadFromData(APP_ICON) self.setWindowIcon(QIcon(icon)) self.description_label.setText(tr(self.description_label)) self.close_button.setText(tr(self.close_button)) about_icon = QPixmap() about_icon.loadFromData(APP_ICON) self.icon_label.setPixmap(about_icon.scaled(32, 32)) self.setWindowTitle(tr_str("about_dialog.title")) self.version_label.setText(tr(self.version_label)) self.version.setText(f"GUI: {info.VERSION}\nCore: {core_version}") self.contributors_label.setText(tr(self.contributors_label)) self.contributors.setText("\n".join(info.CONTRIBUTORS)) self.project_label.setText(tr(self.project_label)) self.project.setText(info.INFO_LINK)
def translate_ui(self): self.ui.ui_tabs.setTabText(3, tr(self.ui.tab_maid_work)) for group in self.ui.tab_maid_work.findChildren(QGroupBox): group.setTitle(tr(group)) for label in self.ui.tab_maid_work.findChildren(QLabel): label.setText(tr(label)) for i, work_name in enumerate(self.work_day_names): self.ui.cur_noon_work_combo.setItemText(i, tr_str(work_name)) for i, work_name in enumerate(self.work_yotogi_names): self.ui.cur_night_work_combo.setItemText(i, tr_str(work_name)) for col in range(0, self.ui.noon_work_table.columnCount()): name = self.ui.noon_work_table.horizontalHeaderItem(col) name.setText(tr(name)) for row in range(0, self.ui.noon_work_table.rowCount()): name = self.ui.noon_work_table.item(row, 0) name.setText(tr(name))
def translate_ui(self): self.ui.ui_tabs.setTabText(1, tr(self.ui.tab_maid_stats)) for group in self.ui.tab_maid_stats.findChildren(QGroupBox): group.setTitle(tr(group)) for col in range(0, self.ui.maid_params_lockable_table.columnCount()): name = self.ui.maid_params_lockable_table.horizontalHeaderItem(col) name.setText(tr(name)) for row in range(0, self.ui.maid_params_lockable_table.rowCount()): name = self.ui.maid_params_lockable_table.item(row, 0) name.setText(tr(name)) for row in range(0, self.ui.maid_params_bonus_table.rowCount()): name = self.ui.maid_params_bonus_table.item(row, 0) name.setText(tr(name)) for col in range(0, self.ui.maid_params_bonus_table.columnCount()): name = self.ui.maid_params_bonus_table.horizontalHeaderItem(col) name.setText(tr(name))