ignoredict

This commit is contained in:
恍兮惚兮 2024-08-04 16:50:18 +08:00
parent e863922eb1
commit de936e6189
24 changed files with 100 additions and 30 deletions

View File

@ -100,8 +100,8 @@ def _createseletengeinecombo_1(self):
def vistranslate_rank(self):
listediter(
self,
("显示顺序"),
("显示顺序"),
"显示顺序",
"显示顺序",
globalconfig["cishuvisrank"],
isrankeditor=True,
namemapfunction=lambda k: globalconfig["cishu"][k]["name"],

View File

@ -19,6 +19,7 @@ from gui.usefulwidget import (
getspinbox,
getsimplecombobox,
getlineedit,
listediter,
listediterline,
getsimpleswitch,
makesubtab_lazy,
@ -329,6 +330,20 @@ class AnkiWindow(QWidget):
"例句中加粗单词",
getsimpleswitch(globalconfig["ankiconnect"], "boldword"),
)
layout.addRow(
"不添加辞书",
getIconButton(self.vistranslate_rank, "fa.gear"),
)
def vistranslate_rank(self):
listediter(
self,
"不添加辞书",
"不添加辞书",
globalconfig["ignoredict"],
candidates=list(globalconfig["cishu"].keys()),
namemapfunction=lambda k: globalconfig["cishu"][k]["name"],
)
def startorendrecord(self, target: QLineEdit, idx):
if idx == 1:
@ -706,11 +721,15 @@ class searchwordW(closeashidewindow):
self.vboxlayout.addLayout(self.searchlayout)
self.searchtext = QLineEdit1()
self.searchtext.textChanged.connect(self.ankiwindow.reset)
self.history_last_btn = statusbutton(icons=["fa.arrow-left", "fa.arrow-left"], colors=["", ""])
self.history_last_btn = statusbutton(
icons=["fa.arrow-left", "fa.arrow-left"], colors=["", ""]
)
self.history_last_btn.clicked.connect(
functools.partial(self.__move_history_search, -1)
)
self.history_next_btn = statusbutton(icons=["fa.arrow-right", "fa.arrow-right"], colors=["", ""])
self.history_next_btn = statusbutton(
icons=["fa.arrow-right", "fa.arrow-right"], colors=["", ""]
)
self.history_next_btn.clicked.connect(
functools.partial(self.__move_history_search, 1)
)
@ -783,9 +802,12 @@ class searchwordW(closeashidewindow):
res = []
tabks = []
for k, v in self.cache_results.items():
if k in globalconfig["ignoredict"]:
continue
if len(v) == 0:
continue
thisp = self.thisps.get(k, 0)
idx = 0
for i in tabks:
if i >= thisp:

View File

@ -97,6 +97,8 @@ class TableViewW(QTableView):
def setIndexWidget(self, index: QModelIndex, w: QWidget):
super().setIndexWidget(index, w)
if w is None:
return
if self.rowHeight(index.row()) < w.height():
self.setRowHeight(index.row(), w.height())
@ -1668,11 +1670,12 @@ class listediter(LDialog):
copy = LAction("复制")
up = LAction("上移")
down = LAction("下移")
if not self.isrankeditor:
if not (self.isrankeditor):
menu.addAction(remove)
menu.addAction(copy)
menu.addAction(up)
menu.addAction(down)
if not (self.candidates):
menu.addAction(up)
menu.addAction(down)
action = menu.exec(self.hctable.cursor().pos())
if action == remove:
@ -1710,9 +1713,11 @@ class listediter(LDialog):
ispathsedit=None,
isrankeditor=False,
namemapfunction=None,
candidates=None,
) -> None:
super().__init__(parent)
self.lst = lst
self.candidates = candidates
self.closecallback = closecallback
self.ispathsedit = ispathsedit
self.isrankeditor = isrankeditor
@ -1727,7 +1732,7 @@ class listediter(LDialog):
QHeaderView.ResizeMode.ResizeToContents
)
table.horizontalHeader().setStretchLastSection(True)
if isrankeditor or (not (ispathsedit is None)):
if isrankeditor or (not (ispathsedit is None)) or self.candidates:
table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
table.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
table.setSelectionMode((QAbstractItemView.SelectionMode.SingleSelection))
@ -1754,6 +1759,10 @@ class listediter(LDialog):
self.buttons = threebuttons(texts=["上移", "下移"])
self.buttons.btn1clicked.connect(functools.partial(self.moverank, -1))
self.buttons.btn2clicked.connect(functools.partial(self.moverank, 1))
elif self.candidates:
self.buttons = threebuttons(texts=["添加行", "删除行"])
self.buttons.btn1clicked.connect(self.click1)
self.buttons.btn2clicked.connect(self.clicked2)
else:
self.buttons = threebuttons(texts=["添加行", "删除行", "上移", "下移"])
self.buttons.btn1clicked.connect(self.click1)
@ -1805,9 +1814,27 @@ class listediter(LDialog):
self.internalrealname.insert(0, paths)
self.hcmodel.insertRow(0, [QStandardItem(path)])
def click1(self):
def __changed(self, idx):
self.internalrealname[self.hctable.currentIndex().row()] = self.candidates[idx]
if self.ispathsedit is None:
def click1(self):
if self.candidates:
if len(self.internalrealname):
_vis = self.internalrealname[0]
self.hctable.setIndexWidget(self.hcmodel.index(0, 0), None)
if self.namemapfunction:
_vis = self.namemapfunction(_vis)
self.hcmodel.setItem(0, 0, QStandardItem(_vis))
self.internalrealname.insert(0, self.candidates[0])
self.hcmodel.insertRow(0, [QStandardItem("")])
combo = LFocusCombo()
_vis = self.candidates
if self.namemapfunction:
_vis = [self.namemapfunction(_) for _ in _vis]
combo.addItems(_vis)
combo.currentIndexChanged.connect(self.__changed)
self.hctable.setIndexWidget(self.hcmodel.index(0, 0), combo)
elif self.ispathsedit is None:
self.internalrealname.insert(0, "")
self.hcmodel.insertRow(0, [QStandardItem("")])
else:

