diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index 111306bc..ae25aea4 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -1223,6 +1223,14 @@ class dialog_syssetting(QDialog): QLabel(_TR("显示标题")), getsimpleswitch(globalconfig, "showgametitle"), ) + formLayout.addRow( + _TR("显示的项目"), + getsimplecombobox( + _TRL(["GLOBAL", "首位的", "指定的"]), + globalconfig, + "vispolicy", + ), + ) self.show() @@ -1461,12 +1469,34 @@ class dialog_savedgame_integrated(saveposwindow): ) +def calculatetagidx(tagid): + i = 0 + for save in savegametaged: + if save is None and tagid is None: + return i + elif save and tagid and save["uid"] == tagid: + return i + i += 1 + + return None + + +def getreflist(reftagid): + _idx = calculatetagidx(reftagid) + if _idx is None: + return None + tag = savegametaged[_idx] + if tag is None: + return savehook_new_list + return tag["games"] + + class dialog_savedgame_new(QWidget): def clicked2(self): try: game = self.currentfocuspath - idx2 = savehook_new_list.index(game) - savehook_new_list.pop(idx2) + idx2 = self.reflist.index(game) + self.reflist.pop(idx2) idx2 = self.idxsave.index(game) self.flow.removeidx(idx2) @@ -1484,10 +1514,10 @@ class dialog_savedgame_new(QWidget): opendir(self.currentfocuspath) def clicked3_batch(self): - addgamebatch(lambda res: self.newline(res, True), savehook_new_list) + addgamebatch(lambda res: self.newline(res, True), self.reflist) def clicked3(self): - addgamesingle(lambda res: self.newline(res, True), savehook_new_list) + addgamesingle(lambda res: self.newline(res, True), self.reflist) def tagschanged(self, tags): self.currtags = tags @@ -1501,7 +1531,7 @@ class dialog_savedgame_new(QWidget): self.formLayout.insertWidget(self.formLayout.count() - 1, self.flow) idx = 0 - for k in savehook_new_list: + for k in self.reflist: if newtags != self.currtags: break notshow = False @@ -1583,6 +1613,17 @@ class dialog_savedgame_new(QWidget): global _global_dialog_savedgame_new _global_dialog_savedgame_new = self formLayout = QVBoxLayout() + if globalconfig["vispolicy"] == 0: + self.reflist = savehook_new_list + elif globalconfig["vispolicy"] == 1: + if savegametaged[0] is None: + self.reflist = savehook_new_list + else: + self.reflist = savegametaged[0]["games"] + elif globalconfig["vispolicy"] == 2: + self.reflist = getreflist(globalconfig["currvislistuid"]) + if self.reflist is None: + self.reflist = savehook_new_list layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) @@ -1684,9 +1725,9 @@ class dialog_savedgame_new(QWidget): self.idxsave.insert(idx2, self.idxsave.pop(idx1)) self.flow.switchidx(idx1, idx2) - idx1 = savehook_new_list.index(game) - idx2 = savehook_new_list.index(game2) - savehook_new_list.insert(idx2, savehook_new_list.pop(idx1)) + idx1 = self.reflist.index(game) + idx2 = self.reflist.index(game2) + self.reflist.insert(idx2, self.reflist.pop(idx1)) def showsettingdialog(self): try: @@ -2141,7 +2182,7 @@ class dialog_savedgame_v3(QWidget): def newline(self, res): self.reallist[self.reftagid].insert(0, res) - self.stack.w(self.calculatetagidx(self.reftagid)).insertw( + self.stack.w(calculatetagidx(self.reftagid)).insertw( 0, functools.partial( self.delayitemcreater, @@ -2198,8 +2239,8 @@ class dialog_savedgame_v3(QWidget): __save = self.reftagid self.reftagid = uid - if path not in self.getreflist(): - self.getreflist().insert(0, path) + if path not in getreflist(self.reftagid): + getreflist(self.reftagid).insert(0, path) self.newline(path) self.reftagid = __save @@ -2326,23 +2367,12 @@ class dialog_savedgame_v3(QWidget): rowreal += 1 def taglistrerank(self, tagid, dx): - idx1 = self.calculatetagidx(tagid) + idx1 = calculatetagidx(tagid) idx2 = (idx1 + dx) % len(savegametaged) savegametaged.insert(idx2, savegametaged.pop(idx1)) self.stack.switchidx(idx1, idx2) - def calculatetagidx(self, tagid): - i = 0 - for save in savegametaged: - if save is None and tagid is None: - break - elif save and tagid and save["uid"] == tagid: - break - i += 1 - - return i - def tagbuttonmenu(self, tagid): self.currentfocuspath = None self.reftagid = tagid @@ -2354,7 +2384,7 @@ class dialog_savedgame_v3(QWidget): Downaction = QAction(_TR("下移")) addgame = QAction(_TR("添加游戏")) batchadd = QAction(_TR("批量添加")) - + setasvis = QAction(_TR("设为显示的项目")) menu.addAction(Upaction) menu.addAction(Downaction) if tagid: @@ -2364,9 +2394,14 @@ class dialog_savedgame_v3(QWidget): menu.addAction(dellist) menu.addAction(addgame) menu.addAction(batchadd) + if globalconfig["vispolicy"] == 2: + menu.addAction(setasvis) + action = menu.exec(QCursor.pos()) if action == addgame: self.clicked3() + elif action == setasvis: + globalconfig["currvislistuid"] = self.reftagid elif action == batchadd: self.clicked3_batch() elif action == Upaction: @@ -2387,7 +2422,7 @@ class dialog_savedgame_v3(QWidget): title = _dia.text[0].text() if title != "": - i = self.calculatetagidx(tagid) + i = calculatetagidx(tagid) if action == addlist: tag = { "title": title, @@ -2403,7 +2438,7 @@ class dialog_savedgame_v3(QWidget): savegametaged[i]["title"] = title elif action == dellist: - i = self.calculatetagidx(tagid) + i = calculatetagidx(tagid) savegametaged.pop(i) self.stack.popw(i) self.reallist.pop(tagid) @@ -2420,31 +2455,19 @@ class dialog_savedgame_v3(QWidget): ) return shrinkableitem(_btn, opened) - def getreflist(self): - tag = savegametaged[self.calculatetagidx(self.reftagid)] - if tag is None: - return savehook_new_list - return tag["games"] - - def getrefid(self): - tag = savegametaged[self.calculatetagidx(self.reftagid)] - if tag is None: - return None - return tag["uid"] - def moverank(self, dx): game = self.currentfocuspath - idx1 = self.reallist[self.getrefid()].index(game) - idx2 = (idx1 + dx) % len(self.reallist[self.getrefid()]) - game2 = self.reallist[self.getrefid()][idx2] - self.reallist[self.getrefid()].insert( - idx2, self.reallist[self.getrefid()].pop(idx1) + idx1 = self.reallist[self.reftagid].index(game) + idx2 = (idx1 + dx) % len(self.reallist[self.reftagid]) + game2 = self.reallist[self.reftagid][idx2] + self.reallist[self.reftagid].insert( + idx2, self.reallist[self.reftagid].pop(idx1) ) - self.stack.w(self.calculatetagidx(self.reftagid)).switchidx(idx1, idx2) - idx1 = self.getreflist().index(game) - idx2 = self.getreflist().index(game2) - self.getreflist().insert(idx2, self.getreflist().pop(idx1)) + self.stack.w(calculatetagidx(self.reftagid)).switchidx(idx1, idx2) + idx1 = getreflist(self.reftagid).index(game) + idx2 = getreflist(self.reftagid).index(game2) + getreflist(self.reftagid).insert(idx2, getreflist(self.reftagid).pop(idx1)) def clicked2(self): if not self.currentfocuspath: @@ -2452,13 +2475,13 @@ class dialog_savedgame_v3(QWidget): try: game = self.currentfocuspath - idx2 = self.getreflist().index(game) - self.getreflist().pop(idx2) + idx2 = getreflist(self.reftagid).index(game) + getreflist(self.reftagid).pop(idx2) - idx2 = self.reallist[self.getrefid()].index(game) - self.reallist[self.getrefid()].pop(idx2) + idx2 = self.reallist[self.reftagid].index(game) + self.reallist[self.reftagid].pop(idx2) clickitem.clearfocus() - group0 = self.stack.w(self.calculatetagidx(self.reftagid)) + group0 = self.stack.w(calculatetagidx(self.reftagid)) group0.popw(idx2) try: group0.w(idx2).click() @@ -2471,10 +2494,10 @@ class dialog_savedgame_v3(QWidget): opendir(self.currentfocuspath) def clicked3_batch(self): - addgamebatch(lambda res: self.newline(res), self.getreflist()) + addgamebatch(lambda res: self.newline(res), getreflist(self.reftagid)) def clicked3(self): - addgamesingle(lambda res: self.newline(res), self.getreflist()) + addgamesingle(lambda res: self.newline(res), getreflist(self.reftagid)) def clicked(self): startgamecheck(self, self.currentfocuspath) diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index b7c17216..9547d102 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -171,6 +171,8 @@ 500, 500 ], + "vispolicy": 0, + "currvislistuid" : null, "multiregion": false, "rememberocrregions": false, "ocrregions": [], diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index c58a3a5e..fae70990 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -827,5 +827,9 @@ "复制": "نسخ", "画廊": "معرض", "删除图片": "حذف الصور", - "备注中自动填入翻译": "التلقائي ملء الترجمة في الملاحظات" + "备注中自动填入翻译": "التلقائي ملء الترجمة في الملاحظات", + "显示的项目": "عرض البنود", + "首位的": "أولا", + "指定的": "محدد", + "设为显示的项目": "عرض البند" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index b3c81a6e..d153e1ef 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -827,5 +827,9 @@ "复制": "複製", "画廊": "畫廊", "删除图片": "删除圖片", - "备注中自动填入翻译": "備註中自動填入翻譯" + "备注中自动填入翻译": "備註中自動填入翻譯", + "显示的项目": "顯示的項目", + "首位的": "首位的", + "指定的": "指定的", + "设为显示的项目": "設為顯示的項目" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index 1261abef..50d946e2 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -827,5 +827,9 @@ "复制": "copy", "画廊": "gallery", "删除图片": "Delete image", - "备注中自动填入翻译": "Automatically fill in translation in remarks" + "备注中自动填入翻译": "Automatically fill in translation in remarks", + "显示的项目": "Displayed items", + "首位的": "First place", + "指定的": "Designated", + "设为显示的项目": "Set as Displayed Project" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index 532e0362..71581e24 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -827,5 +827,9 @@ "复制": "Copiar", "画廊": "Galería", "删除图片": "Eliminar imagen", - "备注中自动填入翻译": "Rellene automáticamente la traducción en las Notas" + "备注中自动填入翻译": "Rellene automáticamente la traducción en las Notas", + "显示的项目": "Los proyectos mostrados", + "首位的": "Primero", + "指定的": "Designado", + "设为显示的项目": "Artículos configurados para mostrar" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index 11a138f9..af15a245 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -827,5 +827,9 @@ "复制": "Copier", "画廊": "Galerie", "删除图片": "Supprimer une image", - "备注中自动填入翻译": "Remplir automatiquement la traduction dans les notes" + "备注中自动填入翻译": "Remplir automatiquement la traduction dans les notes", + "显示的项目": "Projets affichés", + "首位的": "La première", + "指定的": "Spécifié", + "设为显示的项目": "Les éléments à afficher" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index cbb4077c..fe36bf8f 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -827,5 +827,9 @@ "复制": "copia", "画廊": "gallery", "删除图片": "Elimina immagine", - "备注中自动填入翻译": "Compilare automaticamente la traduzione in commenti" + "备注中自动填入翻译": "Compilare automaticamente la traduzione in commenti", + "显示的项目": "Articoli visualizzati", + "首位的": "Primo posto", + "指定的": "Designato", + "设为显示的项目": "Imposta come progetto visualizzato" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index 115125d3..a7f3822c 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -827,5 +827,9 @@ "复制": "レプリケーション", "画廊": "ギャラリー", "删除图片": "画像を削除", - "备注中自动填入翻译": "注記に翻訳を自動的に記入する" + "备注中自动填入翻译": "注記に翻訳を自動的に記入する", + "显示的项目": "表示されるアイテム", + "首位的": "トップ", + "指定的": "指定された", + "设为显示的项目": "表示する項目として設定" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index e989d04d..49a454a4 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -827,5 +827,9 @@ "复制": "복제", "画廊": "갤러리", "删除图片": "그림 삭제", - "备注中自动填入翻译": "메모에 번역 자동 입력" + "备注中自动填入翻译": "메모에 번역 자동 입력", + "显示的项目": "표시된 항목", + "首位的": "수위의", + "指定的": "지정된", + "设为显示的项目": "표시할 항목으로 설정" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index e64b18ed..67b9be96 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -827,5 +827,9 @@ "复制": "kopia", "画廊": "galeria", "删除图片": "Usuń obraz", - "备注中自动填入翻译": "Automatycznie wypełniaj tłumaczenie w uwagach" + "备注中自动填入翻译": "Automatycznie wypełniaj tłumaczenie w uwagach", + "显示的项目": "Wyświetlane elementy", + "首位的": "Pierwsze miejsce", + "指定的": "Wyznaczone", + "设为显示的项目": "Ustaw jako wyświetlany projekt" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index 3eea4e9e..b5aa03eb 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -827,5 +827,9 @@ "复制": "Копирование", "画廊": "Галерея", "删除图片": "Удалить изображение", - "备注中自动填入翻译": "Автоматически заполнять переводы" + "备注中自动填入翻译": "Автоматически заполнять переводы", + "显示的项目": "Показать проект", + "首位的": "Первый", + "指定的": "Назначено", + "设为显示的项目": "Показать проект" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index 13f19251..e55b5e72 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -827,5 +827,9 @@ "复制": "คัดลอก", "画廊": "แกลเลอรี่", "删除图片": "ลบรูปภาพ", - "备注中自动填入翻译": "กรอกคำแปลโดยอัตโนมัติในหมายเหตุ" + "备注中自动填入翻译": "กรอกคำแปลโดยอัตโนมัติในหมายเหตุ", + "显示的项目": "รายการที่แสดง", + "首位的": "อันดับแรก", + "指定的": "ระบุ", + "设为显示的项目": "รายการที่ตั้งเป็นจอแสดงผล" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index 5644287d..035f7e3f 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -827,5 +827,9 @@ "复制": "kopyalama", "画廊": "Galeri", "删除图片": "Resimi sil", - "备注中自动填入翻译": "Özellikle tercüme doldur" + "备注中自动填入翻译": "Özellikle tercüme doldur", + "显示的项目": "Gösterilen öğeler", + "首位的": "İlk yer", + "指定的": "Tasarlanmış", + "设为显示的项目": "Gösterilen Proje olarak ayarlayın" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index b447647f..2dd9412c 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -827,5 +827,9 @@ "复制": "копіювати", "画廊": "галерія", "删除图片": "Вилучити зображення", - "备注中自动填入翻译": "Автоматично заповнювати переклад у зауваження" + "备注中自动填入翻译": "Автоматично заповнювати переклад у зауваження", + "显示的项目": "Показані елементи", + "首位的": "Перше місце", + "指定的": "Визначено", + "设为显示的项目": "Встановити як показаний проект" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index 84a5d200..f2f19fea 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -827,5 +827,9 @@ "复制": "Sao chép", "画廊": "Thư viện", "删除图片": "Xóa ảnh", - "备注中自动填入翻译": "Tự động điền vào bản dịch trong ghi chú" + "备注中自动填入翻译": "Tự động điền vào bản dịch trong ghi chú", + "显示的项目": "Mục hiển thị", + "首位的": "Đầu tiên", + "指定的": "Đã xác định", + "设为显示的项目": "Mục được đặt làm Hiển thị" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index f2b42e81..e1b65a9a 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -827,5 +827,9 @@ "复制": "", "画廊": "", "删除图片": "", - "备注中自动填入翻译": "" + "备注中自动填入翻译": "", + "显示的项目": "", + "首位的": "", + "指定的": "", + "设为显示的项目": "" } \ No newline at end of file