Compare commits

...

4 Commits

Author SHA1 Message Date
Sergey Palcheh
9a1b78276e added button lock in the Installed tab when the Run button is pressed 2025-10-18 16:52:22 +06:00
Sergey Palcheh
f788307f05 added color for the Run button/Stop it 2025-10-18 16:39:22 +06:00
Sergey Palcheh
14273f723b the error of determining the current directory has been fixed 2025-10-18 16:24:06 +06:00
Mikhail Tergoev
a8e0fdce0a added var: WH_DEVEL 2025-10-17 15:34:29 +03:00
2 changed files with 45 additions and 13 deletions

View File

@@ -31,6 +31,7 @@ else
LICENSE_FILE="$DATA_PATH/LICENSE"
AGREEMENT="$DATA_PATH/LICENSE_AGREEMENT"
THIRD_PARTY_FILE="$DATA_PATH/THIRD-PARTY"
WH_DEVEL="1"
# минимальная проверка синтаксиса скриптов
for self_check_script in "$RUN_SCRIPT" \
@@ -1410,7 +1411,6 @@ wine_run () {
then fatal "Нельзя запустить 64-битное приложение в 32-битном префиксе!"
fi
cd "$win_file_path"
else
fatal "Команда введена не правильно или не найден исполняемый файл $1"
fi
@@ -1431,9 +1431,15 @@ wine_run () {
env | grep -e "WH_" -e "WINE" -e "DXVK" -e "VKD3D" | tee -a "$log_file"
echo "##### Лог WINE #####" | tee -a "$log_file"
$MANGOHUD_RUN "$WINELOADER" $wh_add_args "$win_file_exec" "$@" $LAUNCH_PARAMETERS 2>&1 | tee -a "$log_file"
(
cd "$win_file_path"
$MANGOHUD_RUN "$WINELOADER" $wh_add_args "$win_file_exec" "$@" $LAUNCH_PARAMETERS 2>&1 | tee -a "$log_file"
)
else
$MANGOHUD_RUN "$WINELOADER" $wh_add_args "$win_file_exec" "$@" $LAUNCH_PARAMETERS
(
cd "$win_file_path"
$MANGOHUD_RUN "$WINELOADER" $wh_add_args "$win_file_exec" "$@" $LAUNCH_PARAMETERS
)
fi
wait_wineserver
@@ -1445,7 +1451,7 @@ wine_run_install () {
then print_warning "Рекомендуется не менять пути для установки приложения!"
fi
if [[ ! -f "$1" ]] ;
if [[ ! -f "$1" ]]
then fatal "Нет файла для установки: $1"
else wine_run "$@"
fi
@@ -2177,7 +2183,7 @@ select_component_version() {
}
run_install_to_prefix() {
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -f "$2" ]]; then
if [[ -z "$1" ]] || [[ -z "$2" ]] || [[ -f "$2" ]] ; then
fatal "Использование: $SCRIPT_NAME install-to-prefix <имя_префикса> <путь_к_установщику>"
fi
@@ -2299,7 +2305,8 @@ create_new_dir "$WH_DIST_DIR"
create_new_dir "$WH_PREFIXES_DIR"
create_new_dir "$WH_VULKAN_LIBDIR"
if [[ -d "$HOME/.local/share/$SCRIPT_NAME" ]] \
if [[ $WH_DEVEL != "1" ]] \
&& [[ -d "$HOME/.local/share/$SCRIPT_NAME" ]] \
&& [[ ! -L "$HOME/.winehelper" ]]
then try_force_link_dir "$HOME/.local/share/$SCRIPT_NAME" "$HOME/.winehelper"
fi

View File

@@ -1626,6 +1626,17 @@ class WineHelperGUI(QMainWindow):
self.FRAME_STYLE_DEFAULT = "QFrame { border: 2px solid transparent; border-radius: 8px; padding: 0px; }"
self.FRAME_STYLE_SELECTED = "QFrame { border: 2px solid #0078d7; border-radius: 8px; padding: 0px; }"
# Стили для кнопок Запустить/Остановить
self.RUN_BUTTON_STYLE = """
QPushButton {
background-color: #4CAF50; color: white;
font-weight: bold;
}
"""
self.STOP_BUTTON_STYLE = """
QPushButton { background-color: #d32f2f; color: white; font-weight: bold; }
"""
# Основные переменные
self.winehelper_path = Var.RUN_SCRIPT
self.process = None
@@ -1889,6 +1900,7 @@ class WineHelperGUI(QMainWindow):
# --- Верхний ряд кнопок ---
top_buttons_layout = QHBoxLayout()
self.run_button = QPushButton("Запустить")
self.run_button.setStyleSheet(self.RUN_BUTTON_STYLE)
self.run_button.clicked.connect(self.toggle_run_stop_app)
top_buttons_layout.addWidget(self.run_button)
installed_action_layout.addLayout(top_buttons_layout)
@@ -3468,11 +3480,7 @@ class WineHelperGUI(QMainWindow):
self.current_selected_app['name'] = name
self.current_selected_app['exec'] = exec_cmd
# Состояния кнопки
if desktop_path in self.running_apps:
self.run_button.setText("Остановить")
else:
self.run_button.setText("Запустить")
self._set_run_button_state(desktop_path in self.running_apps)
# Показываем панель информации
self.info_panel.setVisible(True)
@@ -3865,10 +3873,27 @@ class WineHelperGUI(QMainWindow):
# Если текущее выбранное приложение - то, что только что завершилось, обновляем кнопку
if self.current_selected_app and self.current_selected_app.get('desktop_path') == desktop_path:
self.run_button.setText("Запустить")
self._set_run_button_state(False)
else:
print(f"Предупреждение: получен сигнал finished для неизвестного процесса {desktop_path}")
def _set_run_button_state(self, is_running):
"""Устанавливает текст и стиль для кнопки Запустить/Остановить."""
if is_running:
self.run_button.setText("Остановить")
self.run_button.setStyleSheet(self.STOP_BUTTON_STYLE)
self.create_log_button.setEnabled(False)
self.backup_button.setEnabled(False)
self.uninstall_button.setEnabled(False)
self.restore_prefix_button_panel.setEnabled(False)
else:
self.run_button.setText("Запустить")
self.run_button.setStyleSheet(self.RUN_BUTTON_STYLE)
self.create_log_button.setEnabled(True)
self.backup_button.setEnabled(True)
self.uninstall_button.setEnabled(True)
self.restore_prefix_button_panel.setEnabled(True)
def _run_app_launcher(self, debug=False):
"""Внутренний метод для запуска приложения (с отладкой или без) с использованием QProcess."""
if not self.current_selected_app or 'exec' not in self.current_selected_app:
@@ -3935,7 +3960,7 @@ class WineHelperGUI(QMainWindow):
raise RuntimeError(f"Не удалось запустить процесс: {process.errorString()}")
self.running_apps[desktop_path] = process
self.run_button.setText("Остановить")
self._set_run_button_state(True)
print(f"Запущено: {program} {' '.join(arguments)}")
except Exception as e:
QMessageBox.critical(self, "Ошибка запуска",