View File

@ -332,6 +332,7 @@
"fix_translate_rank": false,
"fix_translate_rank_rank": [],
"cishuvisrank": [],
"ignoredict": [],
"transoptimi": {
"noundict": false,
"gptpromptdict": false,

View File

@ -842,5 +842,6 @@
"启动方式": "طريقة البدء",
"直接启动": "بدء التشغيل مباشرة",
"优先使用": "الأولوية في استخدام",
"外部": "خارجي ."
"外部": "خارجي .",
"不添加辞书": "لا إضافة القاموس"
}

View File

@ -842,5 +842,6 @@
"启动方式": "啟動管道",
"直接启动": "直接啟動",
"优先使用": "優先使用",
"外部": "外部"
"外部": "外部",
"不添加辞书": "不添加辭書"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Metoda spuštění",
"直接启动": "Přímo spustit",
"优先使用": "priorita použití",
"外部": "externí"
"外部": "externí",
"不添加辞书": "Nepřidávat slovník"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Startmethode",
"直接启动": "Direkt starten",
"优先使用": "Priorität der Verwendung",
"外部": "extern"
"外部": "extern",
"不添加辞书": "Kein Wörterbuch hinzufügen"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Startup method",
"直接启动": "Directly start",
"优先使用": "priority of use",
"外部": "external"
"外部": "external",
"不添加辞书": "Do not add a dictionary"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Modo de arranque",
"直接启动": "Arranque directo",
"优先使用": "Uso prioritario",
"外部": "Exterior"
"外部": "Exterior",
"不添加辞书": "Sin agregar diccionarios"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Mode de démarrage",
"直接启动": "Démarrage direct",
"优先使用": "Utilisation prioritaire",
"外部": "Extérieur"
"外部": "Extérieur",
"不添加辞书": "Pas d'ajout de discours"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Metodo di avvio",
"直接启动": "Avvia direttamente",
"优先使用": "priorità d'uso",
"外部": "esterno"
"外部": "esterno",
"不添加辞书": "Non aggiungere un dizionario"
}

View File

@ -842,5 +842,6 @@
"启动方式": "起動モード",
"直接启动": "ダイレクトスタート",
"优先使用": "優先的に使用",
"外部": "外部"
"外部": "外部",
"不添加辞书": "辞書を追加しない"
}

View File

@ -842,5 +842,6 @@
"启动方式": "시작 방법",
"直接启动": "직접 시작",
"优先使用": "우선 사용",
"外部": "외부"
"外部": "외부",
"不添加辞书": "사서 를 넣지 않다"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Opstartmethode",
"直接启动": "Direct starten",
"优先使用": "prioriteit van het gebruik",
"外部": "extern"
"外部": "extern",
"不添加辞书": "Geen woordenboek toevoegen"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Metoda uruchomienia",
"直接启动": "Bezpośredni start",
"优先使用": "priorytet stosowania",
"外部": "zewnętrzne"
"外部": "zewnętrzne",
"不添加辞书": "Nie dodawaj słownika"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Método de arranque",
"直接启动": "Iniciar directamente",
"优先使用": "prioridade de utilização",
"外部": "externo"
"外部": "externo",
"不添加辞书": "Não adicionar um dicionário"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Режим запуска",
"直接启动": "Прямой запуск",
"优先使用": "Приоритетное использование",
"外部": "Внешний"
"外部": "Внешний",
"不添加辞书": "Не добавлять слова"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Startmetod",
"直接启动": "Starta direkt",
"优先使用": "prioritet för användning",
"外部": "extern"
"外部": "extern",
"不添加辞书": "Lägg inte till en ordlista"
}

View File

@ -842,5 +842,6 @@
"启动方式": "วิธีการเริ่มต้น",
"直接启动": "เริ่มต้นโดยตรง",
"优先使用": "ใช้ลำดับความสำคัญ",
"外部": "ภายนอก"
"外部": "ภายนอก",
"不添加辞书": "ไม่เพิ่มสำนวน"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Başlangıç yöntemi",
"直接启动": "Direkten başla",
"优先使用": "kullanımın önceliği",
"外部": "dış"
"外部": "dış",
"不添加辞书": "Sözlük eklemeyin"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Метод запуску",
"直接启动": "Прямо запустити",
"优先使用": "пріоритет використання",
"外部": "зовнішній"
"外部": "зовнішній",
"不添加辞书": "Не додавати словник"
}

View File

@ -842,5 +842,6 @@
"启动方式": "Cách bắt đầu",
"直接启动": "Khởi động trực tiếp",
"优先使用": "Ưu tiên sử dụng",
"外部": "Bên ngoài"
"外部": "Bên ngoài",
"不添加辞书": "Không thêm từ điển"
}

View File

@ -842,5 +842,6 @@
"启动方式": "",
"直接启动": "",
"优先使用": "",
"外部": ""
"外部": "",
"不添加辞书": ""
}