Rewritten class CustomLineEdit for removing hotkeys from translations #23
| @@ -10,7 +10,7 @@ import psutil | ||||
| import signal | ||||
| from PySide6.QtWidgets import QMessageBox, QDialog, QMenu, QLineEdit, QApplication | ||||
| from PySide6.QtCore import QUrl, QPoint, QObject, Signal, Qt | ||||
| from PySide6.QtGui import QDesktopServices, QIcon | ||||
| from PySide6.QtGui import QDesktopServices, QIcon, QKeySequence | ||||
| from portprotonqt.localization import _ | ||||
| from portprotonqt.config_utils import parse_desktop_entry, read_favorites, save_favorites | ||||
| from portprotonqt.steam_api import is_game_in_steam, add_to_steam, remove_from_steam | ||||
| @@ -1097,48 +1097,34 @@ class CustomLineEdit(QLineEdit): | ||||
|                 return QIcon(icon) | ||||
|             return QIcon() | ||||
|  | ||||
|         def add_action(text: str, shortcut: QKeySequence.StandardKey, icon_name: str, slot, enabled=True): | ||||
|             icon = get_safe_icon(icon_name) | ||||
|             shortcut_str = QKeySequence(shortcut).toString(QKeySequence.SequenceFormat.NativeText) | ||||
|             action_text = f"{text}\t{shortcut_str}" | ||||
|             action = menu.addAction(icon, action_text) | ||||
|             action.triggered.connect(slot) | ||||
|             action.setEnabled(enabled) | ||||
|  | ||||
|         menu = QMenu(self) | ||||
|  | ||||
|         if self.theme and hasattr(self.theme, "CONTEXT_MENU_STYLE"): | ||||
|             menu.setStyleSheet(self.theme.CONTEXT_MENU_STYLE) | ||||
|  | ||||
|         # Undo | ||||
|         undo = menu.addAction(get_safe_icon("undo"), _("Undo\tCtrl+Z")) | ||||
|         undo.triggered.connect(self.undo) | ||||
|         undo.setEnabled(self.isUndoAvailable()) | ||||
|  | ||||
|         # Redo | ||||
|         redo = menu.addAction(get_safe_icon("redo"), _("Redo\tCtrl+Y")) | ||||
|         redo.triggered.connect(self.redo) | ||||
|         redo.setEnabled(self.isRedoAvailable()) | ||||
|         add_action(_("Undo"), QKeySequence.StandardKey.Undo, "undo", self.undo, self.isUndoAvailable()) | ||||
|         add_action(_("Redo"), QKeySequence.StandardKey.Redo, "redo", self.redo, self.isRedoAvailable()) | ||||
|  | ||||
|         menu.addSeparator() | ||||
|  | ||||
|         # Cut | ||||
|         cut = menu.addAction(get_safe_icon("cut"), _("Cut\tCtrl+X")) | ||||
|         cut.triggered.connect(self.cut) | ||||
|         cut.setEnabled(self.hasSelectedText()) | ||||
|  | ||||
|         # Copy | ||||
|         copy = menu.addAction(get_safe_icon("copy"), _("Copy\tCtrl+C")) | ||||
|         copy.triggered.connect(self.copy) | ||||
|         copy.setEnabled(self.hasSelectedText()) | ||||
|  | ||||
|         # Paste | ||||
|         paste = menu.addAction(get_safe_icon("paste"), _("Paste\tCtrl+V")) | ||||
|         paste.triggered.connect(self.paste) | ||||
|         paste.setEnabled(QApplication.clipboard().mimeData().hasText()) | ||||
|  | ||||
|         # Delete | ||||
|         delete = menu.addAction(get_safe_icon("delete"), _("Delete\tDel")) | ||||
|         delete.triggered.connect(self._delete_selected_text) | ||||
|         delete.setEnabled(self.hasSelectedText()) | ||||
|         add_action(_("Cut"), QKeySequence.StandardKey.Cut, "cut", self.cut, self.hasSelectedText()) | ||||
|         add_action(_("Copy"), QKeySequence.StandardKey.Copy, "copy", self.copy, self.hasSelectedText()) | ||||
|         add_action(_("Paste"), QKeySequence.StandardKey.Paste, "paste", self.paste, | ||||
|                    QApplication.clipboard().mimeData().hasText()) | ||||
|         add_action(_("Delete"), QKeySequence.StandardKey.Delete, "delete", self._delete_selected_text, | ||||
|                    self.hasSelectedText()) | ||||
|  | ||||
|         menu.addSeparator() | ||||
|  | ||||
|         # Select All | ||||
|         select_all = menu.addAction(get_safe_icon("select_all"), _("Select All\tCtrl+A")) | ||||
|         select_all.triggered.connect(self.selectAll) | ||||
|         select_all.setEnabled(bool(self.text())) | ||||
|         add_action(_("Select All"), QKeySequence.StandardKey.SelectAll, "select_all", self.selectAll, bool(self.text())) | ||||
|  | ||||
|         menu.exec(event.globalPos()) | ||||
|  | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -9,7 +9,7 @@ msgid "" | ||||
| msgstr "" | ||||
| "Project-Id-Version: PROJECT VERSION\n" | ||||
| "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||||
| "POT-Creation-Date: 2025-07-02 22:45+0700\n" | ||||
| "POT-Creation-Date: 2025-07-03 19:29+0700\n" | ||||
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||||
| "Language: de_DE\n" | ||||
| @@ -239,25 +239,25 @@ msgstr "" | ||||
| msgid "Failed to remove game '{game_name}' from Steam: {error}" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Undo\tCtrl+Z" | ||||
| msgid "Undo" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Redo\tCtrl+Y" | ||||
| msgid "Redo" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Cut\tCtrl+X" | ||||
| msgid "Cut" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Copy\tCtrl+C" | ||||
| msgid "Copy" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Paste\tCtrl+V" | ||||
| msgid "Paste" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Delete\tDel" | ||||
| msgid "Delete" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Select All\tCtrl+A" | ||||
| msgid "Select All" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Select" | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -9,7 +9,7 @@ msgid "" | ||||
| msgstr "" | ||||
| "Project-Id-Version: PROJECT VERSION\n" | ||||
| "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||||
| "POT-Creation-Date: 2025-07-02 22:45+0700\n" | ||||
| "POT-Creation-Date: 2025-07-03 19:29+0700\n" | ||||
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||||
| "Language: es_ES\n" | ||||
| @@ -239,25 +239,25 @@ msgstr "" | ||||
| msgid "Failed to remove game '{game_name}' from Steam: {error}" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Undo\tCtrl+Z" | ||||
| msgid "Undo" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Redo\tCtrl+Y" | ||||
| msgid "Redo" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Cut\tCtrl+X" | ||||
| msgid "Cut" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Copy\tCtrl+C" | ||||
| msgid "Copy" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Paste\tCtrl+V" | ||||
| msgid "Paste" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Delete\tDel" | ||||
| msgid "Delete" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Select All\tCtrl+A" | ||||
| msgid "Select All" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Select" | ||||
|   | ||||
| @@ -9,7 +9,7 @@ msgid "" | ||||
| msgstr "" | ||||
| "Project-Id-Version: PortProtonQt 0.1.1\n" | ||||
| "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||||
| "POT-Creation-Date: 2025-07-02 22:52+0700\n" | ||||
| "POT-Creation-Date: 2025-07-03 19:29+0700\n" | ||||
| "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||||
| "Language-Team: LANGUAGE <LL@li.org>\n" | ||||
| @@ -237,25 +237,25 @@ msgstr "" | ||||
| msgid "Failed to remove game '{game_name}' from Steam: {error}" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Undo\tCtrl+Z" | ||||
| msgid "Undo" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Redo\tCtrl+Y" | ||||
| msgid "Redo" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Cut\tCtrl+X" | ||||
| msgid "Cut" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Copy\tCtrl+C" | ||||
| msgid "Copy" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Paste\tCtrl+V" | ||||
| msgid "Paste" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Delete\tDel" | ||||
| msgid "Delete" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Select All\tCtrl+A" | ||||
| msgid "Select All" | ||||
| msgstr "" | ||||
|  | ||||
| msgid "Select" | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| @@ -9,18 +9,17 @@ msgid "" | ||||
| msgstr "" | ||||
| "Project-Id-Version: PROJECT VERSION\n" | ||||
| "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||||
| "POT-Creation-Date: 2025-07-02 22:45+0700\n" | ||||
| "PO-Revision-Date: 2025-07-02 22:51+0700\n" | ||||
| "POT-Creation-Date: 2025-07-03 19:29+0700\n" | ||||
| "PO-Revision-Date: 2025-07-03 19:28+0700\n" | ||||
| "Last-Translator: \n" | ||||
| "Language-Team: ru_RU <LL@li.org>\n" | ||||
| "Language: ru_RU\n" | ||||
| "Language-Team: ru_RU <LL@li.org>\n" | ||||
| "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " | ||||
| "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=utf-8\n" | ||||
| "Content-Transfer-Encoding: 8bit\n" | ||||
| "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 " | ||||
| "&& (n%100<10 || n%100>=20) ? 1 : 2);\n" | ||||
| "Generated-By: Babel 2.17.0\n" | ||||
| "X-Generator: Poedit 3.6\n" | ||||
|  | ||||
| msgid "Error" | ||||
| msgstr "Ошибка" | ||||
| @@ -87,11 +86,11 @@ msgstr "Успешно" | ||||
|  | ||||
| #, python-brace-format | ||||
| msgid "" | ||||
| "'{game_name}' was added to Steam. Please restart Steam for changes to take " | ||||
| "effect." | ||||
| "'{game_name}' was added to Steam. Please restart Steam for changes to " | ||||
| "take effect." | ||||
| msgstr "" | ||||
| "'{game_name}' был(а) добавлен(а) в Steam. Пожалуйста, перезапустите Steam, " | ||||
| "чтобы изменения вступили в силу." | ||||
| "'{game_name}' был(а) добавлен(а) в Steam. Пожалуйста, перезапустите " | ||||
| "Steam, чтобы изменения вступили в силу." | ||||
|  | ||||
| #, python-brace-format | ||||
| msgid "Executable not found for game: {game_name}" | ||||
| @@ -191,8 +190,8 @@ msgstr "Подтвердите удаление" | ||||
|  | ||||
| #, python-brace-format | ||||
| msgid "" | ||||
| "Are you sure you want to delete '{game_name}'? This will remove the .desktop " | ||||
| "file and custom data." | ||||
| "Are you sure you want to delete '{game_name}'? This will remove the " | ||||
| ".desktop file and custom data." | ||||
| msgstr "" | ||||
| "Вы уверены, что хотите удалить '{game_name}'? Это приведёт к удалению " | ||||
| "файла .desktop и пользовательских данных." | ||||
| @@ -237,36 +236,36 @@ msgstr "Не удалось добавить '{game_name}' в Steam: {error}" | ||||
|  | ||||
| #, python-brace-format | ||||
| msgid "" | ||||
| "'{game_name}' was removed from Steam. Please restart Steam for changes to take " | ||||
| "effect." | ||||
| "'{game_name}' was removed from Steam. Please restart Steam for changes to" | ||||
| " take effect." | ||||
| msgstr "" | ||||
| "'{game_name}' был(а) удалён(а) из Steam. Пожалуйста, перезапустите Steam, чтобы " | ||||
| "изменения вступили в силу." | ||||
| "'{game_name}' был(а) удалён(а) из Steam. Пожалуйста, перезапустите Steam," | ||||
| " чтобы изменения вступили в силу." | ||||
|  | ||||
| #, python-brace-format | ||||
| msgid "Failed to remove game '{game_name}' from Steam: {error}" | ||||
| msgstr "Не удалось удалить игру '{game_name}' из Steam: {error}" | ||||
|  | ||||
| msgid "Undo\tCtrl+Z" | ||||
| msgstr "Отмена\tCtrl+Z" | ||||
| msgid "Undo" | ||||
| msgstr "Отмена" | ||||
|  | ||||
| msgid "Redo\tCtrl+Y" | ||||
| msgstr "Повтор\tCtrl+Y" | ||||
| msgid "Redo" | ||||
| msgstr "Повтор" | ||||
|  | ||||
| msgid "Cut\tCtrl+X" | ||||
| msgstr "Вырезать\tCtrl+X" | ||||
| msgid "Cut" | ||||
| msgstr "Вырезать" | ||||
|  | ||||
| msgid "Copy\tCtrl+C" | ||||
| msgstr "Копировать\tCtrl+C" | ||||
| msgid "Copy" | ||||
| msgstr "Копировать" | ||||
|  | ||||
| msgid "Paste\tCtrl+V" | ||||
| msgstr "Вставить\tCtrl+V" | ||||
| msgid "Paste" | ||||
| msgstr "Вставить" | ||||
|  | ||||
| msgid "Delete\tDel" | ||||
| msgstr "Удалить\tDel" | ||||
| msgid "Delete" | ||||
| msgstr "Удалить" | ||||
|  | ||||
| msgid "Select All\tCtrl+A" | ||||
| msgstr "Выделить всё\tCtrl+A" | ||||
| msgid "Select All" | ||||
| msgstr "Выбрать всё" | ||||
|  | ||||
| msgid "Select" | ||||
| msgstr "Выбрать" | ||||
| @@ -508,7 +507,8 @@ msgstr "Подтвердите удаление" | ||||
|  | ||||
| msgid "Are you sure you want to reset all settings? This action cannot be undone." | ||||
| msgstr "" | ||||
| "Вы уверены, что хотите сбросить все настройки? Это действие нельзя отменить." | ||||
| "Вы уверены, что хотите сбросить все настройки? Это действие нельзя " | ||||
| "отменить." | ||||
|  | ||||
| msgid "Settings reset. Restarting..." | ||||
| msgstr "Настройки сброшены. Перезапуск..." | ||||
| @@ -653,3 +653,4 @@ msgstr "мин." | ||||
|  | ||||
| msgid "sec." | ||||
| msgstr "сек." | ||||
|  | ||||
|   | ||||
| @@ -109,7 +109,7 @@ CONTEXT_MENU_STYLE = f""" | ||||
|         margin-left: 15px; | ||||
|     }} | ||||
|     QMenu::item {{ | ||||
|         padding: 8px 20px 8px 10px; | ||||
|         padding: 10px 20px 10px 10px; | ||||
|         background: {color_h}; | ||||
|         border-radius: {border_radius_a}; | ||||
|         color: {color_f}; | ||||
| @@ -134,7 +134,7 @@ CONTEXT_MENU_STYLE = f""" | ||||
|     QMenu::separator {{ | ||||
|         height: 1px; | ||||
|         background-color: #7f7f7f; | ||||
|         margin: 4px 8px; | ||||
|         margin: 3px 6px; | ||||
|     }} | ||||
| """ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user