Compare commits

...

14 Commits

Author SHA1 Message Date
Mikhail Tergoev
fb0336b3ef fixed ppdgr2 script 2025-12-05 16:01:58 +03:00
Mikhail Tergoev
5095e73409 Merge branch 'minergenon-devel' 2025-12-05 15:53:32 +03:00
Mikhail Tergoev
bc6000018b returned prefix separation for nalog programs 2025-12-05 15:51:47 +03:00
Sergey Palcheh
e3adf19624 fixed the display of icons for t-flex* in the manual installation tab 2025-12-04 14:03:33 +06:00
Sergey Palcheh
dc7a996060 added ICONS_BUTTON_GUI variable for GUI 2025-12-04 13:59:54 +06:00
Sergey Palcheh
eca1905c62 added a default icon for files.exe without an icon 2025-12-04 12:49:03 +06:00
Sergey Palcheh
371b2b7484 the prefix name was added to the list immediately after it was restored 2025-12-04 09:55:38 +06:00
Mikhail Tergoev
1f4cb54f54 revert d3d* for winetricks 2025-12-03 17:33:20 +03:00
Mikhail Tergoev
af52bd74d0 Merge branch 'minergenon-devel' 2025-12-03 14:55:26 +03:00
Sergey Palcheh
ded62bd9ac the description of the prepared prefix has been corrected 2025-12-03 12:43:49 +06:00
Sergey Palcheh
15b6fdd216 added HiDPI support 2025-12-02 13:28:35 +06:00
Sergey Palcheh
33bba61891 the choice of the prefix template has been changed 2025-12-01 10:45:36 +06:00
Mikhail Tergoev
cbf0bdbf8a added check restore_pfx.sh after restor-prefix 2025-11-26 13:17:27 +03:00
Mikhail Tergoev
5953d4b122 Merge branch 'minergenon-devel' 2025-11-24 13:49:07 +03:00
11 changed files with 276 additions and 82 deletions

BIN
image/wh_default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -2,7 +2,7 @@
# info_ru: Ручная установка дополнений для T-FLEX CAD 17 или 18
########################################################################
export PROG_NAME="T-FLEX CAD 17/18"
export PROG_ICON="tflexcad"
export ICONS_BUTTON_GUI="tflexcad17 tflexcad18"
export WH_WINE_USE="wine-10.18.1-tflex-alt2-wow64"
export BASE_PFX="tflex_pfx_x64_v03"
export WINEARCH="win64"

View File

@@ -2,7 +2,7 @@
# info_ru: Ручная установка дополнений для T-FLEX DOCS 17 или 18
########################################################################
export PROG_NAME="T-FLEX DOCS 17/18"
export PROG_ICON="tflexcad"
export PROG_ICON="tflexdoc17"
export WH_WINE_USE="wine-10.18.1-tflex-alt2-wow64"
export BASE_PFX="tflex_pfx_x64_v03"
export WINEARCH="win64"

View File

@@ -180,9 +180,6 @@ dfb44ce5e5af7dba1686932c63d6b05e5dd6919a21c78130a7d1d0271b93958e audiorecstatio
# create with wine_x_tkg_10-0_amd64 (universal user: xuser)
# winetricks dotnet48 gdiplus vcrun6sp6 vcrun2005 vcrun2019 d3dx11_42 d3dx11_43 d3dx9 d3dcompiler_42 d3dcompiler_43 d3dcompiler_46 d3dcompiler_47 richtx32 riched30 riched20 msxml6 dotnet20
# addons with ODBC, SSH, *.reg
0f4ef434df07bc338ae308af44330590eaa1d9c94b64850514e55b960642d0eb scadoffice_addons_v02.tar.xz
ef7e8f1ba785d48e4ea287feed5b79bd630d423e59efadb43da9653adefef218 ais-lpu-client_pfx_x86_v01.tar.xz
# create with wine_x_tkg_10-0_i586 (universal user: xuser)
# winetricks vcrun2005 vcrun2008 dotnet20sp2 dotnet40 mfc42 7zip
@@ -191,3 +188,7 @@ f18864014fdb2fead0b45b5e70e95073072b89168df8cd6debba89081ac51a2a ksamu_pfx_x64_
# create with wine_x_tkg_10-0_i586 (universal user: xuser)
# winetricks msxml6 msxml4 msxml3 riched30 msls31 riched20 msftedit richtx32 fontsmooth=gray
# + manuall installed riched32
##### ADDONS #####
# addons with ODBC, SSH, *.reg
0f4ef434df07bc338ae308af44330590eaa1d9c94b64850514e55b960642d0eb scadoffice_addons_v02.tar.xz

