forked from CastroFidel/winehelper
Compare commits
6 Commits
33bba61891
...
devel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3adf19624 | ||
|
|
dc7a996060 | ||
|
|
eca1905c62 | ||
|
|
371b2b7484 | ||
|
|
ded62bd9ac | ||
|
|
15b6fdd216 |
BIN
image/wh_default.png
Normal file
BIN
image/wh_default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
47
winehelper
47
winehelper
@@ -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
|
||||
# --- Конец логики обработки иконки ---
|
||||
|
||||
@@ -1865,46 +1865,49 @@ select_prepared_prefix() {
|
||||
|
||||
local in_prefix_section=false
|
||||
local current_description=""
|
||||
local current_prefix_name=""
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" =~ ^#####[[:space:]]PREFIX[[:space:]]#####$ ]]; then
|
||||
if [[ "$line" =~ ^#####[[:space:]]PREFIX[[:space:]]#####$ ]] ; then
|
||||
in_prefix_section=true
|
||||
continue
|
||||
elif [[ "$line" =~ ^#####.* ]]; then
|
||||
if [[ "$in_prefix_section" == true ]] && [[ -n "$current_description" ]]; then
|
||||
descriptions+=("$(echo -e "$current_description" | sed 's/\\n$//')")
|
||||
current_description=""
|
||||
fi
|
||||
elif [[ "$line" =~ ^#####.* ]] ; then
|
||||
in_prefix_section=false
|
||||
fi
|
||||
|
||||
if [[ "$in_prefix_section" == true ]]; then
|
||||
if [[ "$line" =~ ^[a-f0-9]{64} ]]; then
|
||||
[[ -n "$current_description" ]] && descriptions+=("$(echo -e "$current_description" | sed 's/\\n$//')")
|
||||
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}')
|
||||
local prefix_name=${filename%.tar.xz}
|
||||
current_prefix_name=${filename%.tar.xz}
|
||||
|
||||
if [[ "$arch" == "win32" ]]; then
|
||||
if [[ "$prefix_name" == *"_x86_"* ]] || [[ "$prefix_name" == *"_i586_"* ]]; then
|
||||
options+=("$prefix_name")
|
||||
fi
|
||||
elif [[ "$arch" == "win64" ]]; then
|
||||
if [[ "$prefix_name" == *"_x64_"* ]] || [[ "$prefix_name" == *"_amd64_"* ]]; then
|
||||
options+=("$prefix_name")
|
||||
fi
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
@@ -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()
|
||||
@@ -1503,23 +1510,39 @@ class CreatePrefixDialog(QDialog):
|
||||
continue
|
||||
|
||||
if re.match(r'^[a-f0-9]{64}', line):
|
||||
current_prefix_name = line.split(maxsplit=1)[1].replace('.tar.xz', '')
|
||||
# Если у нас есть имя и описание для предыдущего префикса, добавляем его
|
||||
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'
|
||||
|
||||
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:
|
||||
description = current_description.strip().replace('\\n', '\n') if current_description else "Рекомендуемый набор библиотек"
|
||||
self.prepared_prefixes[arch].append((current_prefix_name, description))
|
||||
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 = None
|
||||
|
||||
# Получаем имя нового префикса
|
||||
current_prefix_name = line.split(maxsplit=1)[1].replace('.tar.xz', '') if len(line.split(maxsplit=1)) > 1 else None
|
||||
|
||||
elif line.startswith('# '):
|
||||
current_description += line[2:] + "\\n"
|
||||
# Накапливаем описание
|
||||
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}")
|
||||
@@ -5101,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}) ===")
|
||||
@@ -5123,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user