few fixes
This commit is contained in:
parent
02752c7e4a
commit
cb32a00ea5
@ -9,8 +9,8 @@ from app.core.main_manager import MainManager, NotificationType
|
|||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
class MenuDirection(Enum):
|
class MenuDirection(Enum):
|
||||||
HORIZONTAL = 0
|
HORIZONTAL = 0 # Barre en haut ou en bas
|
||||||
VERTICAL = 1
|
VERTICAL = 1 # Barre à gauche ou à droite
|
||||||
|
|
||||||
class ButtonPosition(Enum):
|
class ButtonPosition(Enum):
|
||||||
START = 0 # Au début (aligné à gauche/haut)
|
START = 0 # Au début (aligné à gauche/haut)
|
||||||
@ -19,10 +19,10 @@ class ButtonPosition(Enum):
|
|||||||
AFTER = 3 # Après un bouton spécifique
|
AFTER = 3 # Après un bouton spécifique
|
||||||
|
|
||||||
class BorderSide(Enum):
|
class BorderSide(Enum):
|
||||||
LEFT = "left"
|
LEFT = "left" # Bord gauche
|
||||||
RIGHT = "right"
|
RIGHT = "right" # Bord droit
|
||||||
TOP = "top"
|
TOP = "top" # Bord supérieur
|
||||||
BOTTOM = "bottom"
|
BOTTOM = "bottom" # Bord inférieur
|
||||||
NONE = None
|
NONE = None
|
||||||
|
|
||||||
class TabSide(Enum):
|
class TabSide(Enum):
|
||||||
@ -53,7 +53,6 @@ class TabsWidget(QWidget):
|
|||||||
|
|
||||||
# Déterminer le côté de la barre d'onglets
|
# Déterminer le côté de la barre d'onglets
|
||||||
if tab_side is None:
|
if tab_side is None:
|
||||||
# Valeurs par défaut basées sur la direction
|
|
||||||
self.tab_side = TabSide.LEFT if direction == MenuDirection.VERTICAL else TabSide.TOP
|
self.tab_side = TabSide.LEFT if direction == MenuDirection.VERTICAL else TabSide.TOP
|
||||||
else:
|
else:
|
||||||
self.tab_side = tab_side
|
self.tab_side = tab_side
|
||||||
@ -63,11 +62,12 @@ class TabsWidget(QWidget):
|
|||||||
self.button_positions = []
|
self.button_positions = []
|
||||||
self.button_size_ratios = [] # Individual ratios for each button
|
self.button_size_ratios = [] # Individual ratios for each button
|
||||||
self._icon_cache = {}
|
self._icon_cache = {}
|
||||||
|
self._original_icon_paths = []
|
||||||
|
self._square_buttons = []
|
||||||
# Track alignment zones
|
# Track alignment zones
|
||||||
self.start_buttons = []
|
self.start_buttons = []
|
||||||
self.center_buttons = []
|
self.center_buttons = []
|
||||||
self.end_buttons = []
|
self.end_buttons = []
|
||||||
|
|
||||||
# Icon Colors
|
# Icon Colors
|
||||||
self.selected_icon_color = self.theme_manager.current_theme.get_color("icon_selected_color")
|
self.selected_icon_color = self.theme_manager.current_theme.get_color("icon_selected_color")
|
||||||
self.unselected_icon_color = self.theme_manager.current_theme.get_color("icon_unselected_color")
|
self.unselected_icon_color = self.theme_manager.current_theme.get_color("icon_unselected_color")
|
||||||
@ -151,10 +151,7 @@ class TabsWidget(QWidget):
|
|||||||
container_widget = QWidget()
|
container_widget = QWidget()
|
||||||
container_widget.setLayout(widget)
|
container_widget.setLayout(widget)
|
||||||
container_widget.setContentsMargins(0, 0, 0, 0)
|
container_widget.setContentsMargins(0, 0, 0, 0)
|
||||||
self._insert_widget_with_alignment(container_widget, position)
|
widget = container_widget
|
||||||
return container_widget
|
|
||||||
else:
|
|
||||||
# If it's already a widget, insert it directly
|
|
||||||
self._insert_widget_with_alignment(widget, position)
|
self._insert_widget_with_alignment(widget, position)
|
||||||
return widget
|
return widget
|
||||||
|
|
||||||
@ -189,10 +186,6 @@ class TabsWidget(QWidget):
|
|||||||
|
|
||||||
def add_widget(self, widget, button_text, icon_path=None, position=ButtonPosition.END, after_button_index=None, button_size_ratio=None):
|
def add_widget(self, widget, button_text, icon_path=None, position=ButtonPosition.END, after_button_index=None, button_size_ratio=None):
|
||||||
"""Add a widget with its corresponding button at specified position"""
|
"""Add a widget with its corresponding button at specified position"""
|
||||||
# Store original icon path for theme updates
|
|
||||||
if not hasattr(self, '_original_icon_paths'):
|
|
||||||
self._original_icon_paths = []
|
|
||||||
|
|
||||||
# Create button
|
# Create button
|
||||||
if icon_path:
|
if icon_path:
|
||||||
colored_icon = self.apply_color_to_svg_icon(icon_path, self.unselected_icon_color)
|
colored_icon = self.apply_color_to_svg_icon(icon_path, self.unselected_icon_color)
|
||||||
@ -202,7 +195,6 @@ class TabsWidget(QWidget):
|
|||||||
button = QPushButton(button_text)
|
button = QPushButton(button_text)
|
||||||
self._original_icon_paths.append(None)
|
self._original_icon_paths.append(None)
|
||||||
|
|
||||||
button.setObjectName("menu_button")
|
|
||||||
button.setCheckable(True)
|
button.setCheckable(True)
|
||||||
|
|
||||||
# Store button size ratio (use provided ratio or default)
|
# Store button size ratio (use provided ratio or default)
|
||||||
@ -248,8 +240,6 @@ class TabsWidget(QWidget):
|
|||||||
self._update_button_size(button)
|
self._update_button_size(button)
|
||||||
|
|
||||||
# Store reference for resize updates
|
# Store reference for resize updates
|
||||||
if not hasattr(self, '_square_buttons'):
|
|
||||||
self._square_buttons = []
|
|
||||||
self._square_buttons.append(button)
|
self._square_buttons.append(button)
|
||||||
|
|
||||||
def eventFilter(self, obj : QPushButton, event):
|
def eventFilter(self, obj : QPushButton, event):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user