From ef316eaac51f7681a773144f19f60f3a9b825aab Mon Sep 17 00:00:00 2001 From: Ashraf-Khabar <95541956+Ashraf-Khabar@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:38:20 +0200 Subject: [PATCH] Updates help page --- config.xml | 2 +- ui/help/help_widget.py | 45 +++++++++++++++++++----------------------- ui/main_window.py | 16 +++++++-------- widgets/title_bar.py | 5 +---- 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/config.xml b/config.xml index ea6603e..04da8e3 100644 --- a/config.xml +++ b/config.xml @@ -1,4 +1,4 @@ - v2.7.17 + v2.7.18 Configuration file for the application \ No newline at end of file diff --git a/ui/help/help_widget.py b/ui/help/help_widget.py index 2d965dd..d7c09bf 100644 --- a/ui/help/help_widget.py +++ b/ui/help/help_widget.py @@ -205,7 +205,25 @@ def init_ui(self): layout.addLayout(buttons_layout) - footer = QLabel("ROBOT RUNNER v2.7.16") + config_paths = [ + 'config.xml', # Development path + os.path.join(os.path.dirname(sys.executable), 'config.xml'), # EXE location + ] + + config_loaded = False + for path in config_paths: + if os.path.exists(path): + tree = ET.parse(path) + root = tree.getroot() + self.version_label = f"{root[0].text}" + config_loaded = True + break + + if not config_loaded: + self.version_label = "(Unknown version)" + + footer = QLabel(f"© ROBOT RUNNER {self.version_label} | " + "Developed by Achraf KHABAR | ") footer.setAlignment(Qt.AlignmentFlag.AlignCenter) footer.setStyleSheet(""" QLabel { @@ -218,30 +236,7 @@ def init_ui(self): layout.addWidget(footer) self.setLayout(layout) - - def _load_config(self): - try: - # Try multiple paths to locate the config file - config_paths = [ - 'config.xml', # Development path - os.path.join(os.path.dirname(sys.executable), 'config.xml'), # EXE location - os.path.join(sys._MEIPASS, 'config.xml') # PyInstaller temp directory - ] - - config_loaded = False - for path in config_paths: - if os.path.exists(path): - tree = ET.parse(path) - root = tree.getroot() - self.version_label = f"© Robot Runner {root[0].text}" - config_loaded = True - break - - if not config_loaded: - raise FileNotFoundError("Config file not found in any standard location") - - except Exception as e: - self.version_label = "© Robot Runner v2.7.16" + def setup_animations(self): self.opacity_effect = QGraphicsOpacityEffect(self) diff --git a/ui/main_window.py b/ui/main_window.py index 900a67c..0177285 100644 --- a/ui/main_window.py +++ b/ui/main_window.py @@ -7,9 +7,10 @@ QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QCheckBox, QSpinBox, QScrollArea, QStackedWidget, QMessageBox, QLineEdit, QGroupBox, - QFormLayout + QFormLayout, QSizePolicy ) from PyQt6.QtCore import Qt, QPoint, pyqtSignal, QTimer, QSettings +from PyQt6.QtCore import Qt, QPoint, pyqtSignal, QTimer, QSettings from PyQt6.QtGui import QFont from ui.logo_splash import LogoSplash @@ -27,6 +28,7 @@ from ui.help.help_controller import HelpController + matplotlib.use('Qt5Agg') class RobotTestRunner(QWidget): @@ -90,11 +92,12 @@ def init_ui(self): self.right_container.setLayout(self.right_layout) # Title bar - self.title_bar = TitleBar("", self) + self.title_bar = TitleBar("Robot Test Runner", self) self.right_layout.addWidget(self.title_bar) # Stacked widget for pages self.stacked_widget = QStackedWidget() + self.stacked_widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) self.right_layout.addWidget(self.stacked_widget) # Main content area @@ -104,7 +107,7 @@ def init_ui(self): self.content_layout = QVBoxLayout() self.content_widget.setLayout(self.content_layout) self.content_scroll.setWidget(self.content_widget) - self.right_layout.addWidget(self.content_scroll) + self.stacked_widget.addWidget(self.content_scroll) self.main_h_layout.addWidget(self.right_container) @@ -314,7 +317,7 @@ def _init_help_page(self): def _handle_help_link(self, url): """Handle help link clicks""" - print(f"Help link clicked: {url}") # You can add analytics here if needed + print(f"Help link clicked: {url}") def _save_settings(self): """Save settings to persistent storage""" @@ -430,13 +433,10 @@ def show_analytics(self): def show_main_content(self): """Show the main test selection content""" - self.content_scroll.show() - self.stacked_widget.hide() + self.stacked_widget.setCurrentWidget(self.content_scroll) def show_page(self, page): """Show a specific page""" - self.content_scroll.hide() - self.stacked_widget.show() self.stacked_widget.setCurrentWidget(page) def toggle_select_all_tests(self, state): diff --git a/widgets/title_bar.py b/widgets/title_bar.py index 885a792..ff4b88b 100644 --- a/widgets/title_bar.py +++ b/widgets/title_bar.py @@ -9,7 +9,7 @@ def __init__(self, title, parent_window=None): self.setFixedHeight(40) self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) self.drag_start_position = None - self.is_maximized = False # Track maximized state + self.is_maximized = False layout = QHBoxLayout() layout.setContentsMargins(10, 0, 10, 0) @@ -69,9 +69,7 @@ def mouseMoveEvent(self, event): return if self.is_maximized: - # If window is maximized and we start dragging self.parent_window.showNormal() - # Adjust position for natural dragging new_pos = event.globalPosition().toPoint() - QPoint( self.parent_window.width() // 2, self.height() // 2 @@ -80,7 +78,6 @@ def mouseMoveEvent(self, event): self.drag_start_position = event.globalPosition().toPoint() self.is_maximized = False else: - # Normal window movement delta = event.globalPosition().toPoint() - self.drag_start_position self.parent_window.move(self.parent_window.pos() + delta) self.drag_start_position = event.globalPosition().toPoint()