diff --git a/portprotonqt/dialogs.py b/portprotonqt/dialogs.py index 2193c9c..409168e 100644 --- a/portprotonqt/dialogs.py +++ b/portprotonqt/dialogs.py @@ -216,6 +216,26 @@ class FileExplorer(QDialog): self.file_signal.file_selected.emit(os.path.normpath(full_path)) self.accept() + def previous_dir(self): + """Возврат к родительской директории""" + try: + if self.current_path == "/": + return # Уже в корне + + # Нормализуем путь (убираем конечный слеш, если есть) + normalized_path = os.path.normpath(self.current_path) + # Получаем родительскую директорию + parent_dir = os.path.dirname(normalized_path) + + if not parent_dir: + parent_dir = "/" + + self.current_path = parent_dir + self.update_file_list() + except Exception as e: + logger.error(f"Error navigating to parent directory: {e}") + + def update_drives_list(self): """Обновление списка смонтированных дисков""" for i in reversed(range(self.drives_layout.count())): diff --git a/portprotonqt/input_manager.py b/portprotonqt/input_manager.py index b633f2e..7892aa1 100644 --- a/portprotonqt/input_manager.py +++ b/portprotonqt/input_manager.py @@ -44,6 +44,7 @@ BUTTONS = { 'confirm': {ecodes.BTN_SOUTH}, # A (Xbox) / Cross (PS) 'back': {ecodes.BTN_EAST}, # B (Xbox) / Circle (PS) 'add_game': {ecodes.BTN_NORTH}, # X (Xbox) / Triangle (PS) + 'prev_dir': {ecodes.BTN_WEST}, # Y (Xbox) / Square (PS) 'prev_tab': {ecodes.BTN_TL}, # LB (Xbox) / L1 (PS) 'next_tab': {ecodes.BTN_TR}, # RB (Xbox) / R1 (PS) 'context_menu': {ecodes.BTN_START}, # Start (Xbox) / Options (PS) @@ -161,10 +162,12 @@ class InputManager(QObject): if not self.file_explorer or not hasattr(self.file_explorer, 'file_list'): return - if button_code in BUTTONS['confirm']: # Кнопка A + if button_code in BUTTONS['confirm']: self.file_explorer.select_item() - elif button_code in BUTTONS['back']: # Кнопка B + elif button_code in BUTTONS['back']: self.file_explorer.close() + elif button_code in BUTTONS['prev_dir']: + self.file_explorer.previous_dir() else: if self.original_button_handler: self.original_button_handler(button_code)