View File

@@ -3,13 +3,13 @@
########################################################################
export PROG_URL="https://www.nalog.gov.ru"
export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="nalog"
export WINEPREFIX="declaration"
export PROG_NAME="Декларация"
export PROG_ICON="declarac"
export BASE_PFX="none"
export BASE_PFX="defpfx_x86_v01"
export WINEARCH="win32"
export INSTALL_DLL="msxml3 msxml4 msxml6 corefonts wsh57 vcrun6 jet40 gdiplus"
export WH_WINDOWS_VER="10"
export INSTALL_DLL="corefonts micross tahoma lucida riched20 comctl32 msxml3 msxml4 msxml6 mdac28 wsh57 vcrun6 vb6run jet40 gdiplus vcrun2019 dotnet20sp2 dotnet40 dotnet48"
try_get_page "https://www.nalog.gov.ru/rn77/program/5961249/"
VER_YEAR=$(read_page | grep -oP 'href="\K[^"]*.msi[^"]*' | awk -F'/' '{print $(NF-2)}' | head -n 1)

View File

@@ -6,10 +6,10 @@ export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="nalog"
export PROG_NAME="Налогоплательщик ЮЛ"
export PROG_ICON="npul"
export BASE_PFX="none"
export BASE_PFX="defpfx_x86_v01"
export WINEARCH="win32"
export INSTALL_DLL="msxml3 msxml4 msxml6 corefonts wsh57 vcrun6 jet40 gdiplus"
export WH_WINDOWS_VER="10"
export INSTALL_DLL="corefonts micross tahoma lucida riched20 comctl32 msxml3 msxml4 msxml6 mdac28 wsh57 vcrun6 vb6run jet40 gdiplus vcrun2019 dotnet20sp2 dotnet40 dotnet48"
try_get_page "https://data.nalog.ru/rn77/program/5961229/"
VER_MSI=$(read_page | grep -oP 'NalogUL\d+\.msi' | tail -1 | grep -oP '\d+')

View File

@@ -3,14 +3,14 @@
########################################################################
export PROG_URL="https://www.nalog.gov.ru"
export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="nalog"
export WINEPREFIX="ppdgr2"
export PROG_NAME="ППДГР-2"
export PROG_ICON="ppdgr"
export BASE_PFX="none"
export BASE_PFX="defpfx_dn48_x86_v01"
export WINEARCH="win32"
export INSTALL_DLL="dotnet48 msxml3 msxml4 msxml6 corefonts lucida wsh57 vcrun6 jet40 gdiplus"
export WH_WINDOWS_VER="10"
var_winedlloverride_update "msxml4=b,wininet=b"
export INSTALL_DLL="corefonts micross tahoma lucida riched20 comctl32 msxml3 msxml4 msxml6 mdac28 wsh57 vcrun6 vb6run jet40 gdiplus vcrun2019 dotnet20sp2 dotnet40 dotnet48"
try_get_page "https://www.nalog.gov.ru/rn77/program/5961277/"
VER_MSI_SLASH=$(read_page | grep -oP 'href="\K[^"]*.msi[^"]*' | awk -F'/' '{print $(NF-1)}' | head -n 1)
@@ -24,4 +24,3 @@ if try_download "https://data.nalog.ru/files/ppdgr/${VER_MSI_SLASH}/SetupPPDGR2.
WIN_FILE_EXEC="$DRIVE_C/АО ГНИВЦ/ППДГР-2/PPDGR2.exe"
create_desktop "$PROG_NAME" "$WIN_FILE_EXEC" "$PROG_ICON"
fi
https://data.nalog.ru/files/ppdgr/2.7.3/SetupPPDGR2.msi

