Skip to content

Commit

Permalink
<feature> improve editor form which will auto refresh with option sho…
Browse files Browse the repository at this point in the history
…w untranslated

update version to v2.5.3
anonymousException committed Sep 5, 2024
1 parent c9032eb commit 0e9b425
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/editor_form.py
Original file line number Diff line number Diff line change
@@ -223,6 +223,7 @@ def refresh_table_view(self, full_path):
self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Interactive)
self.tableView.file = full_path
self.tableView.index = self.currentIndex()
self.tableView.editorForm.on_checkbox_state_changed()

def on_selection_changed(self, selected, deselected):
selected_indexes = selected.indexes()
@@ -308,6 +309,7 @@ def load_data(self, index):
self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Interactive)
self.tableView.file = select_one
self.tableView.index = index
self.tableView.editorForm.on_checkbox_state_changed()
self.treeView.hide()

def mousePressEvent(self, event):
@@ -918,7 +920,7 @@ def contextMenuEvent(self, event):

def import_from_html(self):
selected_indexes = self.selectionModel().selectedRows()
selected_rows = [index.row() for index in selected_indexes]
selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
selected_rows.sort(reverse=False)
editorForm = self.editorForm
if editorForm.myImportHtmlForm is None:
@@ -979,7 +981,7 @@ def export_to_html(self):
if reply != QMessageBox.Yes:
is_replace_special_symbols = False
selected_indexes = self.selectionModel().selectedRows()
selected_rows = [index.row() for index in selected_indexes]
selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
selected_rows.sort(reverse=False)
l = []
ret_l = []
@@ -1026,7 +1028,7 @@ def export_to_xlsx(self):
ws.cell(row=1, column=1, value=self.model.horizontalHeaderItem(2).text())
ws.cell(row=1, column=2, value=self.model.horizontalHeaderItem(3).text())
selected_indexes = self.selectionModel().selectedRows()
selected_rows = [index.row() for index in selected_indexes]
selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
selected_rows.sort(reverse=False)
cnt = 2
for row in selected_rows:
@@ -1040,7 +1042,7 @@ def export_to_xlsx(self):

def rollback_cur(self):
selected_indexes = self.selectionModel().selectedRows()
selected_rows = [index.row() for index in selected_indexes]
selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
selected_rows.sort(reverse=True)
for row in selected_rows:
current = self.model.item(row, 0).data(Qt.UserRole)['current']
@@ -1050,7 +1052,7 @@ def translate(self):
if os.path.isfile(web_brower_export_name):
os.remove(web_brower_export_name)
selected_indexes = self.selectionModel().selectedRows()
self.selected_rows = [index.row() for index in selected_indexes]
self.selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
self.selected_rows.sort(reverse=True)
local_glossary = self.local_glossary
transList = []
@@ -1129,15 +1131,15 @@ def translate(self):

def copy_translated_to_cur(self):
selected_indexes = self.selectionModel().selectedRows()
selected_rows = [index.row() for index in selected_indexes]
selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
selected_rows.sort(reverse=True)
for row in selected_rows:
translated = self.model.item(row, 4).text()
self.model.item(row, 3).setText(translated)

def copy_ori_to_cur(self):
selected_indexes = self.selectionModel().selectedRows()
selected_rows = [index.row() for index in selected_indexes]
selected_rows = [index.row() for index in selected_indexes if not self.editorForm.tableView.verticalHeader().isSectionHidden(index.row())]
selected_rows.sort(reverse=True)
for row in selected_rows:
ori = self.model.item(row, 2).text()
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@
sourceDic = dict()
translator = QTranslator()

VERSION = '2.5.2'
VERSION = '2.5.3'

class MyProxyForm(QDialog, Ui_ProxyDialog):
def __init__(self, parent=None):

0 comments on commit 0e9b425

Please sign in to comment.