Compare commits
7 Commits
a5df7f0477
...
e57770f796
Author | SHA1 | Date | |
---|---|---|---|
e57770f796
|
|||
49cd77ee38
|
|||
d26b9774a0
|
|||
9a27d67dc0
|
|||
b0fff5af0c
|
|||
e54fac8aa4
|
|||
f111674260
|
@@ -1,6 +1,6 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
exclude: '(data/|documentation/|portprotonqt/locales/|dev-scripts/|\.venv/|venv/|.*\.svg$)'
|
||||
exclude: '(data/|documentation/|portprotonqt/locales/|portprotonqt/custom_data/|dev-scripts/|\.venv/|venv/|.*\.svg$)'
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
@@ -27,8 +27,9 @@ repos:
|
||||
name: pyright
|
||||
entry: pyright
|
||||
language: system
|
||||
'types_or': [python, pyi]
|
||||
types_or: [python, pyi]
|
||||
require_serial: true
|
||||
exclude: '^portprotonqt/themes/[^/]+/styles\.py$'
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
@@ -37,5 +38,5 @@ repos:
|
||||
entry: ./dev-scripts/check_qss_properties.py
|
||||
language: system
|
||||
types: [file]
|
||||
files: \.py$
|
||||
files: ^portprotonqt/themes/[^/]+/styles\.py$
|
||||
pass_filenames: false
|
||||
|
@@ -7,15 +7,15 @@
|
||||
|
||||
### Added
|
||||
- Переводы в переопределениях (за подробностями в документацию)
|
||||
|
||||
- Обложки и описания для всех автоинсталлов
|
||||
- Возможность указать ссылку для скачивания обложки в диалоге добавления игры
|
||||
|
||||
### Changed
|
||||
- Оптимизированны обложки автоинсталлов
|
||||
|
||||
- Папка custom_data исключена из сборки модуля для уменьшение его размера
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
### Contributors
|
||||
- @Vector_null
|
||||
|
||||
|
@@ -20,9 +20,9 @@ Current translation status:
|
||||
|
||||
| Locale | Progress | Translated |
|
||||
| :----- | -------: | ---------: |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 of 192 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 of 192 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 192 of 192 |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 of 194 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 of 194 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 194 of 194 |
|
||||
|
||||
---
|
||||
|
||||
|
@@ -20,9 +20,9 @@
|
||||
|
||||
| Локаль | Прогресс | Переведено |
|
||||
| :----- | -------: | ---------: |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 из 192 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 из 192 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 192 из 192 |
|
||||
| [de_DE](./de_DE/LC_MESSAGES/messages.po) | 0% | 0 из 194 |
|
||||
| [es_ES](./es_ES/LC_MESSAGES/messages.po) | 0% | 0 из 194 |
|
||||
| [ru_RU](./ru_RU/LC_MESSAGES/messages.po) | 100% | 194 из 194 |
|
||||
|
||||
---
|
||||
|
||||
|
Before Width: | Height: | Size: 720 KiB After Width: | Height: | Size: 720 KiB |
Before Width: | Height: | Size: 655 KiB After Width: | Height: | Size: 655 KiB |
Before Width: | Height: | Size: 315 KiB After Width: | Height: | Size: 315 KiB |
Before Width: | Height: | Size: 978 KiB After Width: | Height: | Size: 978 KiB |
Before Width: | Height: | Size: 650 KiB After Width: | Height: | Size: 650 KiB |
Before Width: | Height: | Size: 391 KiB After Width: | Height: | Size: 391 KiB |
Before Width: | Height: | Size: 710 KiB After Width: | Height: | Size: 710 KiB |
Before Width: | Height: | Size: 670 KiB After Width: | Height: | Size: 670 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 814 KiB After Width: | Height: | Size: 814 KiB |
Before Width: | Height: | Size: 566 KiB After Width: | Height: | Size: 566 KiB |
Before Width: | Height: | Size: 895 KiB After Width: | Height: | Size: 895 KiB |
Before Width: | Height: | Size: 627 KiB After Width: | Height: | Size: 627 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 722 KiB After Width: | Height: | Size: 722 KiB |
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import tempfile
|
||||
import re
|
||||
from typing import cast, TYPE_CHECKING
|
||||
from PySide6.QtGui import QPixmap, QIcon
|
||||
from PySide6.QtWidgets import (
|
||||
@@ -14,6 +15,7 @@ from portprotonqt.logger import get_logger
|
||||
import portprotonqt.themes.standart.styles as default_styles
|
||||
from portprotonqt.theme_manager import ThemeManager
|
||||
from portprotonqt.custom_widgets import AutoSizeButton
|
||||
from portprotonqt.downloader import Downloader
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from portprotonqt.main_window import MainWindow
|
||||
@@ -449,6 +451,7 @@ class AddGameDialog(QDialog):
|
||||
self.original_name = game_name
|
||||
self.last_exe_path = exe_path # Store last selected exe path
|
||||
self.last_cover_path = cover_path # Store last selected cover path
|
||||
self.downloader = Downloader(max_workers=4) # Initialize Downloader
|
||||
|
||||
self.setWindowTitle(_("Edit Game") if edit_mode else _("Add Game"))
|
||||
self.setModal(True)
|
||||
@@ -472,8 +475,7 @@ class AddGameDialog(QDialog):
|
||||
|
||||
# Exe path
|
||||
exe_label = QLabel(_("Path to Executable:"))
|
||||
exe_label.setStyleSheet(
|
||||
self.theme.PARAMS_TITLE_STYLE)
|
||||
exe_label.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
|
||||
|
||||
self.exeEdit = CustomLineEdit(self, theme=self.theme)
|
||||
self.exeEdit.setStyleSheet(self.theme.ADDGAME_INPUT_STYLE)
|
||||
@@ -550,7 +552,7 @@ class AddGameDialog(QDialog):
|
||||
exeBrowseButton.setFixedWidth(self.exeEdit.width())
|
||||
coverBrowseButton.setFixedWidth(self.coverEdit.width())
|
||||
|
||||
# Вызываем после отображения окна, когда размеры установлены, чтобы реально дождаться, когда всё сформируется
|
||||
# Вызываем после отображения окна, когда размеры установлены
|
||||
QTimer.singleShot(0, update_button_widths)
|
||||
|
||||
# Обновляем превью, если в режиме редактирования
|
||||
@@ -615,15 +617,46 @@ class AddGameDialog(QDialog):
|
||||
"""Обработчик выбора файла обложки в FileExplorer"""
|
||||
if file_path and os.path.splitext(file_path)[1].lower() in ('.png', '.jpg', '.jpeg', '.bmp'):
|
||||
self.coverEdit.setText(file_path)
|
||||
self.last_cover_path = file_path # Update last selected cover path
|
||||
self.last_cover_path = file_path
|
||||
self.updatePreview()
|
||||
else:
|
||||
logger.warning(f"Selected file is not a valid image: {file_path}")
|
||||
|
||||
def handleDownloadedCover(self, file_path):
|
||||
"""Handle the downloaded cover image and update the preview."""
|
||||
if file_path and os.path.isfile(file_path):
|
||||
self.last_cover_path = file_path
|
||||
pixmap = QPixmap(file_path)
|
||||
if not pixmap.isNull():
|
||||
self.coverPreview.setPixmap(pixmap.scaled(250, 250, Qt.AspectRatioMode.KeepAspectRatio))
|
||||
else:
|
||||
self.coverPreview.setText(_("Invalid image"))
|
||||
else:
|
||||
self.coverPreview.setText(_("Failed to download cover"))
|
||||
logger.warning(f"Failed to download cover to {file_path}")
|
||||
|
||||
def updatePreview(self):
|
||||
"""Update the cover preview image."""
|
||||
cover_path = self.coverEdit.text().strip()
|
||||
exe_path = self.exeEdit.text().strip()
|
||||
if cover_path and os.path.isfile(cover_path):
|
||||
|
||||
# Check if cover_path is a URL
|
||||
url_pattern = r'^https?://[^\s/$.?#].[^\s]*$'
|
||||
if re.match(url_pattern, cover_path):
|
||||
# Create a temporary file for the downloaded image
|
||||
fd, local_path = tempfile.mkstemp(suffix=".png")
|
||||
os.close(fd)
|
||||
os.unlink(local_path)
|
||||
|
||||
# Start asynchronous download
|
||||
self.downloader.download_async(
|
||||
url=cover_path,
|
||||
local_path=local_path,
|
||||
timeout=10,
|
||||
callback=self.handleDownloadedCover
|
||||
)
|
||||
self.coverPreview.setText(_("Downloading cover..."))
|
||||
elif cover_path and os.path.isfile(cover_path):
|
||||
pixmap = QPixmap(cover_path)
|
||||
if not pixmap.isNull():
|
||||
self.coverPreview.setPixmap(pixmap.scaled(250, 250, Qt.AspectRatioMode.KeepAspectRatio))
|
||||
@@ -666,8 +699,8 @@ class AddGameDialog(QDialog):
|
||||
|
||||
os.makedirs(os.path.dirname(icon_path), exist_ok=True)
|
||||
|
||||
# Generate thumbnail (128x128) from exe
|
||||
if not generate_thumbnail(exe_path, icon_path, size=128):
|
||||
# Generate thumbnail (128x128) from exe if no cover is provided
|
||||
if not self.last_cover_path and not generate_thumbnail(exe_path, icon_path, size=128):
|
||||
logger.error(f"Failed to generate thumbnail from exe: {exe_path}")
|
||||
icon_path = "" # Set empty icon if generation fails
|
||||
|
||||
|
@@ -9,7 +9,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-07-03 19:29+0700\n"
|
||||
"POT-Creation-Date: 2025-07-06 17:56+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: de_DE\n"
|
||||
@@ -296,6 +296,12 @@ msgstr ""
|
||||
msgid "Invalid image"
|
||||
msgstr ""
|
||||
|
||||
msgid "Failed to download cover"
|
||||
msgstr ""
|
||||
|
||||
msgid "Downloading cover..."
|
||||
msgstr ""
|
||||
|
||||
msgid "No cover selected"
|
||||
msgstr ""
|
||||
|
||||
@@ -338,6 +344,9 @@ msgstr ""
|
||||
msgid "Pending"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr ""
|
||||
|
||||
msgid "Library"
|
||||
msgstr ""
|
||||
|
||||
@@ -362,9 +371,6 @@ msgstr ""
|
||||
msgid "Loading PortProton games..."
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr ""
|
||||
|
||||
msgid "Game Library"
|
||||
msgstr ""
|
||||
|
||||
|
@@ -9,7 +9,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-07-03 19:29+0700\n"
|
||||
"POT-Creation-Date: 2025-07-06 17:56+0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language: es_ES\n"
|
||||
@@ -296,6 +296,12 @@ msgstr ""
|
||||
msgid "Invalid image"
|
||||
msgstr ""
|
||||
|
||||
msgid "Failed to download cover"
|
||||
msgstr ""
|
||||
|
||||
msgid "Downloading cover..."
|
||||
msgstr ""
|
||||
|
||||
msgid "No cover selected"
|
||||
msgstr ""
|
||||
|
||||
@@ -338,6 +344,9 @@ msgstr ""
|
||||
msgid "Pending"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr ""
|
||||
|
||||
msgid "Library"
|
||||
msgstr ""
|
||||
|
||||
@@ -362,9 +371,6 @@ msgstr ""
|
||||
msgid "Loading PortProton games..."
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr ""
|
||||
|
||||
msgid "Game Library"
|
||||
msgstr ""
|
||||
|
||||
|
@@ -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-03 19:29+0700\n"
|
||||
"POT-Creation-Date: 2025-07-06 17:56+0500\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"
|
||||
@@ -294,6 +294,12 @@ msgstr ""
|
||||
msgid "Invalid image"
|
||||
msgstr ""
|
||||
|
||||
msgid "Failed to download cover"
|
||||
msgstr ""
|
||||
|
||||
msgid "Downloading cover..."
|
||||
msgstr ""
|
||||
|
||||
msgid "No cover selected"
|
||||
msgstr ""
|
||||
|
||||
@@ -336,6 +342,9 @@ msgstr ""
|
||||
msgid "Pending"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr ""
|
||||
|
||||
msgid "Library"
|
||||
msgstr ""
|
||||
|
||||
@@ -360,9 +369,6 @@ msgstr ""
|
||||
msgid "Loading PortProton games..."
|
||||
msgstr ""
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr ""
|
||||
|
||||
msgid "Game Library"
|
||||
msgstr ""
|
||||
|
||||
|
@@ -9,8 +9,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2025-07-03 19:29+0700\n"
|
||||
"PO-Revision-Date: 2025-07-03 19:28+0700\n"
|
||||
"POT-Creation-Date: 2025-07-06 17:56+0500\n"
|
||||
"PO-Revision-Date: 2025-07-06 17:56+0500\n"
|
||||
"Last-Translator: \n"
|
||||
"Language: ru_RU\n"
|
||||
"Language-Team: ru_RU <LL@li.org>\n"
|
||||
@@ -303,6 +303,12 @@ msgstr "Применить"
|
||||
msgid "Invalid image"
|
||||
msgstr "Недопустимое изображение"
|
||||
|
||||
msgid "Failed to download cover"
|
||||
msgstr "Не удалось скачать обложку"
|
||||
|
||||
msgid "Downloading cover..."
|
||||
msgstr "Скачивание обложки..."
|
||||
|
||||
msgid "No cover selected"
|
||||
msgstr "Обложка не выбрана"
|
||||
|
||||
@@ -345,6 +351,9 @@ msgstr "Бронза"
|
||||
msgid "Pending"
|
||||
msgstr "В ожидании"
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr "Неизвестная игра"
|
||||
|
||||
msgid "Library"
|
||||
msgstr "Библиотека"
|
||||
|
||||
@@ -369,9 +378,6 @@ msgstr "Загрузка игр из Steam..."
|
||||
msgid "Loading PortProton games..."
|
||||
msgstr "Загрузка игр из PortProton..."
|
||||
|
||||
msgid "Unknown Game"
|
||||
msgstr "Неизвестная игра"
|
||||
|
||||
msgid "Game Library"
|
||||
msgstr "Игровая библиотека"
|
||||
|
||||
|
@@ -44,7 +44,7 @@ dependencies = [
|
||||
portprotonqt = "portprotonqt.app:main"
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"portprotonqt" = ["themes/**/*", "locales/**/*", "custom_data/**/*"]
|
||||
"portprotonqt" = ["themes/**/*", "locales/**/*"]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
exclude = ["build-aux", "dev-scripts", "documentation", "data"]
|
||||
|