View File

@@ -3,13 +3,14 @@
########################################################################
export PROG_URL="https://www.nalog.gov.ru"
export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="nalog"
export WINEPREFIX="soun"
export PROG_NAME="СОУН"
export PROG_ICON="soun"
export BASE_PFX="none"
export BASE_PFX="defpfx_x86_v01"
export WINEARCH="win32"
export INSTALL_DLL=""
export WH_WINDOWS_VER="10"
export INSTALL_DLL="corefonts micross tahoma lucida riched20 comctl32 msxml3 msxml4 msxml6 mdac28 wsh57 vcrun6 vb6run jet40 gdiplus vcrun2019 dotnet20sp2 dotnet40 dotnet48"
export WH_USE_EXTRA_FONTS="1"
try_get_page "https://www.nalog.gov.ru/rn77/program/5961268/"
VER_MSI_SLASH=$(read_page | grep -oP 'href="\K[^"]*.exe[^"]*' | awk -F'/' '{print $(NF-1)}' | head -n 1)

View File

@@ -6,10 +6,10 @@ export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="nalog"
export PROG_NAME="Тестер"
export PROG_ICON="tester"
export BASE_PFX="none"
export BASE_PFX="defpfx_x86_v01"
export WINEARCH="win32"
export INSTALL_DLL="msxml3 msxml4 msxml6 corefonts wsh57 vcrun6 jet40 gdiplus"
export WH_WINDOWS_VER="10"
export INSTALL_DLL="corefonts micross tahoma lucida riched20 comctl32 msxml3 msxml4 msxml6 mdac28 wsh57 vcrun6 vb6run jet40 gdiplus vcrun2019 dotnet20sp2 dotnet40 dotnet48"
try_get_page "https://www.nalog.gov.ru/rn77/program/5961279/"
VER_EXE_SLASH=$(read_page | grep -oP 'href="\K[^"]*.exe[^"]*' | awk -F'/' '{print $(NF-1)}' | tail -n 1)

View File

@@ -101,7 +101,7 @@ if [[ "$1" == "--debug" ]] ; then
export DXVK_NVAPI_LOG_LEVEL="error"
shift
else
check_variables WINEDEBUG "-all"
check_variables WINEDEBUG "-all,err+all"
check_variables DXVK_LOG_LEVEL "none"
check_variables VKD3D_SHADER_DEBUG "none"
check_variables VKD3D_DEBUG "none"
@@ -460,7 +460,7 @@ try_copy_wine_dll_to_pfx_64 () {
fi
}
try_copy_wine_dll_to_pfx_32() {
try_copy_wine_dll_to_pfx_32 () {
if [[ -d "$WINEDIR/lib/wine/i386-windows" ]] ; then
WINE_BUILD_DLL_32="$WINEDIR/lib/wine/i386-windows"
elif [[ -d "$WINEDIR/lib64/wine/i386-windows" ]] ; then
@@ -610,7 +610,7 @@ create_desktop () {
print_ok "Иконка успешно извлечена и сохранена: $icon_file"
else
print_warning "Не удалось извлечь иконку из $exe_file. Используется иконка по умолчанию."
icon_file="wine" # Запасной вариант
icon_file="$WH_IMAGE_PATH/wh_default.png" # Запасной вариант
fi
try_remove_dir "$tmp_ico_dir"
fi
@@ -620,7 +620,7 @@ create_desktop () {
# Случай 4: Запасной вариант по умолчанию
else
print_info "Иконка '$icon_arg' не найдена. Используется иконка по умолчанию."
icon_file="wine"
icon_file="$WH_IMAGE_PATH/wh_default.png"
fi
# --- Конец логики обработки иконки ---
@@ -1694,14 +1694,16 @@ select_wine_version() {
local total_versions_found=0
# --- System ---
local system_wine_display_name="system"
if command -v wine &>/dev/null; then
local system_wine_version
system_wine_version=$(wine --version 2>/dev/null)
[[ -n "$system_wine_version" ]] && system_wine_display_name="$system_wine_version"
# Добавляем системную версию только для 64-битного префикса
if [[ "$WINEARCH" == "win64" ]]; then
local system_wine_display_name="system"
if command -v wine &>/dev/null; then
local system_wine_version
system_wine_version=$(wine --version 2>/dev/null)
[[ -n "$system_wine_version" ]] && system_wine_display_name="$system_wine_version"
fi
options+=("--- SYSTEM ---" "$system_wine_display_name")
fi
options+=("--- SYSTEM ---")
options+=("$system_wine_display_name")
# --- Other versions from sha256sum.list ---
local current_group=""
@@ -1724,8 +1726,22 @@ select_wine_version() {
# Отображаем только группы, которые являются сборками WINE или PROTON
case "$current_group" in
"WINE WOW64"|"WINE AMD64"|"WINE I586")
local pretty_key="$current_group"
options+=("--- $pretty_key ---")
# Фильтрация групп в зависимости от архитектуры префикса
if [[ "$WINEARCH" == "win64" ]]; then
# Для 64-битного префикса скрываем группу I586
if [[ "$current_group" != "WINE I586" ]]; then
local pretty_key="$current_group"
options+=("--- $pretty_key ---")
else
current_group="" # Игнорируем группу I586
fi
elif [[ "$WINEARCH" == "win32" ]]; then
# Для 32-битного префикса скрываем только группу WOW64
if [[ "$current_group" != "WINE WOW64" ]]; then
local pretty_key="$current_group"
options+=("--- $pretty_key ---")
fi
fi
;;
*)
current_group=""
@@ -1736,11 +1752,14 @@ select_wine_version() {
local version_name=${filename%.tar.xz}
if [[ "$WINEARCH" == "win64" ]]; then
if [[ "$version_name" =~ (amd64|x86_64|wow64) ]] || ! [[ "$version_name" =~ i[3-6]86 ]]; then
# Для 64-битного префикса показываем только 64-битные версии
if ! [[ "$version_name" =~ i[3-6]86 ]]; then
group_versions+=("$version_name")
fi
else # win32
group_versions+=("$version_name")
else # Для 32-битного префикса показываем и i586, и amd64
if [[ "$version_name" =~ (i[3-6]86|amd64) ]]; then
group_versions+=("$version_name")
fi
fi
fi
done < "$sha256_file"
@@ -1824,13 +1843,7 @@ select_wine_version() {
print_info "Операция отменена."
return 1
fi
local selected_opt
selected_opt="${selectable_options[$user_choice]}"
if [[ "$selected_opt" == "$system_wine_display_name" ]]; then
export WH_WINE_USE="system"
else
export WH_WINE_USE="$selected_opt"
fi
export WH_WINE_USE="${selectable_options[$user_choice]}"
break
else
print_error "Неверный выбор. Введите число от 0 до $max_choice."
@@ -1839,6 +1852,67 @@ select_wine_version() {
return 0
}
select_prepared_prefix() {
local arch="$1"
local sha256_file="$DATA_PATH/sha256sum.list"
[[ ! -f "$sha256_file" ]] && fatal "Файл с описаниями префиксов не найден: $sha256_file"
options=()
descriptions=()
options+=("none")
descriptions+=("Создать чистый префикс без дополнительных библиотек")
local in_prefix_section=false
local current_description=""
local current_prefix_name=""
while IFS= read -r line; do
if [[ "$line" =~ ^#####[[:space:]]PREFIX[[:space:]]#####$ ]] ; then
in_prefix_section=true
continue
elif [[ "$line" =~ ^#####.* ]] ; then
in_prefix_section=false
fi
if [[ "$in_prefix_section" == true ]] ; then
if [[ "$line" =~ ^[a-f0-9]{64} ]] ; then
# Если у нас есть имя предыдущего префикса, добавляем его описание
if [[ -n "$current_prefix_name" ]] ; then
descriptions+=("$(echo -e "${current_description}" | sed 's/\\n$//')")
fi
current_description=""
local filename
filename=$(echo "$line" | awk '{print $2}')
current_prefix_name=${filename%.tar.xz}
if [[ "$arch" == "win32" ]] && ([[ "$current_prefix_name" == *"_x86_"* ]] || [[ "$current_prefix_name" == *"_i586_"* ]]) ; then
options+=("$current_prefix_name")
elif [[ "$arch" == "win64" ]] && ([[ "$current_prefix_name" == *"_x64_"* ]] || [[ "$current_prefix_name" == *"_amd64_"* ]]) ; then
options+=("$current_prefix_name")
else
# Если архитектура не совпадает, сбрасываем имя, чтобы не добавлять описание
current_prefix_name=""
fi
elif [[ "$line" =~ ^#[[:space:]] ]] ; then
local comment_line=${line:2} # Удаляем '# '
current_description+="$comment_line\n"
fi
fi
done < "$sha256_file"
# Добавляем описание для самого последнего префикса в файле
if [[ -n "$current_prefix_name" ]] ; then
descriptions+=("$(echo -e "${current_description}" | sed 's/\\n$//')")
fi
echo
print_info "Выберите тип создаваемого префикса:"
for i in "${!options[@]}" ; do
printf "\n\E[36m %s) %s \e[0m\n" "$((i+1))" "${options[$i]}"
[[ -n "${descriptions[$i]}" ]] && printf " \E[33m%s\e[0m\n" "$(echo -e "${descriptions[$i]}" | sed 's/^/ /g')"
done
}
create_prefix() {
print_info "Существующие префиксы:"
local prefixes=()
@@ -1888,19 +1962,22 @@ create_prefix() {
select_wine_version || exit 0
print_info "Выберите тип создаваемого префикса:"
echo " 0) Отмена создания префикса"
echo " 1) Чистый префикс (без библиотек)"
echo " 2) С рекомендуемыми библиотеками"
echo
local pfx_type_choice
read -p "Ваш выбор [0-2] (по умолчанию 1): " pfx_type_choice
case "${pfx_type_choice:-1}" in
0) print_info "Создание префикса отменено." ; exit 0 ;;
1) export BASE_PFX="none" ;;
2) ;; # Оставляем BASE_PFX пустым, чтобы init_wineprefix использовал значение по умолчанию
*) fatal "Неверный выбор. Операция отменена." ;;
esac
select_prepared_prefix "$WINEARCH"
local max_choice=${#options[@]}
local user_choice
while true; do
read -p "Ваш выбор [1-$max_choice] (0 для отмены): " user_choice
if [[ "$user_choice" == "0" ]]; then
print_info "Создание префикса отменено." ; exit 0
elif [[ "$user_choice" -ge 1 && "$user_choice" -le "$max_choice" ]]; then
export BASE_PFX="${options[$((user_choice-1))]}"
break
else
print_error "Неверный выбор. Введите число от 1 до $max_choice."
fi
done
print_license_agreement || exit 0
export WINEPREFIX="$WH_PREFIXES_DIR/$prefix_name"
@@ -2097,7 +2174,6 @@ restore_prefix() {
local backup_archive_path="$1"
local temp_extract_dir prefix_name
if [[ -z "$backup_archive_path" ]] ; then
read -e -p "Укажите путь к архиву резервной копии (/путь/к/архиву.whpack): " backup_archive_path
backup_archive_path=$(echo "$backup_archive_path" | sed "s/'//g; s/\"//g")
@@ -2168,6 +2244,15 @@ restore_prefix() {
else
print_ok "Префикс $prefix_name восстановлен."
export WINEPREFIX="$WH_PREFIXES_DIR/$prefix_name"
if [[ -f "$WINEPREFIX/last.conf" ]] ; then
source "$WINEPREFIX/last.conf"
prepair_wine
if [[ -f "$WINEPREFIX/restore_pfx.sh" ]] ; then
source "$WINEPREFIX/restore_pfx.sh"
fi
fi
print_info "Восстановление ярлыков для префикса $prefix_name..."
export RESTORE_FROM_BACKUP="1" # Устанавливаем флаг восстановления
while IFS='=' read -r name_desktop exe_path icon_name ; do

View File

@@ -642,9 +642,9 @@ class WinetricksManagerDialog(QDialog):
settings_blacklist_pattern = None
if category == 'dlls':
# Исключаем d3d*, directx9, dont_use, dxvk*, vkd3d*, galliumnine, faudio*, Foundation
# Исключаем dont_use, dxvk*, vkd3d*, galliumnine, faudio*, Foundation
dlls_blacklist_pattern = re.compile(
r'^(d3d|directx9|dont_use|dxvk|vkd3d|galliumnine|faudio|foundation)', re.IGNORECASE
r'^(dont_use|dxvk|vkd3d|galliumnine|faudio|foundation)', re.IGNORECASE
)
elif category == 'fonts':
fonts_blacklist_pattern = re.compile(
@@ -1034,14 +1034,21 @@ class ScriptParser:
with open(script_path, 'r', encoding='utf-8') as f:
lines = f.readlines()
# 1. Приоритет у PROG_ICON
# 1. Приоритет у переменной ICONS_BUTTON_GUI для GUI
for line in lines:
if line.strip().startswith('export ICONS_BUTTON_GUI='):
icon_names_str = line.split('=', 1)[1].strip().strip('"\'')
if icon_names_str:
return icon_names_str.split()
# 2. Если ICONS_BUTTON_GUI не найдена, ищем PROG_ICON (для обратной совместимости)
for line in lines:
if line.strip().startswith('export PROG_ICON='):
icon_name = line.split('=', 1)[1].strip().strip('"\'')
if icon_name:
return [icon_name]
icon_names_str = line.split('=', 1)[1].strip().strip('"\'')
if icon_names_str:
return icon_names_str.split()
# 2. Если PROG_ICON не найден, ищем все вызовы create_desktop
# 3. Если ничего не найдено, ищем все вызовы create_desktop
icon_names = []
for line in lines:
line = line.strip()
@@ -1224,6 +1231,7 @@ class WineVersionSelectionDialog(QDialog):
self.installed_grid_layout.setAlignment(Qt.AlignTop)
installed_versions_for_grid = []
# Системная версия
if shutil.which('wine'):
try:
@@ -1231,7 +1239,6 @@ class WineVersionSelectionDialog(QDialog):
self.system_wine_display_name = result.stdout.strip()
except (FileNotFoundError, subprocess.CalledProcessError) as e:
print(f"Не удалось получить версию системного wine: {e}")
self.system_wine_display_name = "Системная версия"
installed_versions_for_grid.append((self.system_wine_display_name, "system"))
# Локально установленные версии
@@ -1265,8 +1272,8 @@ class WineVersionSelectionDialog(QDialog):
allowed_groups_for_arch = {"WINE AMD64", "WINE WOW64"}
tab_order = ["WINE AMD64", "WINE WOW64"]
else: # win32
allowed_groups_for_arch = {"WINE I586","WINE AMD64", "WINE WOW64"}
tab_order = ["WINE I586","WINE AMD64", "WINE WOW64"]
allowed_groups_for_arch = {"WINE I586","WINE AMD64"}
tab_order = ["WINE I586","WINE AMD64"]
# Получаем только те ключи, которые есть в данных и разрешены для данной архитектуры
available_keys = [key for key in self.wine_versions_data.keys() if key in allowed_groups_for_arch]
@@ -1302,6 +1309,7 @@ class WineVersionSelectionDialog(QDialog):
def _create_grid_buttons(self, grid_layout, versions_list, is_download_tab=False):
is_win64_prefix = self.architecture == "win64"
is_win32_prefix = self.architecture == "win32"
re_32bit_version = re.compile(r'i[3-6]86|i586')
num_columns = 3
@@ -1326,6 +1334,12 @@ class WineVersionSelectionDialog(QDialog):
btn.setEnabled(False)
btn.setToolTip("Эта 32-битная версия Wine несовместима с 64-битным префиксом.")
# Отключение 64-битных версий Wine (системной и wow64) при выборе 32-битного префикса
if not is_download_tab and is_win32_prefix:
if value_name == "system" or 'wow64' in value_name:
btn.setEnabled(False)
btn.setToolTip("Эта 64-битная версия Wine несовместима с 32-битным префиксом.")
grid_layout.addWidget(btn, row, col)
col += 1
if col >= num_columns:
@@ -1390,6 +1404,7 @@ class CreatePrefixDialog(QDialog):
self.prefix_name = None
self.wine_arch = None
self.base_pfx = None
self.prepared_prefixes = {}
self.selected_wine_version_value = None
self.selected_wine_version_display = None
@@ -1424,18 +1439,10 @@ class CreatePrefixDialog(QDialog):
arch_layout.addWidget(self.arch_win64_radio)
form_layout.addRow("<b>Разрядность:</b>", arch_widget)
type_widget = QWidget()
type_layout = QHBoxLayout(type_widget)
type_layout.setContentsMargins(0, 0, 0, 0)
self.type_clean_radio = QRadioButton("Чистый")
self.type_clean_radio.setToolTip("Создает пустой префикс Wine без каких-либо дополнительных компонентов.")
self.type_recommended_radio = QRadioButton("С рекомендуемыми библиотеками")
tooltip_text = "Устанавливает базовый набор компонентов, необходимый для большинства приложений"
self.type_recommended_radio.setToolTip(tooltip_text)
self.type_clean_radio.setChecked(True)
type_layout.addWidget(self.type_clean_radio)
type_layout.addWidget(self.type_recommended_radio)
form_layout.addRow("<b>Наполнение:</b>", type_widget)
# Виджет для выбора типа префикса (шаблона)
self.prefix_template_selector = QComboBox()
self.prefix_template_selector.setToolTip("Выберите шаблон для создания префикса.")
form_layout.addRow("<b>Шаблон префикса:</b>", self.prefix_template_selector)
self.wine_version_edit = QLineEdit()
self.wine_version_edit.setReadOnly(True)
@@ -1468,10 +1475,82 @@ class CreatePrefixDialog(QDialog):
layout.addLayout(button_layout)
# Connect signals
self.arch_win32_radio.toggled.connect(self.clear_wine_version_selection)
self.arch_win32_radio.toggled.connect(self.on_architecture_changed)
self.prefix_name_edit.textChanged.connect(self.validate_prefix_name)
self.wine_version_edit.textChanged.connect(self.update_create_button_state)
# Загружаем и настраиваем шаблоны префиксов
self._load_prepared_prefixes()
self.on_architecture_changed()
def _load_prepared_prefixes(self):
"""Загружает и парсит шаблоны префиксов из sha256sum.list."""
self.prepared_prefixes = {'win32': [], 'win64': []}
sha256_file = os.path.join(Var.DATA_PATH, "sha256sum.list")
if not os.path.exists(sha256_file):
QMessageBox.warning(self, "Ошибка", f"Файл с описаниями префиксов не найден: {sha256_file}")
return
in_prefix_section = False
current_description = ""
current_prefix_name = None
try:
with open(sha256_file, 'r', encoding='utf-8') as f:
for line in f:
line = line.strip()
if "##### PREFIX #####" in line:
in_prefix_section = True
continue
elif line.startswith("#####"):
in_prefix_section = False
continue
if not in_prefix_section:
continue
if re.match(r'^[a-f0-9]{64}', line):
# Если у нас есть имя и описание для предыдущего префикса, добавляем его
if current_prefix_name and current_description:
arch_for_prev_prefix = None
if "_x86_" in current_prefix_name or "_i586_" in current_prefix_name:
arch_for_prev_prefix = 'win32'
elif "_x64_" in current_prefix_name or "_amd64_" in current_prefix_name:
arch_for_prev_prefix = 'win64'
if arch_for_prev_prefix:
description_to_add = current_description.strip().replace('\\n', '\n')
self.prepared_prefixes[arch_for_prev_prefix].append((current_prefix_name, description_to_add))
# Сбрасываем описание для нового префикса
current_description = ""
# Получаем имя нового префикса
current_prefix_name = line.split(maxsplit=1)[1].replace('.tar.xz', '') if len(line.split(maxsplit=1)) > 1 else None
elif line.startswith('# '):
# Накапливаем описание
comment_line = line[2:].strip()
if current_description:
current_description += "\n" + comment_line
else:
current_description = comment_line
# После цикла добавляем описание для самого последнего префикса, если оно есть
if current_prefix_name and current_description:
arch = None
if "_x86_" in current_prefix_name or "_i586_" in current_prefix_name: arch = 'win32'
elif "_x64_" in current_prefix_name or "_amd64_" in current_prefix_name: arch = 'win64'
if arch:
self.prepared_prefixes[arch].append((current_prefix_name, current_description.strip().replace('\\n', '\n')))
except IOError as e:
QMessageBox.warning(self, "Ошибка", f"Не удалось прочитать файл с описаниями префиксов: {e}")
# Добавляем опцию "Чистый префикс" для обеих архитектур
self.prepared_prefixes['win32'].insert(0, ('none', 'Создать чистый префикс без дополнительных библиотек'))
self.prepared_prefixes['win64'].insert(0, ('none', 'Создать чистый префикс без дополнительных библиотек'))
def open_wine_version_dialog(self):
"""Открывает диалог выбора версии Wine."""
architecture = "win32" if self.arch_win32_radio.isChecked() else "win64"
@@ -1480,11 +1559,29 @@ class CreatePrefixDialog(QDialog):
self.wine_version_edit.setText(dialog.selected_display_text)
self.selected_wine_version_value = dialog.selected_version
def clear_wine_version_selection(self):
"""Сбрасывает выбор версии Wine."""
def on_architecture_changed(self):
"""Обновляет список шаблонов и сбрасывает выбор версии Wine при смене архитектуры."""
# Сбрасываем выбор версии
self.wine_version_edit.clear()
self.selected_wine_version_value = None
# Обновляем список шаблонов
self.prefix_template_selector.blockSignals(True)
self.prefix_template_selector.clear()
architecture = "win32" if self.arch_win32_radio.isChecked() else "win64"
templates = self.prepared_prefixes.get(architecture, [])
for value, description in templates:
# Для 'none' используем более понятное имя
display_name = "Чистый префикс" if value == "none" else value
self.prefix_template_selector.addItem(display_name, userData={'value': value, 'tooltip': description})
self.prefix_template_selector.blockSignals(False)
# Обновляем тултип при смене элемента
self.prefix_template_selector.currentIndexChanged.connect(lambda i: self.prefix_template_selector.setToolTip(self.prefix_template_selector.itemData(i)['tooltip']))
self.prefix_template_selector.setToolTip(self.prefix_template_selector.itemData(0)['tooltip'])
def validate_prefix_name(self, text):
"""Проверяет имя префикса в реальном времени и показывает/скрывает предупреждение."""
valid_pattern = r'^[a-zA-Z0-9_-]*$'
@@ -1528,7 +1625,10 @@ class CreatePrefixDialog(QDialog):
# Save data
self.prefix_name = prefix_name
self.wine_arch = "win32" if self.arch_win32_radio.isChecked() else "win64"
self.base_pfx = "none" if self.type_clean_radio.isChecked() else ""
# Получаем значение `BASE_PFX` из выбранного шаблона
current_index = self.prefix_template_selector.currentIndex()
self.base_pfx = self.prefix_template_selector.itemData(current_index)['value']
self.selected_wine_version_display = self.wine_version_edit.text()
self.accept()
@@ -5024,6 +5124,7 @@ class WineHelperGUI(QMainWindow):
if exit_code == 0:
self.command_log_output.append(f"\n=== Восстановление успешно завершено ===")
self.update_installed_apps()
self._load_created_prefixes()
self.filter_installed_buttons()
else:
self.command_log_output.append(f"\n=== Ошибка выполнения (код: {exit_code}) ===")
@@ -5046,6 +5147,13 @@ class WineHelperGUI(QMainWindow):
def main():
"""Основная точка входа в приложение."""
# Включаем поддержку HiDPI до создания QApplication для надежного и предсказуемого масштабирования.
# AA_EnableHighDpiScaling включает автоматическое масштабирование на основе DPI дисплея.
if hasattr(Qt, 'AA_EnableHighDpiScaling'):
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
# AA_UseHighDpiPixmaps позволяет использовать высококачественные иконки (например, @2x).
if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
# QApplication должен быть создан до использования любых других частей Qt
app = QApplication(sys.argv)