diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8876e3d7..9101f6ac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ # .pre-commit-config.yaml repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 # this is optional, use `pre-commit autoupdate` to get the latest rev! + rev: v6.0.0 # this is optional, use `pre-commit autoupdate` to get the latest rev! hooks: - id: end-of-file-fixer - id: trailing-whitespace -- repo: https://github.com/psf/black - rev: 25.1.0 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 25.12.0 hooks: - id: black # - repo: https://github.com/mattlqx/pre-commit-search-and-replace diff --git a/CreateStructure.txt b/CreateStructure.txt index 27a77bf8..2ecba0a7 100644 --- a/CreateStructure.txt +++ b/CreateStructure.txt @@ -4980,4 +4980,4 @@ } } } -} \ No newline at end of file +} diff --git a/CustomWidgets.py b/CustomWidgets.py index 4ea6429e..cc69bee0 100644 --- a/CustomWidgets.py +++ b/CustomWidgets.py @@ -37,7 +37,6 @@ QPaintEvent, QPen, QPainter, - ) from PySide.QtWidgets import ( QComboBox, @@ -99,7 +98,8 @@ mw: QMainWindow = Gui.getMainWindow() -class CustomControls(QToolButton): + +class CustomControls(QToolButton): def __init__( self, Text: str, @@ -117,10 +117,10 @@ def __init__( Menu: QMenu = None, MenuButtonSpace=10, parent=None, - ButtonStyle = RibbonButtonStyle.Small, + ButtonStyle=RibbonButtonStyle.Small, *args, - **kwargs - ): + **kwargs, + ): QToolButton.__init__(self, *args, **kwargs) self.layout = QHBoxLayout(self) self.widget = QToolButton(self) @@ -183,15 +183,15 @@ def __init__( MaxNumberOfLines, Menu, MenuButtonSpace, - parent, + parent, ) self.layout.addWidget(self.widget, 0, Qt.AlignmentFlag.AlignLeft) - + self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.layout.setAlignment(Qt.AlignmentFlag.AlignLeft) self.setFixedSize(self.widget.size()) - + def mouseMoveEvent(self, e): if e.buttons() == Qt.MouseButton.LeftButton: try: @@ -205,33 +205,32 @@ def mouseMoveEvent(self, e): drag.exec_(Qt.DropAction.MoveAction) except Exception as e: print(e) - - + def actions(self): return self.action @classmethod def TextEnabled(self): - + return self.showText - + def returnMenu(self): return self.menu def LabelWidth(self): return self.labelWidth - + def MenuButtonWidth(self): return self.menuButtonWidth def ShowText(self, Visible: bool): - if Visible is True: - for child in self.widget.children(): - if type(child) is QLabel: - # show the text - child.show() - return True - return False + if Visible is True: + for child in self.widget.children(): + if type(child) is QLabel: + # show the text + child.show() + return True + return False @classmethod def LargeCustomToolButton( @@ -263,7 +262,7 @@ def LargeCustomToolButton( + StyleMapping_Ribbon.ReturnStyleItem("Background_Color") + ";border: none" + ";}" - ) + ) btn.setStyleSheet(StyleSheet_Addition_Button) # Define the parameters CommandButtonHeight = 0 @@ -283,7 +282,7 @@ def LargeCustomToolButton( if len(Menu.actions()) == 0: CommandButton.addAction(Action) CommandButton.setDefaultAction(Action) - + CommandButton.setObjectName("CommandButton") ArrowButton.setObjectName("MenuButton") @@ -361,7 +360,7 @@ def LargeCustomToolButton( maxLength = maxLength + 1 if maxWidth >= ButtonSize.width(): break - # maxLength = maxLength + 3 + # maxLength = maxLength + 3 maxLength = maxLength # Get the first text line @@ -382,7 +381,7 @@ def LargeCustomToolButton( # Set the alignment Label_Text.setAlignment(TextAlignment) # Add the line - Label_Text.setText(line1 + "\n" +line2) + Label_Text.setText(line1 + "\n" + line2) # Update the text width if neccesary if FontMetrics.tightBoundingRect(line2).width() > TextWidth: TextWidth = FontMetrics.tightBoundingRect(line2).width() @@ -421,18 +420,14 @@ def LargeCustomToolButton( def mouseClickevent(event): ArrowButton.animateClick() - Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) - ArrowButton.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) + Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) + ArrowButton.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) # Change the background color for commandbutton and label on hovering (CSS) def enterEventCustom(event): # if CommandButton.isEnabled() is False: # return - + BorderColor = StyleMapping_Ribbon.ReturnStyleItem("Border_Color") if Parameters_Ribbon.CUSTOM_COLORS_ENABLED: BorderColor = Parameters_Ribbon.COLOR_BORDERS @@ -441,8 +436,8 @@ def enterEventCustom(event): "Background_Color_Hover" ) - StyleSheet_Addition_Arrow= "" - StyleSheet_Addition_Label= "" + StyleSheet_Addition_Arrow = "" + StyleSheet_Addition_Label = "" if showText is False: StyleSheet_Addition_Arrow = ( "QToolButton, QLabel {background-color: " @@ -565,6 +560,7 @@ def SetToFoldRibbon(): CommandButtonHeight = CommandButtonHeight - ArrowButton.height() else: MenuButtonSpace = 0 + # if showText is True: # Create custom events # @@ -572,12 +568,10 @@ def SetToFoldRibbon(): def mouseClickevent(event): CommandButton.animateClick() - Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) + Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) # Change the background color for commandbutton and label on hovering (CSS) - def enterEventCustom(event): + def enterEventCustom(event): BorderColor = StyleMapping_Ribbon.ReturnStyleItem("Border_Color") if Parameters_Ribbon.CUSTOM_COLORS_ENABLED: BorderColor = Parameters_Ribbon.COLOR_BORDERS @@ -585,9 +579,9 @@ def enterEventCustom(event): BorderColor = StyleMapping_Ribbon.ReturnStyleItem( "Background_Color_Hover" ) - + StyleSheet_Addition_Command = "" - StyleSheet_Addition_Label = "" + StyleSheet_Addition_Label = "" if showText is False: StyleSheet_Addition_Label = ( "QToolButton, QLabel {background-color: " @@ -670,9 +664,7 @@ def enterEventCustom(event): CommandButton.setStyleSheet(StyleSheet_Addition_Command) Label_Text.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) - CommandButton.enterEvent = lambda enterEvent: enterEventCustom( - enterEvent - ) + CommandButton.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) if showText is False: # Hide the text and set the width @@ -708,7 +700,7 @@ def leaveEventCustom(event): Layout.setSpacing(0) # Add the layout to the button btn.setLayout(Layout) - + if showText is False: # Hide the text and set the width Label_Text.setHidden(True) @@ -739,15 +731,17 @@ def leaveEventCustom(event): width = ButtonSize.width() Label_Text.setFixedWidth(width) if Menu is not None and len(Menu.actions()) <= 1: - Label_Text.setFixedHeight(Label_Text.height()+ MenuButtonSpace) + Label_Text.setFixedHeight(Label_Text.height() + MenuButtonSpace) ArrowButton.setFixedWidth(width) # CommandButton.setFixedSize(QSize(width, CommandButtonHeight)) - CommandButton.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + CommandButton.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding + ) btn.setFixedSize(QSize(width, ButtonSize.height())) self.labelWidth = width self.menuButtonWidth = ArrowButton.width() - + # Return the button btn.setObjectName("CustomWidget_Large") return btn @@ -770,12 +764,12 @@ def CustomToolButton( Menu: QMenu = None, MenuButtonSpace=16, parent=None, - ButtonStyle = "small" + ButtonStyle="small", ): # Small buttons have no wordwrap if ButtonStyle == "small": - setWordWrap= False - + setWordWrap = False + # Define the controls btn = QToolButton() CommandButton = QToolButton() @@ -807,7 +801,7 @@ def CustomToolButton( if len(Menu.actions()) == 0: CommandButton.addAction(Action) CommandButton.setDefaultAction(Action) - + CommandButton.setObjectName("CommandButton") ArrowButton.setObjectName("MenuButton") @@ -823,7 +817,7 @@ def CustomToolButton( # if showText is False: if MenuButtonSpace < 12: MenuButtonSpace = 12 - + # Set the width according the commandbutton ArrowButton.setFixedWidth(MenuButtonSpace) @@ -863,7 +857,7 @@ def CustomToolButton( Text, maxLength, MaxNumberOfLines, True )[1] # Add the line with a space to avoid te need to set spacing. (Spacing breaks the hover background) - Label_Text.setText(Label_Text.text() + "\n" +" " + line2) + Label_Text.setText(Label_Text.text() + "\n" + " " + line2) if ( FontMetrics.tightBoundingRect(line1).width() > FontMetrics.tightBoundingRect(line2).width() @@ -945,7 +939,9 @@ def CustomToolButton( Menu.setStyleSheet(StyleSheet_Menu) ArrowButton.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup) # Set the height according the space for the menubutton - ArrowButton.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) + ArrowButton.setSizePolicy( + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding + ) ArrowButton.adjustSize() # Set the arrow to none. It will be defined via CSS ArrowButton.setArrowType(Qt.ArrowType.NoArrow) @@ -961,28 +957,24 @@ def CustomToolButton( def mouseClickevent(event): ArrowButton.animateClick() - Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) - ArrowButton.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) + Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) + ArrowButton.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) # Change the background color for commandbutton and label on hovering (CSS) def enterEventCustom(event): # if CommandButton.isEnabled() is False: # return - + BorderColor = StyleMapping_Ribbon.ReturnStyleItem("Border_Color") if Parameters_Ribbon.CUSTOM_COLORS_ENABLED: BorderColor = Parameters_Ribbon.COLOR_BORDERS if Parameters_Ribbon.BORDER_TRANSPARANT: BorderColor = StyleMapping_Ribbon.ReturnStyleItem( "Background_Color_Hover" - ) + ) StyleSheet_Addition_Arrow = "" - StyleSheet_Addition_Label = "" - if showText is False: + StyleSheet_Addition_Label = "" + if showText is False: StyleSheet_Addition_Arrow = ( "QToolButton, QLabel {" + "background-color: " @@ -1010,7 +1002,7 @@ def enterEventCustom(event): + ";spacing: 0px" + ";}" ) - if showText is True: + if showText is True: StyleSheet_Addition_Arrow = ( "QToolButton, QLabel {background-color: " # + StyleMapping_Ribbon.ReturnStyleItem("Background_Color_Hover") @@ -1063,9 +1055,7 @@ def enterEventCustom(event): ArrowButton.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) Label_Text.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) - CommandButton.enterEvent = lambda enterEvent: enterEventCustom( - enterEvent - ) + CommandButton.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) # restore the stylesheets on leaving def leaveEventCustom(event): @@ -1099,18 +1089,14 @@ def SetToFoldRibbon(): def mouseClickevent(event): CommandButton.animateClick() - Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) - ArrowButton.mousePressEvent = lambda mouseClick: mouseClickevent( - mouseClick - ) + Label_Text.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) + ArrowButton.mousePressEvent = lambda mouseClick: mouseClickevent(mouseClick) # Change the background color for commandbutton and label on hovering (CSS) def enterEventCustom(event): # if CommandButton.isEnabled() is False: # return - + BorderColor = StyleMapping_Ribbon.ReturnStyleItem("Border_Color") if Parameters_Ribbon.CUSTOM_COLORS_ENABLED: BorderColor = Parameters_Ribbon.COLOR_BORDERS @@ -1118,10 +1104,10 @@ def enterEventCustom(event): BorderColor = StyleMapping_Ribbon.ReturnStyleItem( "Background_Color_Hover" ) - - StyleSheet_Addition_Command= "" - StyleSheet_Addition_Label= "" - if showText is False: + + StyleSheet_Addition_Command = "" + StyleSheet_Addition_Label = "" + if showText is False: StyleSheet_Addition_Label = ( "QToolButton, QLabel, QToolButton {background-color: " # + StyleMapping_Ribbon.ReturnStyleItem("Background_Color_Hover") @@ -1193,10 +1179,8 @@ def enterEventCustom(event): CommandButton.setStyleSheet(StyleSheet_Addition_Command) Label_Text.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) - CommandButton.enterEvent = lambda enterEvent: enterEventCustom( - enterEvent - ) - + CommandButton.enterEvent = lambda enterEvent: enterEventCustom(enterEvent) + # restore the stylesheets on leaving def leaveEventCustom(event): StyleSheet = StyleMapping_Ribbon.ReturnStyleSheet( @@ -1225,7 +1209,7 @@ def leaveEventCustom(event): btn.mouseMoveEvent = lambda mouseEvent: CustomControls.mouseMoveEvent( btn, mouseEvent ) - + # Hide the text if set in preferences if showText is False: Label_Text.setHidden(True) @@ -1249,13 +1233,19 @@ def leaveEventCustom(event): Label_Text.setHidden(True) btn.setFixedWidth(ButtonSize.width() + MenuButtonSpace) btn.setFixedHeight(ButtonSize.height()) - CommandButton.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) - Label_Text.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) - ArrowButton.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) - + CommandButton.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding + ) + Label_Text.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding + ) + ArrowButton.setSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding + ) + self.labelWidth = TextWidth self.menuButtonWidth = ArrowButton.width() - + # return the new button btn.setObjectName("CustomWidget_Small") if ButtonStyle == "medium": @@ -1287,7 +1277,6 @@ def CustomOptionMenu(Menu=None, actionList=None, parent=None): action_1.setObjectName(action_0.data()) # Add the second action Menu.addAction(action_1) - # Set the stylesheet BackGroundColor = StyleMapping_Ribbon.ReturnStyleItem("Background_Color") @@ -1295,10 +1284,10 @@ def CustomOptionMenu(Menu=None, actionList=None, parent=None): if Parameters_Ribbon.CUSTOM_COLORS_ENABLED: BorderColor = Parameters_Ribbon.COLOR_BORDERS if Parameters_Ribbon.BORDER_TRANSPARANT: - BorderColor = StyleMapping_Ribbon.ReturnStyleItem( - "Background_Color_Hover" - ) - Menu.setStyleSheet("background-color: " + BackGroundColor + ";border: " + BorderColor + ";") + BorderColor = StyleMapping_Ribbon.ReturnStyleItem("Background_Color_Hover") + Menu.setStyleSheet( + "background-color: " + BackGroundColor + ";border: " + BorderColor + ";" + ) # Define an custom enter event, to set "MenuEntered" to True on the ribbon and unfold the ribbon def enterEventCustom(event): @@ -1335,6 +1324,7 @@ def EmptyButton(): ) return btn + class CustomSeparator(RibbonSeparator): def mouseMoveEvent(self, e): if e.buttons() == Qt.MouseButton.LeftButton: @@ -1351,22 +1341,23 @@ def mouseMoveEvent(self, e): except Exception as e: print(e) + class DragTargetIndicator(QLabel): _topMargins: int = 6 _bottomMargins: int = 6 _leftMargins: int = 6 _rightMargins: int = 6 _orientation: str = "right" - - def __init__(self, parent=None, orientation = None, margins = 6): + + def __init__(self, parent=None, orientation=None, margins=6): """Create a new drag indicator Args: parent (optional): parent of the drag indicator. Defaults to None. - orientation ("left", "right, "top", "bottom", optional): The orientation of the drag indicater. If set, a line is drawn otherwise a background color is set. + orientation ("left", "right, "top", "bottom", optional): The orientation of the drag indicater. If set, a line is drawn otherwise a background color is set. Defaults to None. margins (int, optional): the margins for the line if orientation is set. Defaults to 6. - """ + """ super().__init__(parent) self.setContentsMargins(0, 0, 0, 0) if orientation is None: @@ -1382,7 +1373,7 @@ def __init__(self, parent=None, orientation = None, margins = 6): self._leftMargins = margins self._rightMargins = margins self.setAcceptDrops(True) - + def paintEvent(self, event: QPaintEvent) -> None: if self._orientation is None: return @@ -1392,7 +1383,7 @@ def paintEvent(self, event: QPaintEvent) -> None: pen.setWidth(3) painter.setPen(pen) if self._orientation == "right": - x1 = self.rect().x() + self.rect().width() -3 + x1 = self.rect().x() + self.rect().width() - 3 painter.drawLine( QPoint(x1, self.rect().top() + self._topMargins), QPoint(x1, self.rect().bottom() - self._bottomMargins), @@ -1410,12 +1401,13 @@ def paintEvent(self, event: QPaintEvent) -> None: QPoint(self.rect().right() - self._rightMargins, y1), ) if self._orientation == "bottom": - y1 = self.rect().y() - self.rect().heigth() +3 + y1 = self.rect().y() - self.rect().heigth() + 3 painter.drawLine( QPoint(self.rect().left() + self._leftMargins, y1), QPoint(self.rect().right() - self._rightMargins, y1), ) + class Toggle(QCheckBox): _transparent_pen = QPen(Qt.transparent) @@ -1511,6 +1503,7 @@ def pulse_radius(self, pos): self._pulse_radius = pos self.update() + class AnimatedToggle(Toggle): _transparent_pen = QPen(Qt.GlobalColor.transparent) @@ -1521,7 +1514,7 @@ def __init__( *args, pulse_unchecked_color="#44999999", pulse_checked_color="#4400B0EE", - **kwargs + **kwargs, ): self._pulse_radius = 0 @@ -1600,10 +1593,11 @@ def paintEvent(self, e: QPaintEvent): p.end() + class ToggleAction(QWidgetAction): Toggle = Toggle() Toggle.setObjectName("toggle") - + checkStateChanged = Toggle.stateChanged def __init__(self, parent, text, checked): @@ -1618,11 +1612,11 @@ def __init__(self, parent, text, checked): if checked is None: checked = False self.Toggle.setChecked(checked) - + self.setCheckable(True) self.setDefaultWidget(self.widget) return - + def setCheckState(self, CheckState: Qt.CheckState): self.Toggle.setCheckState(CheckState) if CheckState == Qt.CheckState.Checked: @@ -1645,23 +1639,24 @@ def setChecked(self, arg_1, /): def isChecked(self, /) -> bool: return self.Toggle.isChecked() - + def setFixedWidth(self, w): self.Toggle.setFixedWidth(w) return - + def setFixedHeight(self, h): self.Toggle.setFixedHeight(h) return - + def setFixedSize(self, w, h): self.Toggle.setFixedSize(w, h) return + class CheckBoxAction(QWidgetAction): checkbox = QCheckBox() checkbox.setObjectName("checkbox") - + checkStateChanged = checkbox.stateChanged def __init__(self, parent, text): @@ -1673,7 +1668,7 @@ def __init__(self, parent, text): layout.addWidget(self.checkbox) layout.addWidget(label) self.widget.setLayout(layout) - + self.setCheckable(True) self.setDefaultWidget(self.widget) return @@ -1684,31 +1679,32 @@ def setCheckState(self, CheckState: Qt.CheckState): def setChecked(self, arg_1, /): self.checkbox.setChecked(arg_1) - return + return def isChecked(self, /) -> bool: return self.checkbox.isChecked() - + def setFixedWidth(self, w): self.checkbox.setFixedWidth(w) return - + def setFixedHeight(self, h): self.checkbox.setFixedHeight(h) return - + def setFixedSize(self, w, h): self.checkbox.setFixedSize(w, h) return + class SpinBoxAction(QWidgetAction): - + spinbox = QSpinBox() spinbox.setObjectName("spinbox") spinbox.setAlignment(Qt.AlignmentFlag.AlignCenter) - - valueChanged = spinbox.valueChanged - + + valueChanged = spinbox.valueChanged + def __init__(self, parent, text): super(SpinBoxAction, self).__init__(parent) layout = QHBoxLayout() @@ -1721,43 +1717,44 @@ def __init__(self, parent, text): self.setDefaultWidget(self.widget) return - + def value(self, /): return self.spinbox.value() - + def setMaximum(self, max: int, /): self.spinbox.setMaximum(max) return - + def setMinimum(self, min: int, /): self.spinbox.setMinimum(min) return - + def setValue(self, val, /): self.spinbox.setValue(val) return - + def setFixedWidth(self, w): self.spinbox.setFixedWidth(w) return - + def setFixedHeight(self, h): self.spinbox.setFixedHeight(h) return - + def setFixedSize(self, w, h): self.spinbox.setFixedSize(w, h) return - + + class ComboBoxAction(QWidgetAction): - + combobox = QComboBox() combobox.setObjectName("combobox") combobox.setStyleSheet("""QComboBox {padding-left: 6px;}""") - + activated = combobox.activated currentTextChanged = combobox.currentTextChanged - + def __init__(self, parent, text): super(ComboBoxAction, self).__init__(parent) layout = QHBoxLayout() @@ -1770,7 +1767,7 @@ def __init__(self, parent, text): self.setDefaultWidget(self.widget) return - + def addItem(self, text: str, /, userData: typing.Any = None) -> None: exists = False for i in range(self.combobox.count()): @@ -1780,42 +1777,43 @@ def addItem(self, text: str, /, userData: typing.Any = None) -> None: if exists is False: self.combobox.addItem(text, userData) return - + def currentText(self, /): return self.combobox.currentText() - + def setCurrentText(self, text: str, /): self.combobox.setCurrentText(text) return - + def itemText(self, index, /): return self.combobox.itemText(index) - + def count(self, /): return self.combobox.count() - + def setFixedWidth(self, w): self.combobox.setFixedWidth(w) return - + def setFixedHeight(self, h): self.combobox.setFixedHeight(h) return - + def setFixedSize(self, w, h): self.combobox.setFixedSize(w, h) return - + + class LineEditAction(QWidgetAction): - + lineEdit = QLineEdit() lineEdit.setObjectName("lineEdit") lineEdit.setFixedSize(300, 21) lineEdit.setClearButtonEnabled(True) - - editingFinished = lineEdit.editingFinished - textChanged = lineEdit.textChanged - + + editingFinished = lineEdit.editingFinished + textChanged = lineEdit.textChanged + def __init__(self, parent, text): super(LineEditAction, self).__init__(parent) layout = QVBoxLayout() @@ -1832,22 +1830,22 @@ def __init__(self, parent, text): def setText(self, val): self.lineEdit.setText(val) return - + def setPlaceholderText(self, val): self.lineEdit.setPlaceholderText(val) return - + def setFixedWidth(self, w): self.lineEdit.setFixedWidth(w) return - + def setFixedHeight(self, h): self.lineEdit.setFixedHeight(h) return - + def setFixedSize(self, w, h): - self.lineEdit.setFixedSize(w,h) - + self.lineEdit.setFixedSize(w, h) + def setClearButtonEnabled(self, enable: bool): self.lineEdit.setClearButtonEnabled(enable) - return \ No newline at end of file + return diff --git a/FCBinding.py b/FCBinding.py index 1fa754a7..bfe68bd4 100644 --- a/FCBinding.py +++ b/FCBinding.py @@ -103,7 +103,16 @@ QSignalBlocker, QMimeData, ) -from CustomWidgets import CustomControls, DragTargetIndicator, Toggle, ToggleAction, CheckBoxAction, SpinBoxAction, ComboBoxAction, CustomSeparator +from CustomWidgets import ( + CustomControls, + DragTargetIndicator, + Toggle, + ToggleAction, + CheckBoxAction, + SpinBoxAction, + ComboBoxAction, + CustomSeparator, +) import json import os @@ -145,7 +154,12 @@ from pyqtribbon_local.panel import RibbonPanel, RibbonPanelItemWidget, RibbonPanelTitle from pyqtribbon_local.toolbutton import RibbonToolButton, RibbonButtonStyle from pyqtribbon_local.separator import RibbonSeparator -from pyqtribbon_local.category import RibbonCategory, RibbonCategoryLayoutButton, RibbonNormalCategory, RibbonContextCategory +from pyqtribbon_local.category import ( + RibbonCategory, + RibbonCategoryLayoutButton, + RibbonNormalCategory, + RibbonContextCategory, +) # Get the main window of FreeCAD mw: QMainWindow = Gui.getMainWindow() @@ -207,18 +221,18 @@ class ModernMenu(RibbonBar): # Declare the right padding for dropdown menus PaddingRight = 10 - + # Declare the spacing between buttons ButtonSpacing = 6 - + # Declare the alignment of the buttons ButtonAlignment = Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter - + # Declare the top and bottom margin for the tabbar (category) TopMargin = 3 BottomMargin = 0 - # Create the lists and ditcs for the lists in the ribbon structure, + # Create the lists and ditcs for the lists in the ribbon structure, ignoredToolbars = [] iconOnlyToolbars = [] quickAccessCommands = [] @@ -273,25 +287,25 @@ class ModernMenu(RibbonBar): # a action list for the right click event in the customize enviroment. # Used to store the button states actionList = [] - + # Create a dict for the active workbench only workBenchDict = {} - + # Create a empty context menu contextMenu = None - + # Create a holder for the last customized workbench LastCustomized = [] - + # Create a list for panels that have a option button which have to be restored when exitiing the customisation enviroment longPanels = [] - + # Create a list to store the pin buttons off each category pinButtonList = [] - + # Create a dict to store the button states when entering the customization enviroment ButtonState = {} - + MaxRowsPerWB = {} # endregion @@ -306,7 +320,7 @@ def __init__(self): self.setAcceptDrops(True) self.tabBar().setAcceptDrops(True) self._titleWidget.quickAccessToolBar().setAcceptDrops(True) - + # connect the signals self.connectSignals() @@ -511,26 +525,28 @@ def __init__(self): PackageXML, "url", "type", "repository" ) LocalVersion = StandardFunctions.ReturnXML_Value( - PackageXML, "version", + PackageXML, + "version", ) if self.ReproAdress != "" or self.ReproAdress is not None: print(translate("FreeCAD Ribbon", "Ribbon UI: ") + self.ReproAdress) - print(translate("FreeCAD Ribbon", "Ribbon UI: Installed version: ") + LocalVersion) - + print( + translate("FreeCAD Ribbon", "Ribbon UI: Installed version: ") + + LocalVersion + ) + # Get the location of the help documentation PackageXML = os.path.join(os.path.dirname(__file__), "package.xml") self.HelpAdress = StandardFunctions.ReturnXML_Value( PackageXML, "url", "type", "website" ) - + # Activate the workbenches used in the new panels otherwise the panel stays empty try: for WorkBenchName in self.newPanels: for NewPanel in self.newPanels[WorkBenchName]: # Get the commands from the custom panel - Commands = self.newPanels[WorkBenchName][ - NewPanel - ] + Commands = self.newPanels[WorkBenchName][NewPanel] # Get the command and its original toolbar for CommandItem in Commands: @@ -540,7 +556,7 @@ def __init__(self): and CommandItem[1] != "Standard" ): # Activate the workbench if not loaded - Gui.activateWorkbench(CommandItem[1]) + Gui.activateWorkbench(CommandItem[1]) except Exception as e: if Parameters_Ribbon.DEBUG_MODE is True: StandardFunctions.Print( @@ -582,14 +598,22 @@ def __init__(self): # host: str ="https://codeberg.org" host = "https://github.com" LatestVersion = StandardFunctions.ReturnXML_Value_Git( - User=User, Repository=Repo, Branch=Branch, File=File, ElementName=ElementName, attribKey=attribKey, attribValue=attribValue, host=host + User=User, + Repository=Repo, + Branch=Branch, + File=File, + ElementName=ElementName, + attribKey=attribKey, + attribValue=attribValue, + host=host, + ) + print( + translate("FreeCAD Ribbon", "Ribbon UI: Latest released version: ") + + str(LatestVersion) ) - print(translate("FreeCAD Ribbon", "Ribbon UI: Latest released version: ") + str(LatestVersion)) # Get the current version PackageXML = os.path.join(os.path.dirname(__file__), "package.xml") - CurrentVersion = StandardFunctions.ReturnXML_Value( - PackageXML, "version" - ) + CurrentVersion = StandardFunctions.ReturnXML_Value(PackageXML, "version") # Check if you are on a developer version. If so set developer version if CurrentVersion.lower().endswith("x"): self.DeveloperVersion = CurrentVersion @@ -647,7 +671,9 @@ def __init__(self): + hexColor + ";}" ) - self.StyleSheet = StyleSheet_Addition_2 + self.StyleSheet + StyleSheet_Addition + self.StyleSheet = ( + StyleSheet_Addition_2 + self.StyleSheet + StyleSheet_Addition + ) self.setStyleSheet(self.StyleSheet) # If the text for the tabs is set to be disabled, update the stylesheet @@ -663,10 +689,10 @@ def __init__(self): "Background_Color_Hover", True, True ) + """;min-width: """ - + str(self.TabBar_Size-3) + + str(self.TabBar_Size - 3) + """px; max-width: """ - + str(self.TabBar_Size-3) + + str(self.TabBar_Size - 3) + """px; padding-left: 6px; padding-right: 3px; @@ -706,7 +732,7 @@ def __init__(self): ) self.StyleSheet = self.StyleSheet + StyleSheet_Addition_5 self.setStyleSheet(self.StyleSheet) - + # # Add a line at the bottom of the ribbon # StyleSheet_Addition_6 = ( # """RibbonCategory { @@ -716,7 +742,7 @@ def __init__(self): # ) # self.StyleSheet = self.StyleSheet + StyleSheet_Addition_6 # self.setStyleSheet(self.StyleSheet) - + # get the state of the mainwindow self.MainWindowLoaded = True @@ -933,7 +959,7 @@ def __init__(self): # Install an event filter to catch events from the main window and act on it. mw.installEventFilter(EventInspector(mw)) # self.installEventFilter(RibbonEventInspector(self)) - + # Set isLoaded to True, to show that the loading is finished self.isLoaded = True # Fold the ribbon if unpinned @@ -1024,41 +1050,55 @@ def wheelEvent_TabBar(self, event): for i in range(NoClicks): ScrollRightButton_Tab.click() return + # endregion # region - Customise functions def contextMenuEvent(self, event): workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - + # Create the menu self.contextMenu = QMenu(self) self.contextMenu.setStyleSheet("spacing: 0px;margin: 0px;padding: 0px;") - + # Declare a dict for this workbench only self.workBenchDict = {} # add keys if they don“t exist - Standard_Functions_Ribbon.add_keys_nested_dict(self.workBenchDict, ["workbenches", workbenchName], endEmpty=True) - Standard_Functions_Ribbon.add_keys_nested_dict(self.ribbonStructure, ["workbenches", workbenchName], endEmpty=True) - self.workBenchDict["workbenches"][workbenchName] = self.ribbonStructure["workbenches"][workbenchName] - + Standard_Functions_Ribbon.add_keys_nested_dict( + self.workBenchDict, ["workbenches", workbenchName], endEmpty=True + ) + Standard_Functions_Ribbon.add_keys_nested_dict( + self.ribbonStructure, ["workbenches", workbenchName], endEmpty=True + ) + self.workBenchDict["workbenches"][workbenchName] = self.ribbonStructure[ + "workbenches" + ][workbenchName] + # If betaFunctions is enabled, coninue if self.BetaFunctionsEnabled is True: # Get the widget and the panel widget = self.childAt(event.pos()).parent() - panel = widget.parent().parent().parent() + panel = widget.parent().parent().parent() separator = widget.findChild(CustomSeparator) titleWidget = widget.findChild(RibbonPanelTitle) # Check if the panel is not none and of type RibbonPanel. If so, continue if panel is not None and type(panel) is RibbonPanel: if ( - (type(widget) is QToolButton or type(widget) is RibbonPanelItemWidget) - and self.CustomizeEnabled is True and titleWidget is None + ( + type(widget) is QToolButton + or type(widget) is RibbonPanelItemWidget + ) + and self.CustomizeEnabled is True + and titleWidget is None ): if separator is None: # Define the context menu for buttons - self.contextMenu.setContentsMargins(3,3,3,3) - self.contextMenu.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.MinimumExpanding) - + self.contextMenu.setContentsMargins(3, 3, 3, 3) + self.contextMenu.setSizePolicy( + QSizePolicy.Policy.Preferred, + QSizePolicy.Policy.MinimumExpanding, + ) + # Check if the widget has text enabled textVisible = None try: @@ -1069,7 +1109,11 @@ def contextMenuEvent(self, event): and child.objectName() == "CommandButton" ): CommandName = child.defaultAction().data() - textVisible = self.workBenchDict["workbenches"][workbenchName]["toolbars"][panel.objectName()]["commands"][CommandName]["textEnabled"] + textVisible = self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panel.objectName()]["commands"][CommandName][ + "textEnabled" + ] except Exception: pass if textVisible is None: @@ -1077,30 +1121,50 @@ def contextMenuEvent(self, event): if type(child) is QLabel: textVisible = child.isVisible() # set the checkbox for enabling text - RibbonButtonAction_Text = ToggleAction(self, translate("FreeCAD Ribbon", "Show button text"), textVisible) - RibbonButtonAction_Text.setText(translate("FreeCAD Ribbon", "Show button text")) + RibbonButtonAction_Text = ToggleAction( + self, + translate("FreeCAD Ribbon", "Show button text"), + textVisible, + ) + RibbonButtonAction_Text.setText( + translate("FreeCAD Ribbon", "Show button text") + ) # Set the checkbox action checked or unchecked RibbonButtonAction_Text.setChecked(textVisible) if textVisible is True: RibbonButtonAction_Text.setCheckState(Qt.CheckState.Checked) if textVisible is False: - RibbonButtonAction_Text.setCheckState(Qt.CheckState.Unchecked) - RibbonButtonAction_Text.setFixedSize(82,41) - RibbonButtonAction_Text.checkStateChanged.connect(lambda: self.on_TextState_Changed(panel, widget, RibbonButtonAction_Text.isChecked())) + RibbonButtonAction_Text.setCheckState( + Qt.CheckState.Unchecked + ) + RibbonButtonAction_Text.setFixedSize(82, 41) + RibbonButtonAction_Text.checkStateChanged.connect( + lambda: self.on_TextState_Changed( + panel, widget, RibbonButtonAction_Text.isChecked() + ) + ) # Add the checkbox action to the contextmenu self.contextMenu.addAction(RibbonButtonAction_Text) - + # Set the spinbox for the button size - RibbonButtonAction_Size = SpinBoxAction(self, translate("FreeCAD Ribbon", "Set button size")) + RibbonButtonAction_Size = SpinBoxAction( + self, translate("FreeCAD Ribbon", "Set button size") + ) RibbonButtonAction_Size.setMinimum(16) - RibbonButtonAction_Size.setMaximum(120) + RibbonButtonAction_Size.setMaximum(120) RibbonButtonAction_Size.setValue(widget.height()) RibbonButtonAction_Size.setFixedWidth(82) - RibbonButtonAction_Size.valueChanged.connect(lambda: self.on_ButtonSize_Changed(panel, widget, RibbonButtonAction_Size)) + RibbonButtonAction_Size.valueChanged.connect( + lambda: self.on_ButtonSize_Changed( + panel, widget, RibbonButtonAction_Size + ) + ) self.contextMenu.addAction(RibbonButtonAction_Size) - + # Set the dropdown for the button style - RibbonButtonAction_Style = ComboBoxAction(self, translate("FreeCAD Ribbon", "Set button type")) + RibbonButtonAction_Style = ComboBoxAction( + self, translate("FreeCAD Ribbon", "Set button type") + ) RibbonButtonAction_Style.addItem("Small") RibbonButtonAction_Style.addItem("Medium") RibbonButtonAction_Style.addItem("Large") @@ -1111,26 +1175,51 @@ def contextMenuEvent(self, event): if widget.objectName() == "CustomWidget_Large": RibbonButtonAction_Style.setCurrentText("Large") RibbonButtonAction_Style.setFixedWidth(82) - RibbonButtonAction_Style.currentTextChanged.connect(lambda: self.on_ButtonStyle_Clicked(panel, widget, RibbonButtonAction_Style, RibbonButtonAction_Size)) + RibbonButtonAction_Style.currentTextChanged.connect( + lambda: self.on_ButtonStyle_Clicked( + panel, + widget, + RibbonButtonAction_Style, + RibbonButtonAction_Size, + ) + ) self.contextMenu.addAction(RibbonButtonAction_Style) - + # Add a line edit for changing the text - ChangeButtonText = CustomWidgets.LineEditAction(self, translate("FreeCAD Ribbon", "Set button text")) - text = widget.parent().findChild(QLabel).text().replace("\n", " ") + ChangeButtonText = CustomWidgets.LineEditAction( + self, translate("FreeCAD Ribbon", "Set button text") + ) + text = ( + widget.parent().findChild(QLabel).text().replace("\n", " ") + ) ChangeButtonText.setText("") ChangeButtonText.setPlaceholderText(text) - ChangeButtonText.setFixedSize(200,21) + ChangeButtonText.setFixedSize(200, 21) ChangeButtonText.setClearButtonEnabled(True) - ChangeButtonText.textChanged.connect(lambda e: self.on_ButtonLabel_Changing(e, panel, widget, ChangeButtonText)) - ChangeButtonText.editingFinished.connect(lambda: lambda: self.contextMenu.close()) + ChangeButtonText.textChanged.connect( + lambda e: self.on_ButtonLabel_Changing( + e, panel, widget, ChangeButtonText + ) + ) + ChangeButtonText.editingFinished.connect( + lambda: lambda: self.contextMenu.close() + ) self.contextMenu.addAction(ChangeButtonText) - + # Create the buttons for adding a separator - AddSeparator_Left = self.contextMenu.addAction(translate("FreeCAD Ribbon", "Add separator left")) - AddSeparator_Left.triggered.connect(lambda: self.on_AddSeparator_Clicked(panel, widget,"left")) - AddSeparator_Right = self.contextMenu.addAction(translate("FreeCAD Ribbon", "Add separator right")) - AddSeparator_Right.triggered.connect(lambda: self.on_AddSeparator_Clicked(panel, widget,"right")) - + AddSeparator_Left = self.contextMenu.addAction( + translate("FreeCAD Ribbon", "Add separator left") + ) + AddSeparator_Left.triggered.connect( + lambda: self.on_AddSeparator_Clicked(panel, widget, "left") + ) + AddSeparator_Right = self.contextMenu.addAction( + translate("FreeCAD Ribbon", "Add separator right") + ) + AddSeparator_Right.triggered.connect( + lambda: self.on_AddSeparator_Clicked(panel, widget, "right") + ) + # create the context menu action self.contextMenu.exec_(self.mapToGlobal(event.pos())) @@ -1138,44 +1227,62 @@ def contextMenuEvent(self, event): RibbonButtonAction_Style.currentTextChanged.disconnect() RibbonButtonAction_Text.checkStateChanged.disconnect() RibbonButtonAction_Size.valueChanged.disconnect() - AddSeparator_Left.triggered.disconnect() + AddSeparator_Left.triggered.disconnect() AddSeparator_Right.triggered.disconnect() - ChangeButtonText.textChanged.disconnect() + ChangeButtonText.textChanged.disconnect() ChangeButtonText.editingFinished.disconnect() - + return - if titleWidget is not None and self.CustomizeEnabled is True and titleWidget.underMouse(): + if ( + titleWidget is not None + and self.CustomizeEnabled is True + and titleWidget.underMouse() + ): panel = titleWidget.parent().parent() - ChangePanelTitle = CustomWidgets.LineEditAction(self, translate("FreeCAD Ribbon", "Change panel title")) + ChangePanelTitle = CustomWidgets.LineEditAction( + self, translate("FreeCAD Ribbon", "Change panel title") + ) ChangePanelTitle.setText("") ChangePanelTitle.setPlaceholderText(panel.title()) ChangePanelTitle.setClearButtonEnabled(True) - ChangePanelTitle.textChanged.connect(lambda e: self.on_PanelTitle_Changing(e, panel, ChangePanelTitle)) - ChangePanelTitle.editingFinished.connect(lambda: self.contextMenu.close()) + ChangePanelTitle.textChanged.connect( + lambda e: self.on_PanelTitle_Changing(e, panel, ChangePanelTitle) + ) + ChangePanelTitle.editingFinished.connect( + lambda: self.contextMenu.close() + ) self.contextMenu.addAction(ChangePanelTitle) - + # create the context menu action self.contextMenu.exec_(self.mapToGlobal(event.pos())) - + # Disconnect the widgetActions ChangePanelTitle.textChanged.disconnect() ChangePanelTitle.editingFinished.disconnect() - + # if the separator is not none, its class is correct and it is under the mouse cursor, # Create a menu with an remove button - if separator is not None and type(separator) is CustomSeparator and separator.underMouse(): + if ( + separator is not None + and type(separator) is CustomSeparator + and separator.underMouse() + ): if self.CustomizeEnabled is True: panel = separator.parent().parent() # Create the menu - RemoveSeparator = self.contextMenu.addAction(translate("FreeCAD Ribbon", "Remove separator")) + RemoveSeparator = self.contextMenu.addAction( + translate("FreeCAD Ribbon", "Remove separator") + ) # create the context menu action - RemoveSeparator.triggered.connect(lambda: self.on_RemoveSeparator_Clicked(panel, separator)) - + RemoveSeparator.triggered.connect( + lambda: self.on_RemoveSeparator_Clicked(panel, separator) + ) + # create the context menu action self.contextMenu.exec_(self.mapToGlobal(event.pos())) return - + # If you are not yet in the customize enviroment, create a menu for entering it. if panel is not None and type(panel) is not RibbonPanel: # Add the buttons @@ -1193,24 +1300,36 @@ def contextMenuEvent(self, event): border-bottom: 0.5px solid red; }""" StyleSheet = self.StyleSheet + Addition - self.setStyleSheet(StyleSheet) + self.setStyleSheet(StyleSheet) self.CustomizeEnabled = True # Just incase - self.setRibbonHeight(self.RibbonHeight+6) - + self.setRibbonHeight(self.RibbonHeight + 6) + # Store the workbench name as the last customized name - self.LastCustomized = [workbenchName, self.currentCategory().title()] - + self.LastCustomized = [ + workbenchName, + self.currentCategory().title(), + ] + # Store the state of the buttons for title, objPanel in self.currentCategory().panels().items(): panelName = objPanel.objectName() gridLayout = objPanel._actionsLayout for n in range(gridLayout.count()): - control: QToolButton = gridLayout.itemAt(n).widget().findChild(CustomControls) + control: QToolButton = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomControls) + ) if control is not None: - StandardFunctions.add_keys_nested_dict(self.ButtonState, [panelName, control.actions().data()]) - self.ButtonState[panelName][control.actions().data()] = control.actions().isEnabled() - + StandardFunctions.add_keys_nested_dict( + self.ButtonState, + [panelName, control.actions().data()], + ) + self.ButtonState[panelName][ + control.actions().data() + ] = control.actions().isEnabled() + # Enable all buttons, so you can access them with a right click self.actionList = [] for child in mw.findChildren(QToolButton): @@ -1221,39 +1340,79 @@ def contextMenuEvent(self, event): except Exception: pass Gui.updateGui() - + # Create all order lists and commands, incase they are not all present - for title, objPanel in self.currentCategory().panels().items(): + for title, objPanel in self.currentCategory().panels().items(): objPanel.show() # Get the panel name and the gridlayout panelName = objPanel.objectName() gridLayout: QGridLayout = objPanel._actionsLayout - # Recreate the order list for the new panel. + # Recreate the order list for the new panel. # This makes sure that all controls are added to the order list orderList = [] for n in range(gridLayout.count()): - control = gridLayout.itemAt(n).widget().findChild(CustomControls) - if control is not None: + control = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomControls) + ) + if control is not None: # Update the orderlist command = control.actions().data() if command is None: - toolButton = control.findChild(QToolButton, "CommandButton") + toolButton = control.findChild( + QToolButton, "CommandButton" + ) print(toolButton.actions()[0]) command = control.defaultAction() orderList.append(command) # Add the command if they don't exist - Standard_Functions_Ribbon.add_keys_nested_dict(self.workBenchDict, ["workbenches", workbenchName, "toolbars", panelName, "commands", control.actions().data(), "size"], "small") + Standard_Functions_Ribbon.add_keys_nested_dict( + self.workBenchDict, + [ + "workbenches", + workbenchName, + "toolbars", + panelName, + "commands", + control.actions().data(), + "size", + ], + "small", + ) # Set the sizes if control.objectName() == "CustomWidget_Small": - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][control.actions().data()]["size"] = "small" + self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panelName]["commands"][ + control.actions().data() + ][ + "size" + ] = "small" if control.objectName() == "CustomWidget_Medium": - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][control.actions().data()]["size"] = "medium" + self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panelName]["commands"][ + control.actions().data() + ][ + "size" + ] = "medium" if control.objectName() == "CustomWidget_Large": - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][control.actions().data()]["size"] = "large" - - separator = gridLayout.itemAt(n).widget().findChild(CustomSeparator) + self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panelName]["commands"][ + control.actions().data() + ][ + "size" + ] = "large" + + separator = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomSeparator) + ) if separator is not None: # Set the separator enabled, so that hovering works separator.setEnabled(True) @@ -1261,44 +1420,106 @@ def contextMenuEvent(self, event): separator.setFixedWidth(16) # Add the separator to the orderlist orderList.append(separator.objectName()) - + # Write the order list - Standard_Functions_Ribbon.add_keys_nested_dict(self.workBenchDict, ["workbenches", workbenchName, "toolbars", panelName, "order"], []) - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["order"] = orderList - - + Standard_Functions_Ribbon.add_keys_nested_dict( + self.workBenchDict, + [ + "workbenches", + workbenchName, + "toolbars", + panelName, + "order", + ], + [], + ) + self.workBenchDict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["order"] = orderList + # If the panel has an overflow menu, replace it with a complete (long) panel if objPanel.panelOptionButton().isVisible(): - newPanel = self.CreatePanel(workbenchName, objPanel.objectName(), False, self.workBenchDict, ignoreColumnLimit=True, showEnableControl=True, enableSeparator=True) - replacedPanel = self.currentCategory().replacePanel(objPanel, newPanel) + newPanel = self.CreatePanel( + workbenchName, + objPanel.objectName(), + False, + self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + enableSeparator=True, + ) + replacedPanel = self.currentCategory().replacePanel( + objPanel, newPanel + ) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(replacedPanel) # Add the newPanel to the list of longPanels self.longPanels.append(newPanel) # Close the old panel objPanel.close() - + # Recreate the order list from the new panel # Get the panel name and the gridlayout panelName = newPanel.objectName() gridLayout: QGridLayout = newPanel._actionsLayout for n in range(gridLayout.count()): - control = gridLayout.itemAt(n).widget().findChild(CustomControls) - if control is not None: + control = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomControls) + ) + if control is not None: # Update the orderlist orderList.append(control.actions().data()) # Add the command if they don't exist - Standard_Functions_Ribbon.add_keys_nested_dict(self.workBenchDict, ["workbenches", workbenchName, "toolbars", panelName, "commands", control.actions().data(), "size"], "small") + Standard_Functions_Ribbon.add_keys_nested_dict( + self.workBenchDict, + [ + "workbenches", + workbenchName, + "toolbars", + panelName, + "commands", + control.actions().data(), + "size", + ], + "small", + ) # Set the sizes if control.objectName() == "CustomWidget_Small": - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][control.actions().data()]["size"] = "small" - if control.objectName() == "CustomWidget_Medium": - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][control.actions().data()]["size"] = "medium" + self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panelName]["commands"][ + control.actions().data() + ][ + "size" + ] = "small" + if ( + control.objectName() + == "CustomWidget_Medium" + ): + self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panelName]["commands"][ + control.actions().data() + ][ + "size" + ] = "medium" if control.objectName() == "CustomWidget_Large": - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][control.actions().data()]["size"] = "large" - - separator = gridLayout.itemAt(n).widget().findChild(CustomSeparator) + self.workBenchDict["workbenches"][ + workbenchName + ]["toolbars"][panelName]["commands"][ + control.actions().data() + ][ + "size" + ] = "large" + + separator = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomSeparator) + ) if separator is not None: # Set the separator enabled, so that hovering works separator.setEnabled(True) @@ -1306,12 +1527,24 @@ def contextMenuEvent(self, event): separator.setFixedWidth(16) # Add the separator to the orderlist orderList.append(separator.objectName()) - + # Write the order list - Standard_Functions_Ribbon.add_keys_nested_dict(self.workBenchDict, ["workbenches", workbenchName, "toolbars", panelName, "order"], []) - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["order"] = orderList - - # show the enable checkboxes + Standard_Functions_Ribbon.add_keys_nested_dict( + self.workBenchDict, + [ + "workbenches", + workbenchName, + "toolbars", + panelName, + "order", + ], + [], + ) + self.workBenchDict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["order"] = orderList + + # show the enable checkboxes titleLayout: QHBoxLayout = objPanel._titleLayout EnableControl = titleLayout.itemAt(0).widget() if EnableControl is not None: @@ -1326,32 +1559,45 @@ def contextMenuEvent(self, event): if item[1] is False: item[0].setDisabled(True) else: - item[0].setEnabled(True) - Gui.updateGui() + item[0].setEnabled(True) + Gui.updateGui() # update the ribbonstructure before writing it to disk - self.ribbonStructure["workbenches"][workbenchName] = self.workBenchDict["workbenches"][workbenchName] - + self.ribbonStructure["workbenches"][workbenchName] = ( + self.workBenchDict["workbenches"][workbenchName] + ) + # Restore the original panel with the overflow menu - panels = {} # Needed to update the panel dict of the currentCategory + panels = ( + {} + ) # Needed to update the panel dict of the currentCategory for title, objPanel in self.currentCategory().panels().items(): # Create keys if there are not existing yet for the temporary panel dict StandardFunctions.add_keys_nested_dict(panels, [title]) - + # Create a bool to state if a panel is new or not IsNewPanel = False for longPanel in self.longPanels: if longPanel.objectName() == objPanel.objectName(): # Create a panel and replace the long panel with this one - newPanel = self.CreatePanel(workbenchName, objPanel.objectName(), False, self.workBenchDict) + newPanel = self.CreatePanel( + workbenchName, + objPanel.objectName(), + False, + self.workBenchDict, + ) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(newPanel) try: - self.currentCategory().replacePanel(longPanel, newPanel) + self.currentCategory().replacePanel( + longPanel, newPanel + ) except Exception: pass try: - self.currentCategory().replacePanel(objPanel, newPanel) + self.currentCategory().replacePanel( + objPanel, newPanel + ) except Exception: pass # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. @@ -1366,67 +1612,108 @@ def contextMenuEvent(self, event): break # If it is not a new panel, add the current panel to temporary panel dict if IsNewPanel is False: - panels[title] = objPanel - + panels[title] = objPanel + # Update the panel dict of the current catergory with the temporary panel dict self.currentCategory()._panels = panels - + # Hide unchecked panels after the panel duct is updated for title, objPanel in self.currentCategory().panels().items(): # hide the enable checkboxes and hide the panel if it is unchecked titleLayout: QHBoxLayout = objPanel._titleLayout EnableControl = titleLayout.itemAt(0).widget() if EnableControl is not None: - if EnableControl.checkState() == Qt.CheckState.Unchecked: + if ( + EnableControl.checkState() + == Qt.CheckState.Unchecked + ): # Hide the panel objPanel.hide() # Write the state to the structure - StandardFunctions.add_keys_nested_dict(self.ribbonStructure, ["workbenches", workbenchName, "toolbars", objPanel.objectName(), "Enabled"]) - self.ribbonStructure["workbenches"][workbenchName]["toolbars"][objPanel.objectName()]["Enabled"] = False + StandardFunctions.add_keys_nested_dict( + self.ribbonStructure, + [ + "workbenches", + workbenchName, + "toolbars", + objPanel.objectName(), + "Enabled", + ], + ) + self.ribbonStructure["workbenches"][workbenchName][ + "toolbars" + ][objPanel.objectName()]["Enabled"] = False if EnableControl.checkState() == Qt.CheckState.Checked: # Write the state to the structure - StandardFunctions.add_keys_nested_dict(self.ribbonStructure, ["workbenches", workbenchName, "toolbars", objPanel.objectName(), "Enabled"]) - self.ribbonStructure["workbenches"][workbenchName]["toolbars"][objPanel.objectName()]["Enabled"] = True + StandardFunctions.add_keys_nested_dict( + self.ribbonStructure, + [ + "workbenches", + workbenchName, + "toolbars", + objPanel.objectName(), + "Enabled", + ], + ) + self.ribbonStructure["workbenches"][workbenchName][ + "toolbars" + ][objPanel.objectName()]["Enabled"] = True objPanel.show() EnableControl.setVisible(False) - + # Set the buttonstate back as it was for title, objPanel in self.currentCategory().panels().items(): # Get the panel name and the gridlayout panelName = objPanel.objectName() gridLayout: QGridLayout = objPanel._actionsLayout for n in range(gridLayout.count()): - control = gridLayout.itemAt(n).widget().findChild(CustomControls) + control = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomControls) + ) if control is not None: try: - ButtonState = self.ButtonState[panelName][control.actions().data()] + ButtonState = self.ButtonState[panelName][ + control.actions().data() + ] control.actions().setEnabled(ButtonState) except Exception: pass - - separator = gridLayout.itemAt(n).widget().findChild(CustomSeparator) + + separator = ( + gridLayout.itemAt(n) + .widget() + .findChild(CustomSeparator) + ) if separator is not None: # Disable the separators to avoid highlighting when hovering separator.setEnabled(False) # Set the separator to its original width separator.setFixedWidth(6) - + # Clear the list with the long panels, so that it can be filled again next time - self.longPanels.clear() + self.longPanels.clear() panel = None - + # Writing to ribbonStructure.json JsonFile = Parameters_Ribbon.RIBBON_STRUCTURE_JSON with open(JsonFile, "w") as outfile: json.dump(self.ribbonStructure, outfile, indent=4) - + # Clear the workbench dict self.workBenchDict.clear() widget = None panel = None return - - def on_ButtonStyle_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomControls, ButtonStyleWidget: ComboBoxAction, ButtonSizeWidget: SpinBoxAction): + + def on_ButtonStyle_Clicked( + self, + panel: RibbonPanel, + ButtonWidget: CustomControls, + ButtonStyleWidget: ComboBoxAction, + ButtonSizeWidget: SpinBoxAction, + ): # get the size to set Size = "small" if ButtonStyleWidget.currentText() == "Medium": @@ -1434,24 +1721,32 @@ def on_ButtonStyle_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomControl if ButtonStyleWidget.currentText() == "Large": Size = "large" - # write the changes to the ribbonstruture file + # write the changes to the ribbonstruture file property = {"size": Size} self.WriteButtonSettings(ButtonWidget, panel, property) - + # Create a new panel workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - newPanel = self.CreatePanel(workbenchName, panel.objectName(), addPanel=False, dict=self.workBenchDict, ignoreColumnLimit=True, showEnableControl=True, enableSeparator=True) + newPanel = self.CreatePanel( + workbenchName, + panel.objectName(), + addPanel=False, + dict=self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + enableSeparator=True, + ) # Add the panel to the list with long panels self.longPanels.append(newPanel) - + # Replace the panel with the new panel self.currentCategory().replacePanel(panel, newPanel) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(newPanel) - + # Update the dict of the currentCategory with the new panel self.currentCategory()._panels[newPanel.objectName()] = newPanel - + # Enable all buttons, so you can access them with a right click for child in mw.findChildren(QToolButton): try: @@ -1461,47 +1756,58 @@ def on_ButtonStyle_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomControl except Exception: pass Gui.updateGui() - + # Close the old panel panel.close() - + # Close the context menu self.contextMenu.close() return - - def on_ButtonSize_Changed(self, panel: RibbonPanel, ButtonWidget: QToolButton, ButtonSizeWidget: SpinBoxAction): + + def on_ButtonSize_Changed( + self, + panel: RibbonPanel, + ButtonWidget: QToolButton, + ButtonSizeWidget: SpinBoxAction, + ): # Get the menubutton height for large buttons menuButtonWidth = 0 if ButtonWidget.objectName() != "CustomWidget_Large": try: - menuButtonWidth = ButtonWidget.findChild(QToolButton, "MenuButton").width() + menuButtonWidth = ButtonWidget.findChild( + QToolButton, "MenuButton" + ).width() except Exception: pass - + # Get the label height for small and medium buttons labelWidth = 0 for child in ButtonWidget.children(): if type(child) == QLabel: if child.isVisible() is True: labelWidth = child.maximumWidth() - + # Set the height to the value of the spinbox ButtonWidget.setFixedHeight(ButtonSizeWidget.value()) # Adjust the with including menubutton and label if ButtonWidget.objectName() != "CustomWidget_Large": - ButtonWidget.setFixedWidth(ButtonSizeWidget.value() + labelWidth + menuButtonWidth) + ButtonWidget.setFixedWidth( + ButtonSizeWidget.value() + labelWidth + menuButtonWidth + ) if ButtonWidget.objectName() == "CustomWidget_Large": ButtonWidget.setFixedWidth(ButtonSizeWidget.value()) ButtonWidget.layout().setAlignment(Qt.AlignmentFlag.AlignLeft) - ButtonWidget.setSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.MinimumExpanding) + ButtonWidget.setSizePolicy( + QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.MinimumExpanding + ) for child in ButtonWidget.children(): if type(child) == QLabel: - child.setFixedWidth(ButtonSizeWidget.value()) + child.setFixedWidth(ButtonSizeWidget.value()) # Set the Button width size to that of its parent ButtonWidget.parent().setFixedSize(ButtonWidget.size()) - - # write the changes to the ribbonstruture file + + # write the changes to the ribbonstruture file property = {"ButtonSize_small": ButtonSizeWidget.value()} if ButtonWidget.objectName() == "CustomWidget_Medium": property = {"ButtonSize_medium": ButtonSizeWidget.value()} @@ -1509,21 +1815,31 @@ def on_ButtonSize_Changed(self, panel: RibbonPanel, ButtonWidget: QToolButton, B property = {"ButtonSize_large": ButtonSizeWidget.value()} self.WriteButtonSettings(ButtonWidget, panel, property) return - - def on_TextState_Changed(self, panel: RibbonPanel, ButtonWidget: CustomControls, TextEnabled: bool): + + def on_TextState_Changed( + self, panel: RibbonPanel, ButtonWidget: CustomControls, TextEnabled: bool + ): # If the widget has no text, show it with the correct width if TextEnabled is True: self.WriteButtonSettings(ButtonWidget, panel, {"textEnabled": TextEnabled}) # if the widget has text, find its QTextEdit and hide it. Update the width - if TextEnabled is False: + if TextEnabled is False: self.WriteButtonSettings(ButtonWidget, panel, {"textEnabled": TextEnabled}) - - # Create a new panel - workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - newPanel = self.CreatePanel(workbenchName, panel.objectName(), addPanel=False, dict=self.workBenchDict, ignoreColumnLimit=True, showEnableControl=True, enableSeparator=True) + + # Create a new panel + workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) + newPanel = self.CreatePanel( + workbenchName, + panel.objectName(), + addPanel=False, + dict=self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + enableSeparator=True, + ) # Add the panel to the list with long panels self.longPanels.append(newPanel) - + # Replace the panel with the new panel self.currentCategory().replacePanel(panel, newPanel) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. @@ -1531,7 +1847,7 @@ def on_TextState_Changed(self, panel: RibbonPanel, ButtonWidget: CustomControls, # Update the dict of the currentCategory with the new panel self.currentCategory()._panels[newPanel.objectName()] = newPanel - + # Enable all buttons, so you can access them with a right click for child in mw.findChildren(QToolButton): try: @@ -1541,15 +1857,17 @@ def on_TextState_Changed(self, panel: RibbonPanel, ButtonWidget: CustomControls, except Exception: pass Gui.updateGui() - + # Close the old panel panel.close() - + # Close the context menu - self.contextMenu.close() + self.contextMenu.close() return - - def on_AddSeparator_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomControls, Side = "left"): + + def on_AddSeparator_Clicked( + self, panel: RibbonPanel, ButtonWidget: CustomControls, Side="left" + ): # Get the workbench hame and the panel name workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) panelName = panel.objectName() @@ -1561,11 +1879,16 @@ def on_AddSeparator_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomContro if "workbenches" in Dict: if workbenchName in Dict["workbenches"]: if panelName in Dict["workbenches"][workbenchName]["toolbars"]: - if "order" in Dict["workbenches"][workbenchName]["toolbars"][panelName]: - OrderList: list = Dict["workbenches"][workbenchName]["toolbars"][panelName]["order"] - + if ( + "order" + in Dict["workbenches"][workbenchName]["toolbars"][panelName] + ): + OrderList: list = Dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["order"] + # if the orderlist is not empty, you may add a separator. - # An empty list, results in the separator at the start of the panel + # An empty list, results in the separator at the start of the panel if len(OrderList) > 0: index = None # Get the command name and its index in the list @@ -1574,27 +1897,42 @@ def on_AddSeparator_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomContro index = OrderList.index(CommandName) else: StandardFunctions.Mbox( - translate("FreeCAD Ribbon", "The command is not present in the Ribbon Layout.\n Close the customize enviroment to update the layout file and try again."), - "", - "Warning", + translate( + "FreeCAD Ribbon", + "The command is not present in the Ribbon Layout.\n Close the customize enviroment to update the layout file and try again.", + ), + "", + "Warning", ) - + # Add the separator either let or right if index is not None: - if Side == "left" : + if Side == "left": if index > 0: OrderList.insert(index, f"{index}_separator_{workbenchName}") else: - if index < len(OrderList)-1: - OrderList.insert(index+1, f"{index+1}_separator_{workbenchName}") - + if index < len(OrderList) - 1: + OrderList.insert( + index + 1, f"{index+1}_separator_{workbenchName}" + ) + # Set the orderlist in the dict and update the workbench dict - Dict["workbenches"][workbenchName]["toolbars"][panel.objectName()]["order"] = OrderList + Dict["workbenches"][workbenchName]["toolbars"][panel.objectName()][ + "order" + ] = OrderList self.workBenchDict.update(Dict) - + # Create a new panel workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - newPanel = self.CreatePanel(workbenchName, panel.objectName(), addPanel=False, dict=self.workBenchDict, ignoreColumnLimit=True, showEnableControl=True, enableSeparator=True) + newPanel = self.CreatePanel( + workbenchName, + panel.objectName(), + addPanel=False, + dict=self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + enableSeparator=True, + ) # Add the panel to the list with long panels self.longPanels.append(newPanel) @@ -1602,10 +1940,10 @@ def on_AddSeparator_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomContro self.currentCategory().replacePanel(panel, newPanel) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(newPanel) - + # Update the dict of the currentCategory with the new panel self.currentCategory()._panels[newPanel.objectName()] = newPanel - + # Enable all buttons, so you can access them with a right click for child in mw.findChildren(QToolButton): try: @@ -1615,15 +1953,17 @@ def on_AddSeparator_Clicked(self, panel: RibbonPanel, ButtonWidget: CustomContro except Exception: pass Gui.updateGui() - + # Close the old panel panel.close() - + # Close the context menu self.contextMenu.close() return - - def on_RemoveSeparator_Clicked(self, panel: RibbonPanel, separator: CustomSeparator): + + def on_RemoveSeparator_Clicked( + self, panel: RibbonPanel, separator: CustomSeparator + ): # Get the workbench hame and the panel name workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) panelName = panel.objectName() @@ -1635,30 +1975,45 @@ def on_RemoveSeparator_Clicked(self, panel: RibbonPanel, separator: CustomSepara if "workbenches" in Dict: if workbenchName in Dict["workbenches"]: if panelName in Dict["workbenches"][workbenchName]["toolbars"]: - if "order" in Dict["workbenches"][workbenchName]["toolbars"][panelName]: - OrderList: list = Dict["workbenches"][workbenchName]["toolbars"][panelName]["order"] - + if ( + "order" + in Dict["workbenches"][workbenchName]["toolbars"][panelName] + ): + OrderList: list = Dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["order"] + # if the orderlist is not empty, you can remove a separator. if len(OrderList) > 0: # Get the index of the separator and remove it from the list index = OrderList.index(separator.objectName()) OrderList.pop(index) - + # Set the orderlist in the dict and update the workbench dict - Dict["workbenches"][workbenchName]["toolbars"][panel.objectName()]["order"] = OrderList + Dict["workbenches"][workbenchName]["toolbars"][panel.objectName()][ + "order" + ] = OrderList self.workBenchDict.update(Dict) - + # Create a new panel workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - newPanel = self.CreatePanel(workbenchName, panel.objectName(), addPanel=False, dict=self.workBenchDict, ignoreColumnLimit=True, showEnableControl=True, enableSeparator=True) + newPanel = self.CreatePanel( + workbenchName, + panel.objectName(), + addPanel=False, + dict=self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + enableSeparator=True, + ) # Add the panel to the list with long panels self.longPanels.append(newPanel) - + # Replace the panel with the new panel self.currentCategory().replacePanel(panel, newPanel) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(newPanel) - + # Enable all buttons, so you can access them with a right click for child in mw.findChildren(QToolButton): try: @@ -1668,43 +2023,50 @@ def on_RemoveSeparator_Clicked(self, panel: RibbonPanel, separator: CustomSepara except Exception: pass Gui.updateGui() - + # Close the old panel panel.close() - + # Close the context menu self.contextMenu.close() - def on_ButtonLabel_Changing(self, event, panel: RibbonPanel, ButtonWidget: CustomControls, widgetAction: CustomWidgets.LineEditAction): + def on_ButtonLabel_Changing( + self, + event, + panel: RibbonPanel, + ButtonWidget: CustomControls, + widgetAction: CustomWidgets.LineEditAction, + ): widgetAction.setClearButtonEnabled(True) Text = event # If the text is empty, restore the original name if Text == "": CommandName = "" for child in ButtonWidget.children(): - if ( - type(child) is QToolButton - and child.objectName() == "CommandButton" - ): + if type(child) is QToolButton and child.objectName() == "CommandButton": CommandName = child.defaultAction().data() - Text = CommandInfoCorrections(CommandName)["menuText"].replace("&", "") + Text = CommandInfoCorrections(CommandName)["menuText"].replace( + "&", "" + ) widgetAction.setPlaceholderText(Text) - + # write the changes to the ribbonstructure file property = {"text": Text} self.WriteButtonSettings(ButtonWidget, panel, property) - + # Set the text also in the label widget LabelWidget: QLabel = ButtonWidget.findChild(QLabel) LabelWidget.setText(Text) return - def on_PanelTitle_Changing(self, event, panel: RibbonPanel, widgetAction: CustomWidgets.LineEditAction): + def on_PanelTitle_Changing( + self, event, panel: RibbonPanel, widgetAction: CustomWidgets.LineEditAction + ): # Get the workbench name and the panel name workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) panelName = panel.objectName() widgetAction.setClearButtonEnabled(True) - + Text = event # If the text is empty, restore the original name if Text == "": @@ -1712,11 +2074,17 @@ def on_PanelTitle_Changing(self, event, panel: RibbonPanel, widgetAction: Custom widgetAction.setPlaceholderText(Text) # Create an entry in the dict if there isn't one - Standard_Functions_Ribbon.add_keys_nested_dict(self.workBenchDict, ["workbenches", workbenchName, "toolbars", panelName, "title"]) - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName]["title"] = Text + Standard_Functions_Ribbon.add_keys_nested_dict( + self.workBenchDict, + ["workbenches", workbenchName, "toolbars", panelName, "title"], + ) + self.workBenchDict["workbenches"][workbenchName]["toolbars"][panelName][ + "title" + ] = Text # Set the panel title panel.setTitle(Text) return + # endregion # region - drag drop event functions @@ -1728,17 +2096,16 @@ def on_PanelTitle_Changing(self, event, panel: RibbonPanel, widgetAction: Custom spaceWidget_Left = RibbonToolButton() spaceWidget_Right = RibbonToolButton() target = None - - - def dragEnterEvent(self, event: QDragEnterEvent): - if self.CustomizeEnabled is True: + + def dragEnterEvent(self, event: QDragEnterEvent): + if self.CustomizeEnabled is True: widget = event.source() count = 0 parent = widget.parent() panel = RibbonPanel() - while (count < 20): + while count < 20: try: - try: + try: parent.setAcceptDrop(True) except Exception: pass @@ -1748,16 +2115,20 @@ def dragEnterEvent(self, event: QDragEnterEvent): count = count + 1 except Exception: break - + # Check if there are more than one buttons. If not there is no point to drag and exit - if len(panel.widgets()) <= 2 and type(widget) is not RibbonPanel and panel.findChild(QWidget, "ExtraSpacer") is not None: + if ( + len(panel.widgets()) <= 2 + and type(widget) is not RibbonPanel + and panel.findChild(QWidget, "ExtraSpacer") is not None + ): event.ignore() else: event.acceptProposedAction() event.setAccepted(True) event.accept() return - + def dragLeaveEvent(self, event: QDragLeaveEvent): if self.CustomizeEnabled is True: # Hide the drag indicator when you leave the drag area @@ -1765,14 +2136,14 @@ def dragLeaveEvent(self, event: QDragLeaveEvent): self.dragIndicator_Panels.close() # self.dragIndicator_QuickAccess.close() self.target = None - + def dragMoveEvent(self, event: QDragMoveEvent): if self.CustomizeEnabled is True: widget = event.source() # If the widget is not a panel, continue here if type(widget) is not RibbonPanel and type(widget) is not QToolBar: count = 0 - while (count < 10): + while count < 10: if type(widget) is CustomControls: break if type(widget) is QToolButton: @@ -1787,7 +2158,7 @@ def dragMoveEvent(self, event: QDragMoveEvent): QuickAccessToolBar = QToolBar() count = 0 parent = widget.parent() - while (count < 10): + while count < 10: if type(parent) is RibbonPanel: panel = parent break @@ -1802,33 +2173,44 @@ def dragMoveEvent(self, event: QDragMoveEvent): gridLayout: QGridLayout = panel._actionsLayout position = None # Find the correct location of the drop target, so we can move it there. - position: object= self.find_drop_location(event) + position: object = self.find_drop_location(event) if position is None: return # If the widget is a separator or the extra widget for large buttons, skip it - if type(position[3].children()[1]) is CustomSeparator or position[3].children()[1].objectName() == "ExtraSpacer": + if ( + type(position[3].children()[1]) is CustomSeparator + or position[3].children()[1].objectName() == "ExtraSpacer" + ): return # Inserting moves the item if its already in the layout. rowSpan = position[2] try: - widgetHoveredOver = gridLayout.itemAtPosition(position[0], position[1]).widget().findChild(CustomControls) + widgetHoveredOver = ( + gridLayout.itemAtPosition(position[0], position[1]) + .widget() + .findChild(CustomControls) + ) self.target = position try: button = widgetHoveredOver.actions()[0] self.target = [position[0], position[1], button.data()] except Exception: pass - + if position[0] == 0: self.dragIndicator_Buttons._orientation = "left" else: self.dragIndicator_Buttons._orientation = "top" # Add the drag indicator gridLayout.addWidget( - self.dragIndicator_Buttons, position[0], position[1], rowSpan, 1 + self.dragIndicator_Buttons, + position[0], + position[1], + rowSpan, + 1, ) - + # When you hide the source, the dragged widget disapears from the panel. # For now It is left in, to keep the panel at the same size. # e.source().hide() @@ -1836,10 +2218,15 @@ def dragMoveEvent(self, event: QDragMoveEvent): self.dragIndicator_Buttons.show() except Exception: pass - - if type(parent) is QToolBar and parent.objectName() == "quickAccessToolBar": + + if ( + type(parent) is QToolBar + and parent.objectName() == "quickAccessToolBar" + ): # Get the relative position of the cursor - buttonPos = QuickAccessToolBar.mapTo(QuickAccessToolBar ,event.pos()) + buttonPos = QuickAccessToolBar.mapTo( + QuickAccessToolBar, event.pos() + ) # Get the action button = QuickAccessToolBar.childAt(buttonPos) beforeAction = QuickAccessToolBar.actionAt(buttonPos) @@ -1847,32 +2234,33 @@ def dragMoveEvent(self, event: QDragMoveEvent): dragIndicator = self.dragIndicator_QuickAccess QuickAccessToolBar.insertWidget(beforeAction, dragIndicator) dragIndicator.show() - + if type(widget) is RibbonPanel: - position: object= self.find_drop_location(event) - try: - self.currentCategory().insertWidget(self.dragIndicator_Panels, position[0]) + position: object = self.find_drop_location(event) + try: + self.currentCategory().insertWidget( + self.dragIndicator_Panels, position[0] + ) self.dragIndicator_Panels.show() except Exception: - pass + pass event.acceptProposedAction() event.setAccepted(True) event.accept() return - - def dropEvent(self, event:QDropEvent, widget = None): + def dropEvent(self, event: QDropEvent, widget=None): # return # Get the widget if widget is None: widget = event.source() - + if type(widget) is not RibbonPanel: # Get the panel panel = RibbonPanel() count = 0 parent = widget.parent() - while (count < 10): + while count < 10: if type(parent) is RibbonPanel: panel = parent break @@ -1882,8 +2270,11 @@ def dropEvent(self, event:QDropEvent, widget = None): # Get tabBar parent = panel.parent() count = 0 - while (count < 10): - if type(parent) == RibbonNormalCategory or type(parent) == RibbonContextCategory: + while count < 10: + if ( + type(parent) == RibbonNormalCategory + or type(parent) == RibbonContextCategory + ): break else: parent = parent.parent() @@ -1894,35 +2285,39 @@ def dropEvent(self, event:QDropEvent, widget = None): self.dragIndicator_Buttons.hide() self.spaceWidget_Left.hide() self.spaceWidget_Right.hide() - + if isinstance(panel, RibbonPanel): replace = False - if not widget.geometry().contains(event.pos()): + if not widget.geometry().contains(event.pos()): # Get the coordinates of the drag location xPos_drag = self.target[0] yPos_drag = self.target[1] # Define the original widget OriginalItem = gridLayout.itemAtPosition(xPos_drag, yPos_drag) OriginalWidget = OriginalItem.widget().findChild(CustomControls) - + # Get the old position of the dragged widget n = 0 OldPos = [] for n in range(gridLayout.count()): - if gridLayout.itemAt(n).widget().findChild(CustomControls) == widget.parent().parent().findChild(CustomControls): + if gridLayout.itemAt(n).widget().findChild( + CustomControls + ) == widget.parent().parent().findChild(CustomControls): OldPos = gridLayout.getItemPosition(n) break - + # counter and old position is not empty, Swap the widgets - if n > -1 and len(OldPos) > 0 : + if n > -1 and len(OldPos) > 0: # Define the dragged widgets DraggedItem = gridLayout.itemAt(n) DraggedWidget = DraggedItem.widget().findChild(CustomControls) - # Get the workbench name and the panel name + # Get the workbench name and the panel name title = panel.objectName() - workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - + workbenchName = self.tabBar().tabData( + self.tabBar().currentIndex() + ) + # Get the order list, if there isn't one, create it StandardFunctions.add_keys_nested_dict( self.workBenchDict, @@ -1931,58 +2326,89 @@ def dropEvent(self, event:QDropEvent, widget = None): workbenchName, "toolbars", panel.objectName(), - "order" + "order", ], ) - OrderList = self.workBenchDict["workbenches"][workbenchName]["toolbars"][title]["order"] + OrderList = self.workBenchDict["workbenches"][workbenchName][ + "toolbars" + ][title]["order"] # if OrderList is None or len(OrderList) == 0: OrderList_Compare = [] for n in range(gridLayout.count()): - control = gridLayout.itemAt(n).widget().findChild(CustomControls) - separator = gridLayout.itemAt(n).widget().findChild(CustomSeparator) + control = ( + gridLayout.itemAt(n).widget().findChild(CustomControls) + ) + separator = ( + gridLayout.itemAt(n).widget().findChild(CustomSeparator) + ) if control is not None and type(control) is CustomControls: OrderList_Compare.append(control.actions().data()) - if separator is not None and type(separator) is CustomSeparator: + if ( + separator is not None + and type(separator) is CustomSeparator + ): OrderList_Compare.append(separator.objectName()) if OrderList != OrderList_Compare: OrderList = OrderList_Compare - + # Get the indexes of the widgets - index_originalWidget = OrderList.index(OriginalWidget.actions().data()) # This is the location were will be dropped - index_newWidget = OrderList.index(DraggedWidget.actions().data()) # This is the original location of the dragged widget + index_originalWidget = OrderList.index( + OriginalWidget.actions().data() + ) # This is the location were will be dropped + index_newWidget = OrderList.index( + DraggedWidget.actions().data() + ) # This is the original location of the dragged widget if replace is True: # Remove the command name of the original widget from the order list and # Add the command of the dragged widget in its place OrderList.pop(index_originalWidget) - OrderList.insert(index_originalWidget, DraggedWidget.actions().data()) + OrderList.insert( + index_originalWidget, DraggedWidget.actions().data() + ) # Remove the command name of the dragged widget from the order list and # Add the command of the original widget in its place OrderList.pop(index_newWidget) - OrderList.insert(index_newWidget, OriginalWidget.actions().data()) + OrderList.insert( + index_newWidget, OriginalWidget.actions().data() + ) else: # Remove the dragged item from the list OrderList.pop(index_newWidget) # Inserted it at the new location - OrderList.insert(index_originalWidget, DraggedWidget.actions().data()) - + OrderList.insert( + index_originalWidget, DraggedWidget.actions().data() + ) + # - self.workBenchDict["workbenches"][workbenchName]["toolbars"][panel.objectName()]["order"] = OrderList - + self.workBenchDict["workbenches"][workbenchName]["toolbars"][ + panel.objectName() + ]["order"] = OrderList + # Create a new panel - workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - newPanel = self.CreatePanel(workbenchName, panel.objectName(), addPanel=False, dict=self.workBenchDict, ignoreColumnLimit=True,showEnableControl=True, enableSeparator=True) - + workbenchName = self.tabBar().tabData( + self.tabBar().currentIndex() + ) + newPanel = self.CreatePanel( + workbenchName, + panel.objectName(), + addPanel=False, + dict=self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + enableSeparator=True, + ) + # Add the panel to the list with long panels self.longPanels.append(newPanel) - + # Replace the panel with the new panel self.currentCategory().replacePanel(panel, newPanel) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(newPanel) - + # Update the dict of the currentCategory with the new panel self.currentCategory()._panels[newPanel.objectName()] = newPanel - + # Close the old panel and the dragindicator panel.close() self.dragIndicator_Buttons.close() @@ -1992,13 +2418,20 @@ def dropEvent(self, event:QDropEvent, widget = None): position = self.find_drop_location(event) # Create a new panel workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - newPanel = self.CreatePanel(workbenchName, widget.objectName(), False, self.workBenchDict, ignoreColumnLimit=True, showEnableControl=True) + newPanel = self.CreatePanel( + workbenchName, + widget.objectName(), + False, + self.workBenchDict, + ignoreColumnLimit=True, + showEnableControl=True, + ) # Add the new panel - self.currentCategory().insertWidget(newPanel,position[0]) + self.currentCategory().insertWidget(newPanel, position[0]) # For some reason, the font of the panel title will be reset after replacing a panel, set its properties again. self.setPanelProperties(newPanel) - + # Update the dict of the currentCategory with the new panel panels = {} for title, panel in self.currentCategory().panels().items(): @@ -2008,12 +2441,14 @@ def dropEvent(self, event:QDropEvent, widget = None): else: panels[title] = panel self.currentCategory()._panels = panels - + # Close the current panel widget.close() # Create the current orderlist from the panels - OrderList:list = self.workBenchDict["workbenches"][workbenchName]["toolbars"]["order"] + OrderList: list = self.workBenchDict["workbenches"][workbenchName][ + "toolbars" + ]["order"] # if a panel is not in the orderlist, add it for title, panel in self.currentCategory().panels().items(): if panel.objectName() not in OrderList: @@ -2026,23 +2461,24 @@ def dropEvent(self, event:QDropEvent, widget = None): isInList = True if isInList is False: OrderList.remove(panelItem) - + # Add the widget in the new place of the order list OrderIndex = position[0] if widget.objectName() in OrderList: OrderList.remove(widget.objectName()) OrderList.insert(OrderIndex, widget.objectName()) - + # Update the workbench dict - self.workBenchDict["workbenches"][workbenchName]["toolbars"]["order"] = OrderList - + self.workBenchDict["workbenches"][workbenchName]["toolbars"][ + "order" + ] = OrderList + # Close the drag indicator self.dragIndicator_Panels.close() event.accept() return - def find_drop_location(self, event): """ Determines the drop location in a grid layout based on the position of a drag-and-drop event. @@ -2061,19 +2497,19 @@ def find_drop_location(self, event): """ # Get the position as a point - pos = event.pos() + pos = event.pos() # Get the widget widget = event.source() # Give the position an offset for a more natural drag - pos.setX(pos.x() - (widget.width()/2)) - pos.setY(pos.y() - (widget.height()/2)) - + pos.setX(pos.x() - (widget.width() / 2)) + pos.setY(pos.y() - (widget.height() / 2)) + if type(widget) is not RibbonPanel: # Get the panel panel = RibbonPanel() count = 0 parent = widget.parent() - while (count < 10): + while count < 10: if type(parent) is RibbonPanel: panel = parent break @@ -2092,7 +2528,7 @@ def find_drop_location(self, event): if item is not None: w = item.widget() if w is not None: - Widget_X = w.mapTo(self,w.pos()).x() + Widget_X = w.mapTo(self, w.pos()).x() if w.mapTo(panel, pos).x() < Widget_X: yPos = Column @@ -2105,7 +2541,7 @@ def find_drop_location(self, event): if item is not None: w = item.widget() if w is not None: - Widget_y = w.mapTo(self,w.pos()).y() + Widget_y = w.mapTo(self, w.pos()).y() if w.mapTo(panel, pos).y() < Widget_y: xPos = Row @@ -2120,21 +2556,22 @@ def find_drop_location(self, event): return [position[0], position[1], position[2], w_origin] except Exception: return None - + if type(widget) is RibbonPanel: layout = self.currentCategory()._categoryLayout for i in range(layout.count()): item = layout.itemAt(i) if item is not None: - w= item.widget() - Widget_X = w.mapTo(self,w.pos()).x() + w = item.widget() + Widget_X = w.mapTo(self, w.pos()).x() # Widget_X = Widget_X + w.width() * 0.5 - + if w.mapTo(self.currentCategory(), pos).x() < Widget_X: - return [i, Widget_X] + return [i, Widget_X] return None + # endregion - + # region - standard class functions # # implementation to add actions to the Filemenu. Needed for the accessories menu @@ -2168,11 +2605,16 @@ def onUserChangedWorkbench(self, tabActivated=True): """ if len(self.LastCustomized) > 0: category = self.categories()[self.LastCustomized[1]] - if self.CustomizeEnabled is True and self.currentCategory() != category: + if self.CustomizeEnabled is True and self.currentCategory() != category: self.setCurrentCategory(category) - StandardFunctions.Mbox(translate("FreeCAD Ribbon", "Close customize enviroment first!"), "", 0, "Warning") + StandardFunctions.Mbox( + translate("FreeCAD Ribbon", "Close customize enviroment first!"), + "", + 0, + "Warning", + ) return - + if len(mw.findChildren(QDockWidget, "Ribbon")) > 0: if Parameters_Ribbon.AUTOHIDE_RIBBON is False: self.UnfoldRibbon() @@ -2190,8 +2632,8 @@ def onUserChangedWorkbench(self, tabActivated=True): if tabActivated is True: self.onWbActivated() - self.ApplicationMenus() - + self.ApplicationMenus() + # hide normal toolbars self.hideClassicToolbars() @@ -2218,9 +2660,9 @@ def onWbActivated(self): + ";color: " + StyleMapping_Ribbon.ReturnStyleItem("Background_Color", True, True) + ";min-width: " - + str(self.TabBar_Size-3) + + str(self.TabBar_Size - 3) + "px;max-width: " - + str(self.TabBar_Size-3) + + str(self.TabBar_Size - 3) + "px;" + "padding-left: 6px;" + "padding-right: 3px;" @@ -2256,7 +2698,7 @@ def onWbActivated(self): # create panels. Do this after updateCurrentTab. # Otherwise, the sketcher workbench won;t be loaded properly the first time self.buildPanels() - + # hide normal toolbars self.hideClassicToolbars() @@ -2431,7 +2873,7 @@ def createModernMenu(self): self.setQuickAccessButtonHeight(self.RibbonMinimalHeight) button.setContentsMargins(3, 3, 3, 3) - + # Add dragdrop functionality def mouseMoveEvent(self, e): if e.buttons() == Qt.MouseButton.LeftButton: @@ -2446,7 +2888,7 @@ def mouseMoveEvent(self, e): drag.exec_(Qt.DropAction.MoveAction) except Exception as e: print(e) - + button.mouseMoveEvent = lambda e: mouseMoveEvent(button, e) # Add the button to the quickaccess toolbar @@ -2488,7 +2930,7 @@ def mouseMoveEvent(self, e): self.tabBar().setStyleSheet( "margin: 0px;padding: 0px;height: " + str(self.TabBar_Size) + ";" ) - + # Correct colors when no stylesheet is selected for FreeCAD. self.quickAccessToolBar().setStyleSheet("") if Parameters_Ribbon.BUTTON_BACKGROUND_ENABLED is True: @@ -2556,7 +2998,7 @@ def mouseMoveEvent(self, e): category = self.addCategory(name) category.setObjectName(workbenchName) # category.setAcceptDrops(True) - + # # Add a drag function to the category # def mouseMoveEvent(self, e): # if e.buttons() == Qt.MouseButton.LeftButton: @@ -2571,7 +3013,7 @@ def mouseMoveEvent(self, e): # drag.exec(Qt.DropAction.MoveAction) # except Exception as e: # print(e) - + # category.mouseMoveEvent = lambda e: mouseMoveEvent(category, e) # Set the tabbar according the style setting @@ -2849,8 +3291,9 @@ def mouseMoveEvent(self, e): self.rightToolBar().insertWidget(BeforeAction, BetaLabel) switch = Toggle(self) switch.setObjectName("bétaSwitch") - toolTipText = (translate("FreeCAD Ribbon", - """ + toolTipText = translate( + "FreeCAD Ribbon", + """ Enables the following experimental functions: - a new customisation enviroment. With this enviroment activated, the following customizations can be done per button: - Enable or disable text. @@ -2864,12 +3307,12 @@ def mouseMoveEvent(self, e): - Add and remove separators. - Reorder panels by dragging. - Change the title of a panel. - + To start the customisation enviroment, right click on the ribbon (outside the buttons) and click customize. The customization enviroment is enabled and with a right click on a button, its properties can be changed. Right click on the ribbon agian to save and exit the customisation enviroment. - """ - )) + """, + ) switch.setToolTip(toolTipText) BetaLabel.setToolTip(toolTipText) switch.setMaximumHeight(self.RightToolBarButtonSize) @@ -2901,13 +3344,13 @@ def mouseMoveEvent(self, e): self.rightToolBar().setSizeIncrement(1, 1) # Set the objectName for the right toolbar. needed for excluding from hiding. self.rightToolBar().setObjectName("rightToolBar") - + # Store the pinbutton globally self.pinButton = pinButton return # Add the searchBar if it is present - def AddSearchBar(self): + def AddSearchBar(self): TB: QToolBar = mw.findChildren(QToolBar, "SearchBar") width = 10 if TB is not None: @@ -3254,7 +3697,7 @@ def CreateMenus(self): translate("FreeCAD Ribbon", "Ribbon UI preferences") + " ...", self ) RibbonMenu.setToolTipsVisible(True) - + # Add the ribbon design button DesignButton = RibbonMenu.addAction( translate("FreeCAD Ribbon", "Ribbon layout") @@ -3275,7 +3718,7 @@ def CreateMenus(self): if ShortcutKey != "" and ShortcutKey is not None: DesignButton.setShortcut(ShortcutKey) self.LayoutMenuShortCut = ShortcutKey - + # Add the preference button PreferenceButton = RibbonMenu.addAction( translate("FreeCAD Ribbon", "Preferences") @@ -3296,21 +3739,31 @@ def CreateMenus(self): pass if ShortcutKey != "" and ShortcutKey is not None: PreferenceButton.setShortcut(ShortcutKey) - + # Add the repair menu RepairMenu: QMenu = RibbonMenu.addMenu( translate("FreeCAD Ribbon", "Repair functions...") ) - UpdateRibbonStructure = RepairMenu.addAction(translate("FreeCAD Ribbon", "Repair the Ribbon layout file")) - UpdateRibbonStructure.triggered.connect(lambda: self.ConvertRibbonStructure(False)) - RestoreLayout = RepairMenu.addAction(translate("FreeCAD Ribbon", "Restore a Ribbon layout")) + UpdateRibbonStructure = RepairMenu.addAction( + translate("FreeCAD Ribbon", "Repair the Ribbon layout file") + ) + UpdateRibbonStructure.triggered.connect( + lambda: self.ConvertRibbonStructure(False) + ) + RestoreLayout = RepairMenu.addAction( + translate("FreeCAD Ribbon", "Restore a Ribbon layout") + ) RestoreLayout.triggered.connect(self.RestoreJson) - OpenBackupFolder = RepairMenu.addAction(translate("FreeCAD Ribbon", "Open the backup directory")) + OpenBackupFolder = RepairMenu.addAction( + translate("FreeCAD Ribbon", "Open the backup directory") + ) # If the backup folder doesn't exists, create it if os.path.exists(Parameters_Ribbon.BACKUP_LOCATION) is False: os.makedirs(Parameters_Ribbon.BACKUP_LOCATION) - OpenBackupFolder.triggered.connect(lambda: StandardFunctions.OpenDirectory(Parameters_Ribbon.BACKUP_LOCATION)) - + OpenBackupFolder.triggered.connect( + lambda: StandardFunctions.OpenDirectory(Parameters_Ribbon.BACKUP_LOCATION) + ) + # Add the script submenu with items ScriptDir = os.path.join(os.path.dirname(__file__), "Scripts") if os.path.exists(ScriptDir) is True: @@ -3487,12 +3940,14 @@ def buildPanels(self): ListToolbars.append(customPanel) # remove the original toolbars from the list - Commands = self.customToolbars[workbenchName][ - customPanel - ]["commands"] + Commands = self.customToolbars[workbenchName][customPanel][ + "commands" + ] for Command in Commands: try: - OriginalToolbar = self.customToolbars[workbenchName][customPanel]["commands"][Command] + OriginalToolbar = self.customToolbars[workbenchName][ + customPanel + ]["commands"][Command] # ignore cases to prevent issues with different versions of FreeCAD for item in ListToolbars: @@ -3538,13 +3993,12 @@ def SortToolbars(toolbar): else: position = 0 return position - + ListToolbars.sort(key=SortToolbars) except Exception: pass - - # If the toolbar must be ignored, skip it + # If the toolbar must be ignored, skip it for toolbar in ListToolbars: Skip = False for ToolbarToIgnore in self.ignoredToolbars: @@ -3554,16 +4008,28 @@ def SortToolbars(toolbar): continue if toolbar in self.currentCategory().panels().keys(): continue - + # Create the panel based on the toolbars - panel = self.CreatePanel(workbenchName, toolbar, True, self.ribbonStructure, True) + panel = self.CreatePanel( + workbenchName, toolbar, True, self.ribbonStructure, True + ) # Hide the panel if stated in the ribbon structure - if panel.objectName() in self.ribbonStructure["workbenches"][workbenchName]["toolbars"]: - if "Enabled" in self.ribbonStructure["workbenches"][workbenchName]["toolbars"][panel.objectName()]: - Enabled = self.ribbonStructure["workbenches"][workbenchName]["toolbars"][panel.objectName()]["Enabled"] + if ( + panel.objectName() + in self.ribbonStructure["workbenches"][workbenchName]["toolbars"] + ): + if ( + "Enabled" + in self.ribbonStructure["workbenches"][workbenchName]["toolbars"][ + panel.objectName() + ] + ): + Enabled = self.ribbonStructure["workbenches"][workbenchName][ + "toolbars" + ][panel.objectName()]["Enabled"] if Enabled is False: panel.hide() - + # Writing to ribbonStructure.json JsonFile = Parameters_Ribbon.RIBBON_STRUCTURE_JSON with open(JsonFile, "w") as outfile: @@ -3621,12 +4087,8 @@ def SortToolbars(toolbar): ) # Set the maximum height to a high value to prevent from the ribbon to be clipped off - category.setMinimumHeight( - self.RibbonHeight - self.RibbonMinimalHeight - 3 - ) - category.setMaximumHeight( - self.RibbonHeight - self.RibbonMinimalHeight - 3 - ) + category.setMinimumHeight(self.RibbonHeight - self.RibbonMinimalHeight - 3) + category.setMaximumHeight(self.RibbonHeight - self.RibbonMinimalHeight - 3) self.setRibbonHeight(self.RibbonHeight) if self.DesignMenuLoaded is True: @@ -3635,13 +4097,13 @@ def SortToolbars(toolbar): self.quickAccessToolBar().setDisabled(True) self.applicationOptionButton().setDisabled(True) Gui.updateGui() - + # Add a pinbutton to the current tab in the right bottom corner layout: QGridLayout = self.currentCategory()._mainLayout - if Parameters_Ribbon.USE_FC_OVERLAY is False: + if Parameters_Ribbon.USE_FC_OVERLAY is False: btn = QToolButton() # btn.setIcon(self.pinButton.icon()) - btn.setFixedSize(QSize(self.iconSize * 0.8,self.iconSize * 0.8)) + btn.setFixedSize(QSize(self.iconSize * 0.8, self.iconSize * 0.8)) btn.setObjectName("pinButton") btn.setCheckable(True) btn.setChecked(not Parameters_Ribbon.AUTOHIDE_RIBBON) @@ -3650,15 +4112,29 @@ def SortToolbars(toolbar): else: btn.setIcon(StyleMapping_Ribbon.ReturnStyleItem("PinButton_closed")) btn.clicked.connect(lambda: self.on_Pin_clicked(btn)) - layout.addWidget(btn, 2,3,1,1, Qt.AlignmentFlag.AlignRight|Qt.AlignmentFlag.AlignBottom) + layout.addWidget( + btn, + 2, + 3, + 1, + 1, + Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignBottom, + ) # Add the pinButton to a list with all pinbuttons. Needed to set all pin buttons to the same state self.pinButtonList.append(btn) - # If freecads overlay functions are enabled, add a spacer instead. + # If freecads overlay functions are enabled, add a spacer instead. # This prevents the scroll buttons from beeing placed at the bottom - if Parameters_Ribbon.USE_FC_OVERLAY is True: + if Parameters_Ribbon.USE_FC_OVERLAY is True: spacer = QWidget() spacer.setDisabled(True) - layout.addWidget(spacer, 2,3,1,1, Qt.AlignmentFlag.AlignRight|Qt.AlignmentFlag.AlignBottom) + layout.addWidget( + spacer, + 2, + 3, + 1, + 1, + Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignBottom, + ) return # endregion @@ -3671,7 +4147,7 @@ def on_AboutButton_clicked(self): def on_Help_clicked(self): self.helpRibbonButton().showMenu() - def on_RibbonHelpButton_clicked(self): + def on_RibbonHelpButton_clicked(self): if self.HelpAdress != "" or self.HelpAdress is not None: if not self.HelpAdress.endswith("/"): self.HelpAdress = self.HelpAdress + "/" @@ -3738,7 +4214,7 @@ def on_ToggleBetaFunctions_toggled(self, switchStatus): Parameters_Ribbon.Settings.SetBoolSetting("BetaFunctions", True) # print a message print(translate("FreeCAD Ribbon", "Ribbon UI: Béta functions enabled")) - + # Create a backup # # get the path for the Json file @@ -3859,9 +4335,7 @@ def List_AddCustomToolBarToWorkbench(self, workbenchName, CustomToolbar): if workbenchName in self.customToolbars: for toolbar in self.customToolbars[workbenchName]: if CustomToolbar.lower() == toolbar.lower(): - Commands = self.customToolbars[workbenchName][ - toolbar - ]["commands"] + Commands = self.customToolbars[workbenchName][toolbar]["commands"] # Create a QToolButton from the key and add it to the button list allButtons: list = [] @@ -3892,18 +4366,14 @@ def List_AddCustomToolBarToWorkbench(self, workbenchName, CustomToolbar): Command = Gui.Command.get(key) if Command is not None: Icon = Gui.getIcon( - CommandInfoCorrections(key)[ - "pixmap" - ] + CommandInfoCorrections(key)["pixmap"] ) action = Command.getAction() - Button = QToolButton() + Button = QToolButton() Button.addActions(action) Button.setDefaultAction(action[0]) Button.setIcon(Icon) - Button.setText(CommandInfoCorrections(key)[ - "menuText" - ]) + Button.setText(CommandInfoCorrections(key)["menuText"]) try: if len(action) > 1: Icon = action[0].icon() @@ -3930,9 +4400,7 @@ def List_AddNewPanelToWorkbench(self, WorkBenchName, NewPanel): if WorkBenchName in self.newPanels: if NewPanel in self.newPanels[WorkBenchName]: # Get the commands from the custom panel - Commands = self.newPanels[WorkBenchName][ - NewPanel - ] + Commands = self.newPanels[WorkBenchName][NewPanel] # Get the command and its original toolbar for CommandItem in Commands: @@ -4071,18 +4539,18 @@ def LoadMarcoFreeCAD(self, scriptName): def ReturnRibbonHeight(self, offset=0): # Get the name of the current workbench workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) - + # Set the ribbon height. ribbonHeight = 0 - + # If text is enabled for large button, the height is modified. LargeButtonHeight = Parameters_Ribbon.ICON_SIZE_LARGE - + # Check whichs is has the most height: 3 small buttons, 2 medium buttons or 1 large button # and set the height accordingly # # If there are small, medium and large buttons - if self.MaxRowsPerWB[workbenchName]["Rows"] == 3: + if self.MaxRowsPerWB[workbenchName]["Rows"] == 3: if ( Parameters_Ribbon.ICON_SIZE_SMALL * 3 >= Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 @@ -4090,26 +4558,37 @@ def ReturnRibbonHeight(self, offset=0): ): ribbonHeight = Parameters_Ribbon.ICON_SIZE_SMALL * 3 + 6 if ( - (Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 + Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 > Parameters_Ribbon.ICON_SIZE_SMALL * 3 - and Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 > LargeButtonHeight) + and Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 > LargeButtonHeight ): ribbonHeight = Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 + 4 if ( - Parameters_Ribbon.ICON_SIZE_LARGE > Parameters_Ribbon.ICON_SIZE_SMALL * 3 - and Parameters_Ribbon.ICON_SIZE_LARGE > Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 + Parameters_Ribbon.ICON_SIZE_LARGE + > Parameters_Ribbon.ICON_SIZE_SMALL * 3 + and Parameters_Ribbon.ICON_SIZE_LARGE + > Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 ): ribbonHeight = LargeButtonHeight - + # If there only medium or large buttons if self.MaxRowsPerWB[workbenchName]["LargeButtonsPresent"] is True: - if self.MaxRowsPerWB[workbenchName]["Rows"] == 2 and Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 < LargeButtonHeight: + if ( + self.MaxRowsPerWB[workbenchName]["Rows"] == 2 + and Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 < LargeButtonHeight + ): ribbonHeight = LargeButtonHeight - if self.MaxRowsPerWB[workbenchName]["Rows"] == 2 and Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 >= LargeButtonHeight: + if ( + self.MaxRowsPerWB[workbenchName]["Rows"] == 2 + and Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 >= LargeButtonHeight + ): ribbonHeight = Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 + 4 - if self.MaxRowsPerWB[workbenchName]["LargeButtonsPresent"] is False and self.MaxRowsPerWB[workbenchName]["Rows"] == 2: + if ( + self.MaxRowsPerWB[workbenchName]["LargeButtonsPresent"] is False + and self.MaxRowsPerWB[workbenchName]["Rows"] == 2 + ): ribbonHeight = Parameters_Ribbon.ICON_SIZE_MEDIUM * 2 + 4 - + # If there are only large buttons if self.MaxRowsPerWB[workbenchName]["Rows"] == 1: ribbonHeight = LargeButtonHeight @@ -4491,53 +4970,69 @@ def returnCustomDropDown(self, CommandName): def CheckLanguage(self): FreeCAD_preferences = App.ParamGet("User parameter:BaseApp/Preferences/General") if "language" in self.ribbonStructure: - if self.ribbonStructure["language"] != FreeCAD_preferences.GetString( - "Language") and FreeCAD_preferences.GetString( - "Language") != "": + if ( + self.ribbonStructure["language"] + != FreeCAD_preferences.GetString("Language") + and FreeCAD_preferences.GetString("Language") != "" + ): if "workbenches" in self.ribbonStructure: for workbenchName in self.ribbonStructure["workbenches"]: - if "toolbars" in self.ribbonStructure["workbenches"][workbenchName]: + if ( + "toolbars" + in self.ribbonStructure["workbenches"][workbenchName] + ): for ToolBar in self.ribbonStructure["workbenches"][ workbenchName ]["toolbars"]: if ( "commands" - in self.ribbonStructure["workbenches"][workbenchName][ - "toolbars" - ][ToolBar] + in self.ribbonStructure["workbenches"][ + workbenchName + ]["toolbars"][ToolBar] ): for Command in self.ribbonStructure["workbenches"][ workbenchName ]["toolbars"][ToolBar]["commands"]: - self.ribbonStructure["workbenches"][workbenchName][ - "toolbars" - ][ToolBar]["commands"][Command]["text"] = "" + self.ribbonStructure["workbenches"][ + workbenchName + ]["toolbars"][ToolBar]["commands"][Command][ + "text" + ] = "" - print("Ribbon UI: Custom text are reset because the language was changed") + print( + "Ribbon UI: Custom text are reset because the language was changed" + ) return - - def WriteButtonSettings(self, ButtonWidget, panel, property: dict = {"size": "small",}): + + def WriteButtonSettings( + self, + ButtonWidget, + panel, + property: dict = { + "size": "small", + }, + ): # Get tabBar parent = panel.parent() count = 0 - while (count < 10): - if type(parent) == RibbonNormalCategory or type(parent) == RibbonContextCategory: + while count < 10: + if ( + type(parent) == RibbonNormalCategory + or type(parent) == RibbonContextCategory + ): break else: parent = parent.parent() - # Get the workbench name + # Get the workbench name WorkBenchName = parent.objectName() # Get the current data from the ribbonstructure CommandName = "" for child in ButtonWidget.children(): - if ( - type(child) == QToolButton - and child.objectName() == "CommandButton" - ): + if type(child) == QToolButton and child.objectName() == "CommandButton": CommandName = child.defaultAction().data() - if CommandName != "": + if CommandName != "": for key, value in property.items(): StandardFunctions.add_keys_nested_dict( self.workBenchDict, @@ -4551,11 +5046,15 @@ def WriteButtonSettings(self, ButtonWidget, panel, property: dict = {"size": "sm key, ], ) - self.workBenchDict["workbenches"][WorkBenchName]["toolbars"][panel.objectName()]["commands"][CommandName][key] = value - + self.workBenchDict["workbenches"][WorkBenchName]["toolbars"][ + panel.objectName() + ]["commands"][CommandName][key] = value + return - - def ReturnPanelTitle(self, panel: RibbonPanel, dict = ribbonStructure, filterOnly = False): + + def ReturnPanelTitle( + self, panel: RibbonPanel, dict=ribbonStructure, filterOnly=False + ): workbenchName = self.tabBar().tabData(self.tabBar().currentIndex()) panelName = panel.objectName() # Get the workbenchTitle @@ -4567,15 +5066,27 @@ def ReturnPanelTitle(self, panel: RibbonPanel, dict = ribbonStructure, filterOnl break workbenchTitle = self.tabBar().tabText(index) title = StandardFunctions.TranslationsMapping(workbenchName, panelName) - + if filterOnly is False: if "workbenches" in dict: if workbenchName in dict["workbenches"]: if "toolbars" in dict["workbenches"][workbenchName]: if panelName in dict["workbenches"][workbenchName]["toolbars"]: - if "title" in dict["workbenches"][workbenchName]["toolbars"][panelName]: - if dict["workbenches"][workbenchName]["toolbars"][panelName]["title"] != "": - return dict["workbenches"][workbenchName]["toolbars"][panelName]["title"] + if ( + "title" + in dict["workbenches"][workbenchName]["toolbars"][ + panelName + ] + ): + if ( + dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["title"] + != "" + ): + return dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["title"] # Change the name of the view panels to "View" if ( title in "Views - Ribbon_newPanel" @@ -4594,14 +5105,14 @@ def ReturnPanelTitle(self, panel: RibbonPanel, dict = ribbonStructure, filterOnl workbenchTitle, workbenchTitle.replace(" ", ""), ] - for Name in List: + for Name in List: ListDelimiters = [" - ", "-", "_"] for delimiter in ListDelimiters: if f"{delimiter}{Name}" in title: title = title.replace(f"{delimiter}{Name}", "") elif f"{Name}{delimiter}" in title: title = title.replace(f"{Name}{delimiter}", "") - if Name in title and Name != title: + if Name in title and Name != title: title = title.replace(Name, "") # remove any suffix from the panel title if title.endswith("_custom"): @@ -4610,16 +5121,28 @@ def ReturnPanelTitle(self, panel: RibbonPanel, dict = ribbonStructure, filterOnl title = title.replace("_global", "") if title.endswith("_newPanel"): title = title.replace("_newPanel", "") - + # remove spaces from start and end title = title.lstrip().rstrip() return title - - def CreatePanel(self, workbenchName: str, panelName: str, addPanel = True, dict = ribbonStructure, SetToUpdate = False, ignoreColumnLimit = False, showEnableControl = False, enableSeparator = False): + + def CreatePanel( + self, + workbenchName: str, + panelName: str, + addPanel=True, + dict=ribbonStructure, + SetToUpdate=False, + ignoreColumnLimit=False, + showEnableControl=False, + enableSeparator=False, + ): if SetToUpdate is True: dict = self.ribbonStructure - Standard_Functions_Ribbon.add_keys_nested_dict(dict, ["workbenches", workbenchName, "toolbars"], 1, True) - + Standard_Functions_Ribbon.add_keys_nested_dict( + dict, ["workbenches", workbenchName, "toolbars"], 1, True + ) + # Create the panel, use the toolbar name as title title = StandardFunctions.TranslationsMapping(workbenchName, panelName) panel = RibbonPanel(title=title, showPanelOptionButton=True) @@ -4631,7 +5154,7 @@ def CreatePanel(self, workbenchName: str, panelName: str, addPanel = True, dict panel.setObjectName(panelName) panel.panelOptionButton().hide() panel.setAcceptDrops(True) - + # Add a drag function to the panel def mouseMoveEvent(self, e, customizeEnabled: bool): if e.buttons() == Qt.MouseButton.LeftButton and customizeEnabled is True: @@ -4646,12 +5169,15 @@ def mouseMoveEvent(self, e, customizeEnabled: bool): drag.exec(Qt.DropAction.MoveAction) except Exception as e: print(e) - + panel.mouseMoveEvent = lambda e: mouseMoveEvent(panel, e, self.CustomizeEnabled) - + # get list of all buttons in toolbar allButtons: list = [] - if panelName.endswith("_newPanel") is False and panelName.endswith("_custom") is False: + if ( + panelName.endswith("_newPanel") is False + and panelName.endswith("_custom") is False + ): try: TB = mw.findChildren(QToolBar, panelName) allButtons = TB[0].findChildren(QToolButton) @@ -4662,7 +5188,7 @@ def mouseMoveEvent(self, e, customizeEnabled: bool): allButtons.pop(i) except Exception: pass - + # Add custom panels if panelName.endswith("_custom"): customList = self.List_AddCustomToolBarToWorkbench(workbenchName, panelName) @@ -4675,7 +5201,7 @@ def mouseMoveEvent(self, e, customizeEnabled: bool): # Add new global Panels NewPanelList = self.List_AddNewPanelToWorkbench("Global", panelName) allButtons.extend(NewPanelList) - + # Set the objectname to the default action of all buttons for button in allButtons: try: @@ -4691,46 +5217,43 @@ def mouseMoveEvent(self, e, customizeEnabled: bool): action.setObjectName(action.data()) except Exception: pass - + # add separators to the command list. if workbenchName in dict["workbenches"]: if ( panelName != "" and "toolbars" in dict["workbenches"][workbenchName] - and panelName - in dict["workbenches"][workbenchName]["toolbars"] + and panelName in dict["workbenches"][workbenchName]["toolbars"] ): - for orderedToolbar in dict["workbenches"][ - workbenchName - ]["toolbars"]: + for orderedToolbar in dict["workbenches"][workbenchName]["toolbars"]: if orderedToolbar.lower() == panelName.lower(): if ( "order" - in dict["workbenches"][workbenchName][ - "toolbars" - ][panelName] - ) and type(dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["order"]) is list: + in dict["workbenches"][workbenchName]["toolbars"][panelName] + ) and type( + dict["workbenches"][workbenchName]["toolbars"][panelName][ + "order" + ] + ) is list: for j in range( len( - dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["order"] + dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["order"] ) ): try: if ( "separator" - in dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["order"][j].lower() + in dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["order"][j].lower() ): separator = QToolButton() separator.setText( - dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["order"][j] + dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["order"][j] ) separator.setObjectName(separator.text()) allButtons.insert(j, separator) @@ -4740,28 +5263,24 @@ def mouseMoveEvent(self, e, customizeEnabled: bool): if workbenchName in dict["workbenches"]: # order buttons like defined in ribbonStructure if ( - panelName - in dict["workbenches"][workbenchName]["toolbars"] - and "order" - in dict["workbenches"][workbenchName]["toolbars"][ - panelName - ] + panelName in dict["workbenches"][workbenchName]["toolbars"] + and "order" in dict["workbenches"][workbenchName]["toolbars"][panelName] ): - OrderList: list = dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["order"] + OrderList: list = dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["order"] # XXX check that positionsList consists of strings only def sortButtons(button: QToolButton): # Use the text from the button Text = button.text() versionCheck = StandardFunctions.checkFreeCADVersion( - Parameters_Ribbon.FreeCAD_Version["mainVersion"], - Parameters_Ribbon.FreeCAD_Version["subVersion"], - Parameters_Ribbon.FreeCAD_Version["patchVersion"], - Parameters_Ribbon.FreeCAD_Version["gitVersion"], - ) - if (versionCheck is True): + Parameters_Ribbon.FreeCAD_Version["mainVersion"], + Parameters_Ribbon.FreeCAD_Version["subVersion"], + Parameters_Ribbon.FreeCAD_Version["patchVersion"], + Parameters_Ribbon.FreeCAD_Version["gitVersion"], + ) + if versionCheck is True: # if it is not a custom button or separator, update the Text if not "ddb" in Text and not "separator" in Text: if ( @@ -4805,14 +5324,14 @@ def sortButtons(button: QToolButton): # Go through the button list: for i in range(len(allButtons)): button = allButtons[i] - + # count the number of buttons per type. Needed for proper sorting the buttons later. buttonSize = "small" try: action = button.defaultAction() - buttonSize = dict["workbenches"][workbenchName][ - "toolbars" - ][panelName]["commands"][action.data()]["size"] + buttonSize = dict["workbenches"][workbenchName]["toolbars"][panelName][ + "commands" + ][action.data()]["size"] if buttonSize == "small": NoSmallButtons_spacer += 1 if buttonSize == "medium": @@ -4824,10 +5343,18 @@ def sortButtons(button: QToolButton): # # get the number of rows in the panel and store the maximum number of rows per wb. if workbenchName not in self.MaxRowsPerWB: - Standard_Functions_Ribbon.add_keys_nested_dict(self.MaxRowsPerWB, [workbenchName, "Rows"]) - Standard_Functions_Ribbon.add_keys_nested_dict(self.MaxRowsPerWB, [workbenchName, "SmallButtonsPresent"]) - Standard_Functions_Ribbon.add_keys_nested_dict(self.MaxRowsPerWB, [workbenchName, "MediumButtonsPresent"]) - Standard_Functions_Ribbon.add_keys_nested_dict(self.MaxRowsPerWB, [workbenchName, "LargeButtonsPresent"]) + Standard_Functions_Ribbon.add_keys_nested_dict( + self.MaxRowsPerWB, [workbenchName, "Rows"] + ) + Standard_Functions_Ribbon.add_keys_nested_dict( + self.MaxRowsPerWB, [workbenchName, "SmallButtonsPresent"] + ) + Standard_Functions_Ribbon.add_keys_nested_dict( + self.MaxRowsPerWB, [workbenchName, "MediumButtonsPresent"] + ) + Standard_Functions_Ribbon.add_keys_nested_dict( + self.MaxRowsPerWB, [workbenchName, "LargeButtonsPresent"] + ) self.MaxRowsPerWB[workbenchName]["Rows"] = 0 self.MaxRowsPerWB[workbenchName]["SmallButtonsPresent"] = False self.MaxRowsPerWB[workbenchName]["MediumButtonsPresent"] = False @@ -4843,7 +5370,7 @@ def sortButtons(button: QToolButton): self.MaxRowsPerWB[workbenchName]["Rows"] = 3 # Save that small buttons are present self.MaxRowsPerWB[workbenchName]["SmallButtonsPresent"] = True - if buttonSize == "medium": + if buttonSize == "medium": smallButtons.clear() mediumButtons.append(button) largeButtons.clear() @@ -4851,11 +5378,11 @@ def sortButtons(button: QToolButton): columnCount = columnCount + 1 mediumButtons.clear() # Store the number of rows for this workbench - if self.MaxRowsPerWB[workbenchName]["Rows"] <= 2: - self.MaxRowsPerWB[workbenchName]["Rows"] = 2 + if self.MaxRowsPerWB[workbenchName]["Rows"] <= 2: + self.MaxRowsPerWB[workbenchName]["Rows"] = 2 # Save that medium buttons are present self.MaxRowsPerWB[workbenchName]["MediumButtonsPresent"] = True - if buttonSize == "large" or "separator" in button.text().lower(): + if buttonSize == "large" or "separator" in button.text().lower(): smallButtons.clear() mediumButtons.clear() largeButtons.append(button) @@ -4863,8 +5390,8 @@ def sortButtons(button: QToolButton): columnCount = columnCount + 1 largeButtons.clear() # Store the number of rows for this workbench - if self.MaxRowsPerWB[workbenchName]["Rows"] <= 1: - self.MaxRowsPerWB[workbenchName]["Rows"] = 1 + if self.MaxRowsPerWB[workbenchName]["Rows"] <= 1: + self.MaxRowsPerWB[workbenchName]["Rows"] = 1 # Save that large buttons are present self.MaxRowsPerWB[workbenchName]["LargeButtonsPresent"] = True @@ -4883,9 +5410,9 @@ def sortButtons(button: QToolButton): continue if columnCount > maxColumns and "separator" not in button.text(): if ( - (buttonSize == "small" and len(smallButtons) == 0) or - (buttonSize == "medium" and len(mediumButtons) == 0) or - (buttonSize == "large" and len(largeButtons) == 0) + (buttonSize == "small" and len(smallButtons) == 0) + or (buttonSize == "medium" and len(mediumButtons) == 0) + or (buttonSize == "large" and len(largeButtons) == 0) ): ButtonList.append(button) panel.panelOptionButton().show() @@ -4896,7 +5423,12 @@ def sortButtons(button: QToolButton): if "separator" in button.text() and i < len(allButtons): separatorWidget = CustomWidgets.CustomSeparator() rowSpan = 6 - separator = panel.addWidget(separatorWidget, rowSpan=rowSpan, fixedHeight=False, alignment=Qt.AlignmentFlag.AlignCenter) + separator = panel.addWidget( + separatorWidget, + rowSpan=rowSpan, + fixedHeight=False, + alignment=Qt.AlignmentFlag.AlignCenter, + ) separator.setObjectName(button.text()) separator.setDisabled(not enableSeparator) if enableSeparator is True: @@ -4905,7 +5437,7 @@ def sortButtons(button: QToolButton): "RibbonSeparator:hover {background: " + StyleMapping_Ribbon.ReturnStyleItem("Background_Color_Hover") + ";}" - ) + ) # there is a bug in pyqtribbon where the separator is placed in the wrong position # despite the correct order of the button list. @@ -4931,7 +5463,7 @@ def sortButtons(button: QToolButton): # reset the counter after a separator is added. NoSmallButtons_spacer = 0 # Same principle for medium buttons - if float((NoMediumButtons_spacer-1) / 2).is_integer(): + if float((NoMediumButtons_spacer - 1) / 2).is_integer(): spacer_1 = panel.addMediumButton() spacer_1.setFixedWidth(Parameters_Ribbon.ICON_SIZE_MEDIUM) spacer_1.setEnabled(False) @@ -4956,17 +5488,32 @@ def sortButtons(button: QToolButton): # try to get alternative text from ribbonStructure try: - if panelName in dict["workbenches"][workbenchName]["toolbars"]: - if action.data() in dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"]: - if "text" in dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][action.data()]: - textJSON = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][action.data()]["text"] + if ( + panelName + in dict["workbenches"][workbenchName]["toolbars"] + ): + if ( + action.data() + in dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["commands"] + ): + if ( + "text" + in dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][action.data()] + ): + textJSON = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][action.data()]["text"] # There is a bug in freecad with the comp-sketch menu hase the wrong text if ( action.data() == "PartDesign_CompSketches" - and dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["commands"][action.data()][ + and dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][action.data()][ "text" ] == "Create datum" @@ -4978,15 +5525,17 @@ def sortButtons(button: QToolButton): for CommandName in Gui.listCommands(): # if it is a normal command: if len(action.data().split(", ")) <= 1: - MenuName = CommandInfoCorrections(CommandName)[ - "menuText" - ].replace("&", "") + MenuName = CommandInfoCorrections( + CommandName + )["menuText"].replace("&", "") if CommandName == action.data(): if ( MenuName != dict["workbenches"][ workbenchName - ]["toolbars"][panelName]["commands"][ + ]["toolbars"][panelName][ + "commands" + ][ action.data() ][ "text" @@ -5002,7 +5551,9 @@ def sortButtons(button: QToolButton): MenuName != dict["workbenches"][ workbenchName - ]["toolbars"][panelName]["commands"][ + ]["toolbars"][panelName][ + "commands" + ][ action.data() ][ "text" @@ -5018,9 +5569,11 @@ def sortButtons(button: QToolButton): action.setText(text) except KeyError as e: if Parameters_Ribbon.DEBUG_MODE is True: - print(f"No alternative text!. WB={workbenchName}, cmd={action.data()}, key={e}") + print( + f"No alternative text!. WB={workbenchName}, cmd={action.data()}, key={e}" + ) text = action.text() - + # Get the icon from cache. Use the pixmap as backup pixmap = "" CommandName = action.data() @@ -5031,9 +5584,9 @@ def sortButtons(button: QToolButton): CommandName = button.text() try: - pixmap = dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["commands"][CommandName]["icon"] + pixmap = dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["commands"][CommandName]["icon"] except Exception: pass actionIcon = self.ReturnCommandIcon(action.data(), pixmap) @@ -5042,9 +5595,9 @@ def sortButtons(button: QToolButton): # try to get alternative icon from ribbonStructure try: - icon_Json = dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["commands"][CommandName]["icon"] + icon_Json = dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["commands"][CommandName]["icon"] if icon_Json != "": action.setIcon(Gui.getIcon(icon_Json)) except KeyError: @@ -5089,9 +5642,9 @@ def sortButtons(button: QToolButton): # get button size from ribbonStructure try: - buttonSize = dict["workbenches"][ - workbenchName - ]["toolbars"][panelName]["commands"][CommandName]["size"] + buttonSize = dict["workbenches"][workbenchName]["toolbars"][ + panelName + ]["commands"][CommandName]["size"] # if "Part" in CommandName: # print(f"{CommandName}, {buttonSize}") if buttonSize == "": @@ -5112,13 +5665,16 @@ def sortButtons(button: QToolButton): if buttonSize == "small": showText = Parameters_Ribbon.SHOW_ICON_TEXT_SMALL if ( - IconOnly is True + IconOnly + is True # or Parameters_Ribbon.USE_FC_OVERLAY is True ): showText = False try: if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True: - showText = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]["textEnabled"] + showText = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName]["textEnabled"] except Exception: pass @@ -5133,12 +5689,16 @@ def sortButtons(button: QToolButton): ) if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True: try: - size = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]["ButtonSize_small"] + size = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName][ + "ButtonSize_small" + ] IconSize = QSize(size, size) ButtonSize = IconSize except Exception: pass - + Menu = None if button.menu() is not None: Menu = button.menu() @@ -5156,25 +5716,30 @@ def sortButtons(button: QToolButton): Menu=Menu, MenuButtonSpace=16, parent=self, - ButtonStyle=pyqtribbon.RibbonButtonStyle.Small - ) + ButtonStyle=pyqtribbon.RibbonButtonStyle.Small, + ) # add the button as a small button # layout.addWidgets(btn, "small") panel.addSmallWidget( btn, alignment=self.ButtonAlignment, fixedHeight=False, - ).setObjectName("CustomWidget_Small") # Set fixedheight to false. This is set in the custom widgets + ).setObjectName( + "CustomWidget_Small" + ) # Set fixedheight to false. This is set in the custom widgets elif buttonSize == "medium": showText = Parameters_Ribbon.SHOW_ICON_TEXT_MEDIUM if ( - IconOnly is True + IconOnly + is True # or Parameters_Ribbon.USE_FC_OVERLAY is True ): showText = False try: if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True: - showText = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]["textEnabled"] + showText = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName]["textEnabled"] except Exception: pass @@ -5189,12 +5754,16 @@ def sortButtons(button: QToolButton): ) if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True: try: - size = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]["ButtonSize_medium"] + size = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName][ + "ButtonSize_medium" + ] IconSize = QSize(size, size) ButtonSize = IconSize except Exception: pass - + Menu = None if button.menu() is not None: Menu = button.menu() @@ -5211,7 +5780,7 @@ def sortButtons(button: QToolButton): Menu=Menu, MenuButtonSpace=16, parent=self, - ButtonStyle=pyqtribbon.RibbonButtonStyle.Medium + ButtonStyle=pyqtribbon.RibbonButtonStyle.Medium, ) # add the button as large button # layout.addWidgets(btn, "medium") @@ -5219,18 +5788,30 @@ def sortButtons(button: QToolButton): btn, alignment=self.ButtonAlignment, fixedHeight=False, - ).setObjectName("CustomWidget_Medium") # Set fixedheight to false. This is set in the custom widgets + ).setObjectName( + "CustomWidget_Medium" + ) # Set fixedheight to false. This is set in the custom widgets elif buttonSize == "large": showText = Parameters_Ribbon.SHOW_ICON_TEXT_LARGE if ( - IconOnly is True + IconOnly + is True # or Parameters_Ribbon.USE_FC_OVERLAY is True ): showText = False try: if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True: - if "textEnabled" in dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]: - showText = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]["textEnabled"] + if ( + "textEnabled" + in dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName] + ): + showText = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName][ + "textEnabled" + ] except Exception as e: if Parameters_Ribbon.DEBUG_MODE is True: print(e) @@ -5246,15 +5827,19 @@ def sortButtons(button: QToolButton): Parameters_Ribbon.ICON_SIZE_LARGE, ) if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True: - try: - size = dict["workbenches"][workbenchName]["toolbars"][panelName]["commands"][CommandName]["ButtonSize_large"] + try: + size = dict["workbenches"][workbenchName][ + "toolbars" + ][panelName]["commands"][CommandName][ + "ButtonSize_large" + ] IconSize = QSize(size, size) ButtonSize = IconSize except Exception as e: if Parameters_Ribbon.DEBUG_MODE is True: print(e) pass - + Menu = None if button.menu() is not None: Menu = button.menu() @@ -5271,14 +5856,16 @@ def sortButtons(button: QToolButton): Menu=Menu, MenuButtonSpace=16, parent=self, - ButtonStyle=pyqtribbon.RibbonButtonStyle.Large + ButtonStyle=pyqtribbon.RibbonButtonStyle.Large, ) # add the button as large button panel.addLargeWidget( btn, fixedHeight=False, alignment=self.ButtonAlignment, - ).setObjectName("CustomWidget_Large") # Set fixedheight to false. This is set in the custom widgets + ).setObjectName( + "CustomWidget_Large" + ) # Set fixedheight to false. This is set in the custom widgets else: if Parameters_Ribbon.DEBUG_MODE is True: if buttonSize != "none": @@ -5291,9 +5878,7 @@ def sortButtons(button: QToolButton): # Styling is managed in the custom button class StyleSheet_Addition_Button = ( "QToolButton, QToolButton:hover {background-color: " - + StyleMapping_Ribbon.ReturnStyleItem( - "Background_Color" - ) + + StyleMapping_Ribbon.ReturnStyleItem("Background_Color") + ";border: none" + ";}" ) @@ -5306,21 +5891,31 @@ def sortButtons(button: QToolButton): if Parameters_Ribbon.DEBUG_MODE is True: raise e continue - + # Set the panel title panel.setTitle(self.ReturnPanelTitle(panel, dict)) # Set the panelheight. setting the ribbonheigt, cause the first tab to be shown to large self.setPanelProperties(panel) - + # Add a checkbox to the titlebar. Used for enabling or disabling panels. Default is hidden titleLayout: QHBoxLayout = panel._titleLayout # EnableControl = QCheckBox() EnableControl = Toggle() EnableControl.setChecked(True) - if panel.objectName() in self.ribbonStructure["workbenches"][workbenchName]["toolbars"]: - if "Enabled" in self.ribbonStructure["workbenches"][workbenchName]["toolbars"][panel.objectName()]: - Enabled = self.ribbonStructure["workbenches"][workbenchName]["toolbars"][panel.objectName()]["Enabled"] + if ( + panel.objectName() + in self.ribbonStructure["workbenches"][workbenchName]["toolbars"] + ): + if ( + "Enabled" + in self.ribbonStructure["workbenches"][workbenchName]["toolbars"][ + panel.objectName() + ] + ): + Enabled = self.ribbonStructure["workbenches"][workbenchName][ + "toolbars" + ][panel.objectName()]["Enabled"] EnableControl.setChecked(bool(Enabled)) EnableControl.setFixedWidth(32) EnableControl.setObjectName("EnablePanel") @@ -5330,16 +5925,16 @@ def sortButtons(button: QToolButton): # Setup the panelOptionButton panel = self.PopulateOverflowMenu(panel, ButtonList) - + # Add a spacer. Otherwise alignment of a panel with one button will always be to the top if len(allButtons) == 1: spacer = QWidget() spacer.setObjectName("ExtraSpacer") spacer.setMinimumSize(0, panel.height() - panel._titleWidget.height()) panel.addWidget(spacer, rowSpan=6) - + return panel - + def setPanelProperties(self, panel: RibbonPanel): # Set the panelheight. setting the ribbonheigt, cause the first tab to be shown to large # add an offset to make room for the panel titles and icons @@ -5347,25 +5942,31 @@ def setPanelProperties(self, panel: RibbonPanel): # Set the properties for the layouts panel._actionsLayout.setHorizontalSpacing(self.PaddingRight * 0.5) panel._actionsLayout.setSpacing(self.ButtonSpacing) - panel._actionsLayout.setAlignment(Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop) - panel._actionsLayout.setContentsMargins(0, self.TopMargin, 3, self.BottomMargin) # Left, Top, Right, Bottom + panel._actionsLayout.setAlignment( + Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop + ) + panel._actionsLayout.setContentsMargins( + 0, self.TopMargin, 3, self.BottomMargin + ) # Left, Top, Right, Bottom panel._mainLayout.setSpacing(0) panel.setFixedHeight(self.ReturnRibbonHeight(self.PanelHeightOffset)) # Set the font for the panel title Font = QFont() Font.setPixelSize(Parameters_Ribbon.FONTSIZE_PANELS) panel._titleLabel.setFont(Font) - panel._titleLabel.setFixedHeight(Parameters_Ribbon.FONTSIZE_PANELS+3) + panel._titleLabel.setFixedHeight(Parameters_Ribbon.FONTSIZE_PANELS + 3) # Set the ribbonheight self.RibbonHeight = self.ReturnRibbonHeight(self.RibbonOffset) self.setRibbonHeight(self.RibbonHeight) # Correct the width of the (hidden) option button OptionButton = panel.panelOptionButton() - OptionButton.setFixedSize(Parameters_Ribbon.ICON_SIZE_SMALL, Parameters_Ribbon.FONTSIZE_PANELS+3) + OptionButton.setFixedSize( + Parameters_Ribbon.ICON_SIZE_SMALL, Parameters_Ribbon.FONTSIZE_PANELS + 3 + ) # Set the size policy to fixed. Otherwise resizing is not working properly panel.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) return - + def PopulateOverflowMenu(self, panel: RibbonPanel, ButtonList: list): # Create a list of actions from the button list actionList = [] @@ -5382,10 +5983,10 @@ def PopulateOverflowMenu(self, panel: RibbonPanel, ButtonList: list): actionList.append(button.actions()) if type(button.actions()) is QAction: actionList.append(button.actions()) - + # The option button OptionButton = panel.panelOptionButton() - + # If there are actions, create an overflow menu from the panel option button if len(actionList) > 0: Menu = CustomControls.CustomOptionMenu( @@ -5416,22 +6017,23 @@ def PopulateOverflowMenu(self, panel: RibbonPanel, ButtonList: list): OptionButton.setText("more...") OptionButton.setFixedWidth(Parameters_Ribbon.ICON_SIZE_SMALL) # Set the background color and remove the border - OptionButton.setStyleSheet("RibbonPanelOptionButton{ background: " - + StyleMapping_Ribbon.ReturnStyleItem("Background_Color") - + ";border: " - + StyleMapping_Ribbon.ReturnStyleItem("Background_Color") - + ";}RibbonPanelOptionButton::hover { background: " - + StyleMapping_Ribbon.ReturnStyleItem("Background_Color_Hover") - + ";}" + OptionButton.setStyleSheet( + "RibbonPanelOptionButton{ background: " + + StyleMapping_Ribbon.ReturnStyleItem("Background_Color") + + ";border: " + + StyleMapping_Ribbon.ReturnStyleItem("Background_Color") + + ";}RibbonPanelOptionButton::hover { background: " + + StyleMapping_Ribbon.ReturnStyleItem("Background_Color_Hover") + + ";}" ) # Remove the tooltip OptionButton.setToolTip("") - + # If there are no actions, hide the button if len(actionList) == 0: panel.panelOptionButton().hide() return panel - + def RestoreJson(self): self.form.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint) # get the path for the Json file @@ -5476,7 +6078,7 @@ def RestoreJson(self): self.form.close() return - + # endregion # region - Titlebar functions @@ -5584,7 +6186,7 @@ def CheckDataFile(self): StandardFunctions.Mbox(text=Question, title="FreeCAD Ribbon", style=30) return True - def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): + def ConvertRibbonStructure(self, checkFCVersion=True, RestartFreeCAD=False): # Define a result parameter isConverted = False # Get the FreeCAD Version @@ -5612,10 +6214,19 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): # Convert the custompanels if "customToolbars" in self.ribbonStructure: for WorkBenchName in self.ribbonStructure["customToolbars"]: - for ToolbarName in self.ribbonStructure["customToolbars"][WorkBenchName]: + for ToolbarName in self.ribbonStructure["customToolbars"][ + WorkBenchName + ]: newDict = {} - if "commands" in self.ribbonStructure["customToolbars"][WorkBenchName][ToolbarName]: - currentDict: dict = self.ribbonStructure["customToolbars"][WorkBenchName][ToolbarName]["commands"] + if ( + "commands" + in self.ribbonStructure["customToolbars"][WorkBenchName][ + ToolbarName + ] + ): + currentDict: dict = self.ribbonStructure["customToolbars"][ + WorkBenchName + ][ToolbarName]["commands"] for key, value in currentDict.items(): for CommandItem in self.List_Commands: # Get the english menutext @@ -5623,9 +6234,15 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): # Get the translated menutext MenuNameTtranslated = CommandItem[4] - if (MenuName.lower() == key.lower() or MenuNameTtranslated.lower() == key or CommandItem[0] == key) and WorkBenchName == CommandItem[3]: + if ( + MenuName.lower() == key.lower() + or MenuNameTtranslated.lower() == key + or CommandItem[0] == key + ) and WorkBenchName == CommandItem[3]: try: - Standard_Functions_Ribbon.add_keys_nested_dict(newDict, [CommandItem[0]], 1, True) + Standard_Functions_Ribbon.add_keys_nested_dict( + newDict, [CommandItem[0]], 1, True + ) newDict[CommandItem[0]] = value except Exception as e: if Parameters_Ribbon.DEBUG_MODE is True: @@ -5634,8 +6251,10 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): "Warning", ) continue - self.ribbonStructure["customToolbars"][WorkBenchName][ToolbarName]["commands"] = newDict - + self.ribbonStructure["customToolbars"][WorkBenchName][ + ToolbarName + ]["commands"] = newDict + # Check if there are workbenches and toolbars in the ribbon structure if "workbenches" in self.ribbonStructure: for WorkBenchName in self.ribbonStructure["workbenches"]: @@ -5674,14 +6293,18 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): MenuText.lower() == DataItem[0].lower() ): - ConvertedList.append(DataItem[0]) + ConvertedList.append( + DataItem[0] + ) break # If the data item is still a menutext, add the command instead. if ( MenuText.lower() == DataItem[4].lower() ): - ConvertedList.append(DataItem[0]) + ConvertedList.append( + DataItem[0] + ) break # Update the ordered list @@ -5689,13 +6312,15 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): self.ribbonStructure["workbenches"][WorkBenchName][ "toolbars" ][ToolBar]["order"] = ConvertedList - + # Convert toolbar names to new names for certain WB's # # Fill the correction list -> {workbenchname [[new toolbar, old toolbar], [new toolbar, old toolbar]]} CorrectionList = {} - MappingFile = os.path.join(os.path.dirname(__file__), "Toolbar name mapping.json") - with open(MappingFile , "r") as File: + MappingFile = os.path.join( + os.path.dirname(__file__), "Toolbar name mapping.json" + ) + with open(MappingFile, "r") as File: CorrectionList.update(json.load(File)) File.close() @@ -5707,22 +6332,56 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): if WorkBench in CorrectionList: # Get the corresponding toolbar correction list ToolBarCorrectionList = CorrectionList[WorkBench] - # Go through the toolbars of the workbench in the json file - for toolbar in self.ribbonStructure["workbenches"][WorkBench]["toolbars"]: + # Go through the toolbars of the workbench in the json file + for toolbar in self.ribbonStructure["workbenches"][WorkBench][ + "toolbars" + ]: for ToolBarToCorrect in ToolBarCorrectionList: # If the toolbars match, update the json file - if ToolBarToCorrect[1] == toolbar or ToolBarToCorrect[0] == toolbar: - Standard_Functions_Ribbon.add_keys_nested_dict(Dict, ["workbenches", WorkBench, "toolbars", ToolBarToCorrect[1]], endEmpty=True) - Dict["workbenches"][WorkBench]["toolbars"][ToolBarToCorrect[1]] = self.ribbonStructure["workbenches"][WorkBench]["toolbars"][toolbar] + if ( + ToolBarToCorrect[1] == toolbar + or ToolBarToCorrect[0] == toolbar + ): + Standard_Functions_Ribbon.add_keys_nested_dict( + Dict, + [ + "workbenches", + WorkBench, + "toolbars", + ToolBarToCorrect[1], + ], + endEmpty=True, + ) + Dict["workbenches"][WorkBench]["toolbars"][ + ToolBarToCorrect[1] + ] = self.ribbonStructure["workbenches"][WorkBench][ + "toolbars" + ][ + toolbar + ] # if the toolbar doesn't match and is not the order list, just add it - if ToolBarToCorrect[1] != toolbar and ToolBarToCorrect[0] != toolbar and toolbar != "order": - Standard_Functions_Ribbon.add_keys_nested_dict(Dict, ["workbenches", WorkBench, "toolbars", toolbar], endEmpty=True) - Dict["workbenches"][WorkBench]["toolbars"][toolbar] = self.ribbonStructure["workbenches"][WorkBench]["toolbars"][toolbar] + if ( + ToolBarToCorrect[1] != toolbar + and ToolBarToCorrect[0] != toolbar + and toolbar != "order" + ): + Standard_Functions_Ribbon.add_keys_nested_dict( + Dict, + ["workbenches", WorkBench, "toolbars", toolbar], + endEmpty=True, + ) + Dict["workbenches"][WorkBench]["toolbars"][toolbar] = ( + self.ribbonStructure["workbenches"][WorkBench][ + "toolbars" + ][toolbar] + ) # if the toolbar is the order list, update its contents if toolbar == "order": # Get the current orderlist - OrderList: list = self.ribbonStructure["workbenches"][WorkBench]["toolbars"]["order"] - # Go through the correction list. If the toolbar to correct is in the order list, replace it with the correction + OrderList: list = self.ribbonStructure["workbenches"][ + WorkBench + ]["toolbars"]["order"] + # Go through the correction list. If the toolbar to correct is in the order list, replace it with the correction for ToolBarToCorrect in ToolBarCorrectionList: if ToolBarToCorrect[0] in OrderList: index = OrderList.index(ToolBarToCorrect[0]) @@ -5730,17 +6389,24 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): # If the orderlist is not empty, set the orderlist as the new order list in the ribbon structure if len(OrderList) > 0: Dict["workbenches"][WorkBench]["toolbars"]["order"] = OrderList - self.ribbonStructure["workbenches"][WorkBench]["toolbars"] = Dict["workbenches"][WorkBench]["toolbars"] - - # Go through the workbenches in the json file to remove old toolbars + self.ribbonStructure["workbenches"][WorkBench]["toolbars"] = Dict[ + "workbenches" + ][WorkBench]["toolbars"] + + # Go through the workbenches in the json file to remove old toolbars for WorkBench in self.ribbonStructure["workbenches"]: # if the workench is in the correction list, continue if WorkBench in CorrectionList: # Get the corresponding toolbar correction list ToolBarCorrectionList = CorrectionList[WorkBench] for ToolBarToCorrect in ToolBarCorrectionList: - if ToolBarToCorrect[0] in self.ribbonStructure["workbenches"][WorkBench]["toolbars"]: - self.ribbonStructure["workbenches"][WorkBench]["toolbars"].pop(ToolBarToCorrect[0]) + if ( + ToolBarToCorrect[0] + in self.ribbonStructure["workbenches"][WorkBench]["toolbars"] + ): + self.ribbonStructure["workbenches"][WorkBench]["toolbars"].pop( + ToolBarToCorrect[0] + ) # Add the version of FreeCAD on which this conversion is done, to the ribbonstructure # Create a key if not present @@ -5775,7 +6441,7 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): json.dump(self.ribbonStructure, outfile, indent=4) outfile.close() - + if RestartFreeCAD is True: message = translate( "FreeCAD Ribbon", @@ -5789,6 +6455,7 @@ def ConvertRibbonStructure(self, checkFCVersion = True, RestartFreeCAD = False): # endregion + class EventInspector(QObject): def __init__(self, parent): super(EventInspector, self).__init__(parent) @@ -5876,6 +6543,7 @@ def eventFilter(self, obj, event): return QObject.eventFilter(self, obj, event) return False + class run: """ Activate Modern UI. diff --git a/InitGui.py b/InitGui.py index 92a095ab..e963d361 100644 --- a/InitGui.py +++ b/InitGui.py @@ -43,10 +43,11 @@ # Set the logger levels to avoid extra output in the report panel logging.getLogger("urllib3").setLevel(logging.INFO) -# Set a value for the current needed version of the Ribbon structure. +# Set a value for the current needed version of the Ribbon structure. # Increasing this, results in a new created default structure file. CurrentStructureVersion = 2 + def QT_TRANSLATE_NOOP(context, text): return text @@ -79,7 +80,9 @@ def QT_TRANSLATE_NOOP(context, text): ) NewDefaultNeeded = True -ribbonStructureVersion = Parameters_Ribbon.Settings.GetIntSetting("RibbonStructureVersion") +ribbonStructureVersion = Parameters_Ribbon.Settings.GetIntSetting( + "RibbonStructureVersion" +) if ribbonStructureVersion >= CurrentStructureVersion: NewDefaultNeeded = False @@ -95,10 +98,12 @@ def QT_TRANSLATE_NOOP(context, text): # if not, copy and rename if fileExists is False or NewDefaultNeeded is True: shutil.copy(source_default, file_default) - Parameters_Ribbon.Settings.SetIntSetting("RibbonStructureVersion", CurrentStructureVersion) + Parameters_Ribbon.Settings.SetIntSetting( + "RibbonStructureVersion", CurrentStructureVersion + ) # remove the test workbench -try: +try: Gui.removeWorkbench("TestWorkbench") except Exception: pass diff --git a/LoadDesign_Ribbon.py b/LoadDesign_Ribbon.py index 158fb889..56ef3d11 100644 --- a/LoadDesign_Ribbon.py +++ b/LoadDesign_Ribbon.py @@ -849,11 +849,7 @@ def on_ReloadWB_clicked(self, resetTexts=False, RestartFreeCAD=False): # Get the stylesheet from the main window and use it for this form ( progressBar.setStyleSheet( - "background-color: " - + "none" - + ";color: " - + "none" - + ";" + "background-color: " + "none" + ";color: " + "none" + ";" ) ) progressBar.setMaximum(5) @@ -1817,7 +1813,10 @@ def on_AddPanel_CP_clicked(self): for j in range(len(value)): CommandName = value[j] for ToolbarCommand in self.List_Commands: - if ToolbarCommand[0] == CommandName or ToolbarCommand[2] == CommandName: + if ( + ToolbarCommand[0] == CommandName + or ToolbarCommand[2] == CommandName + ): # Get the command MenuName = ToolbarCommand[4].replace("&", "") @@ -1914,12 +1913,15 @@ def on_AddCustomPanel_CP_clicked(self): if CommandItem[0] == ListWidgetItem.data(Qt.ItemDataRole.UserRole)[1]: MenuName = CommandItem[2].replace("&", "") # For FC 1.1.0, use commandnames instead of menu names - if StandardFunctions.checkFreeCADVersion( + if ( + StandardFunctions.checkFreeCADVersion( Parameters_Ribbon.FreeCAD_Version["mainVersion"], Parameters_Ribbon.FreeCAD_Version["subVersion"], Parameters_Ribbon.FreeCAD_Version["patchVersion"], Parameters_Ribbon.FreeCAD_Version["gitVersion"], - ) is True: + ) + is True + ): MenuName = CommandItem[0] # Get the original toolbar @@ -2044,7 +2046,8 @@ def on_CustomToolbarSelector_CP_activated(self): ListWidgetItem = QListWidgetItem() ListWidgetItem.setText(MenuName) ListWidgetItem.setData( - Qt.ItemDataRole.UserRole, [value,CommandItem[0]] + Qt.ItemDataRole.UserRole, + [value, CommandItem[0]], ) Icon = QIcon() for item in self.List_CommandIcons: @@ -5572,7 +5575,14 @@ def CreateRibbonStructure_Panels(self, PanelName="all", Size="small"): return - def loadAllWorkbenches(self, AutoHide=True, HideOnly=False, FinishMessage="", progressBar: QProgressBar = None, maximum = 0): + def loadAllWorkbenches( + self, + AutoHide=True, + HideOnly=False, + FinishMessage="", + progressBar: QProgressBar = None, + maximum=0, + ): if HideOnly is False: activeWorkbench = Gui.activeWorkbench().name() progressBar.show() diff --git a/Parameters_Ribbon.py b/Parameters_Ribbon.py index a8bebb05..eab0a859 100644 --- a/Parameters_Ribbon.py +++ b/Parameters_Ribbon.py @@ -188,7 +188,6 @@ def WriteSettings(): # endregion - # region - Define the resources ---------------------------------------------------------------------------------------- ICON_LOCATION = os.path.join(os.path.dirname(__file__), "Resources", "icons") STYLESHEET_LOCATION = os.path.join( @@ -259,17 +258,17 @@ def WriteSettings(): } # Get the install location of FreeCAD -AppDir = os.path.join(App.getUserAppDataDir().split('FreeCAD')[0], "FreeCAD") +AppDir = os.path.join(App.getUserAppDataDir().split("FreeCAD")[0], "FreeCAD") OldModDir = os.path.join(AppDir, "Mod") CurrentModDir = os.path.join(App.getUserAppDataDir(), "Mod") # region - Define the import location ---------------------------------------------------------------------------------- IMPORT_LOCATION = Settings.GetStringSetting("ImportLocation") -if IMPORT_LOCATION == "" or os.path.isfile(IMPORT_LOCATION) is False: +if IMPORT_LOCATION == "" or os.path.isfile(IMPORT_LOCATION) is False: IMPORT_LOCATION = str(DefaultSettings["ImportLocation"]) Settings.SetStringSetting("ImportLocation", IMPORT_LOCATION) Settings.SetStringSetting("AddonDir", os.path.dirname(__file__)) - + # endregion ------------------------------------------------------------------------------------------------------------ # region - Define the export location ---------------------------------------------------------------------------------- @@ -383,7 +382,10 @@ def WriteSettings(): Settings.SetBoolSetting("BackupEnabled", ENABLE_BACKUP) BACKUP_LOCATION = Settings.GetStringSetting("BackupFolder") -if Settings.GetStringSetting("BackupFolder") == "" or os.path.isfile(BACKUP_LOCATION) is False: +if ( + Settings.GetStringSetting("BackupFolder") == "" + or os.path.isfile(BACKUP_LOCATION) is False +): BACKUP_LOCATION = str(DefaultSettings["BackupFolder"]) Settings.SetStringSetting("BackupFolder", BACKUP_LOCATION) # endregion ------------------------------------------------------------------------------------------------------------ @@ -629,4 +631,4 @@ def WriteSettings(): if Settings.GetBoolSetting("BetaFunctions") is None: BETA_FUNCTIONS_ENABLED = bool(DefaultSettings["BetaFunctions"]) Settings.SetBoolSetting("BetaFunctions", BETA_FUNCTIONS_ENABLED) -# endregion \ No newline at end of file +# endregion diff --git a/Resources/packages/pyqtribbon_local/category.py b/Resources/packages/pyqtribbon_local/category.py index f352e5c4..75fb7706 100644 --- a/Resources/packages/pyqtribbon_local/category.py +++ b/Resources/packages/pyqtribbon_local/category.py @@ -100,14 +100,16 @@ def __init__(self, parent=None): self._mainLayout.setContentsMargins(0, 0, 0, 0) self._mainLayout.setSpacing(0) self._mainLayout.addWidget( - self._previousButton, 1,0,1,1, Qt.AlignmentFlag.AlignVCenter + self._previousButton, 1, 0, 1, 1, Qt.AlignmentFlag.AlignVCenter ) - self._mainLayout.addWidget(self._categoryScrollArea, 0,1,-1,1) + self._mainLayout.addWidget(self._categoryScrollArea, 0, 1, -1, 1) spacer = QWidget() - spacer.setBaseSize(0,0) + spacer.setBaseSize(0, 0) spacer.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) self._mainLayout.addWidget(spacer, 0,2,1,-1) # fmt: skip - self._mainLayout.addWidget(self._nextButton, 1,3,1,1, Qt.AlignmentFlag.AlignVCenter) + self._mainLayout.addWidget( + self._nextButton, 1, 3, 1, 1, Qt.AlignmentFlag.AlignVCenter + ) # Auto set the visibility of the scroll buttons self.autoSetScrollButtonsVisible() @@ -153,7 +155,7 @@ def addWidget(self, widget: QWidget): :param widget: The widget to add. """ self._categoryLayout.addWidget(widget) - + def insertWidget(self, widget: QWidget, index: int): """Add a widget to the category layout. @@ -161,7 +163,12 @@ def insertWidget(self, widget: QWidget, index: int): """ self._categoryLayout.insertWidget(index, widget) - def replaceWidget(self, from_:QWidget, to: QWidget, FindChildOption = Qt.FindChildOption.FindChildrenRecursively): + def replaceWidget( + self, + from_: QWidget, + to: QWidget, + FindChildOption=Qt.FindChildOption.FindChildrenRecursively, + ): """Remove a widget from the category layout. :param from_: The widget to replace. @@ -334,8 +341,10 @@ def addPanel(self, title: str, showPanelOptionButton=True) -> RibbonPanel: self.addWidget(panel) # type: ignore # self.addWidget(RibbonSeparator(width=10)) # type: ignore return panel - - def insertPanel(self, index: int, title: str, showPanelOptionButton=True) -> RibbonPanel: + + def insertPanel( + self, index: int, title: str, showPanelOptionButton=True + ) -> RibbonPanel: """Add a new panel to the category. :param title: The title of the panel. @@ -367,7 +376,7 @@ def removePanel(self, title: str): # self._panelLayout.removeWidget(self._panels[title]) self.removeWidget(self._panels[title]) self._panels.pop(title) - + def replacePanel(self, fromPanel: RibbonPanel, toPanel: RibbonPanel): """Replace a panel from the category. diff --git a/Resources/packages/pyqtribbon_local/panel.py b/Resources/packages/pyqtribbon_local/panel.py index 257ae80b..9466b916 100644 --- a/Resources/packages/pyqtribbon_local/panel.py +++ b/Resources/packages/pyqtribbon_local/panel.py @@ -59,7 +59,7 @@ class RibbonPanelTitle(QLabel): """Widget to display the title of a panel.""" - + pass @@ -218,12 +218,12 @@ def __init__(self, *args, **kwargs): self._mainLayout = QGridLayout(self) self._mainLayout.setContentsMargins(0, 0, 3, 0) self._mainLayout.setSpacing(0) - + # Actions layout self._actionsLayout = QGridLayout() self._actionsLayout.setContentsMargins(5, 5, 5, 5) self._actionsLayout.setSpacing(0) - self._mainLayout.addLayout(self._actionsLayout, 0,0) + self._mainLayout.addLayout(self._actionsLayout, 0, 0) # Title layout self._titleWidget = QWidget() @@ -246,12 +246,12 @@ def __init__(self, *args, **kwargs): self._panelOption.clicked.connect(self.panelOptionClicked) # type: ignore self._titleLayout.addWidget(self._panelOption, 0) - self._mainLayout.addWidget(self._titleWidget, 1,0,1,1) - + self._mainLayout.addWidget(self._titleWidget, 1, 0, 1, 1) + # Add a separator self._separator = RibbonVerticalSeparator(width=3) - self._mainLayout.addWidget(self._separator, 0,1,2,1) - + self._mainLayout.addWidget(self._separator, 0, 1, 2, 1) + def maximumRows(self) -> int: """Return the maximal number of rows in the panel. @@ -456,7 +456,7 @@ def addWidget( rowSpan = self.defaultRowSpan(rowSpan) self._widgets.append(widget) row, col = self._gridLayoutManager.request_cells(rowSpan, colSpan, mode) - col = col + 1 # This way you can add a widget before the first widget + col = col + 1 # This way you can add a widget before the first widget maximumHeight = ( self.rowHeight() * rowSpan + self._actionsLayout.verticalSpacing() * (rowSpan - 2) @@ -484,14 +484,13 @@ def addWidget( def removeWidget(self, widget: QWidget): """Remove a widget from the panel.""" self._actionsLayout.removeWidget(widget) - + # def replaceWidget(self, widget: QWidget, newWidget: QWidget): # self._actionsLayout.replaceWidget(widget, newWidget) # index = self._widgets.index(widget) # self._widgets.pop(index) # self._widgets.insert(index, newWidget) - - + def widget(self, index: int) -> QWidget: """Get the widget at the given index. diff --git a/Resources/ui/Settings_ui.py b/Resources/ui/Settings_ui.py index fe636f05..f6c5f3b7 100644 --- a/Resources/ui/Settings_ui.py +++ b/Resources/ui/Settings_ui.py @@ -8,26 +8,69 @@ ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ -from PySide.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, - QMetaObject, QObject, QPoint, QRect, - QSize, QTime, QUrl, Qt) -from PySide.QtGui import (QBrush, QColor, QConicalGradient, QCursor, - QFont, QFontDatabase, QGradient, QIcon, - QImage, QKeySequence, QLinearGradient, QPainter, - QPalette, QPixmap, QRadialGradient, QTransform) -from PySide.QtWidgets import (QAbstractSpinBox, QApplication, QCheckBox, QComboBox, - QFrame, QGridLayout, QGroupBox, QLabel, - QPushButton, QScrollArea, QSizePolicy, QSlider, - QSpacerItem, QSpinBox, QTabWidget, QToolButton, - QVBoxLayout, QWidget) +from PySide.QtCore import ( + QCoreApplication, + QDate, + QDateTime, + QLocale, + QMetaObject, + QObject, + QPoint, + QRect, + QSize, + QTime, + QUrl, + Qt, +) +from PySide.QtGui import ( + QBrush, + QColor, + QConicalGradient, + QCursor, + QFont, + QFontDatabase, + QGradient, + QIcon, + QImage, + QKeySequence, + QLinearGradient, + QPainter, + QPalette, + QPixmap, + QRadialGradient, + QTransform, +) +from PySide.QtWidgets import ( + QAbstractSpinBox, + QApplication, + QCheckBox, + QComboBox, + QFrame, + QGridLayout, + QGroupBox, + QLabel, + QPushButton, + QScrollArea, + QSizePolicy, + QSlider, + QSpacerItem, + QSpinBox, + QTabWidget, + QToolButton, + QVBoxLayout, + QWidget, +) + class Ui_Settings(object): def setupUi(self, Settings): if not Settings.objectName(): - Settings.setObjectName(u"Settings") + Settings.setObjectName("Settings") Settings.setWindowModality(Qt.WindowModality.WindowModal) Settings.resize(736, 848) - sizePolicy = QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred) + sizePolicy = QSizePolicy( + QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Preferred + ) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Settings.sizePolicy().hasHeightForWidth()) @@ -35,12 +78,14 @@ def setupUi(self, Settings): Settings.setMinimumSize(QSize(600, 600)) Settings.setAutoFillBackground(False) self.gridLayout_36 = QGridLayout(Settings) - self.gridLayout_36.setObjectName(u"gridLayout_36") + self.gridLayout_36.setObjectName("gridLayout_36") self.gridLayout_6 = QGridLayout() - self.gridLayout_6.setObjectName(u"gridLayout_6") + self.gridLayout_6.setObjectName("gridLayout_6") self.scrollArea = QScrollArea(Settings) - self.scrollArea.setObjectName(u"scrollArea") - sizePolicy1 = QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.MinimumExpanding) + self.scrollArea.setObjectName("scrollArea") + sizePolicy1 = QSizePolicy( + QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.MinimumExpanding + ) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth()) @@ -48,37 +93,39 @@ def setupUi(self, Settings): self.scrollArea.setMinimumSize(QSize(0, 550)) self.scrollArea.setWidgetResizable(True) self.scrollAreaWidgetContents = QWidget() - self.scrollAreaWidgetContents.setObjectName(u"scrollAreaWidgetContents") + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") self.scrollAreaWidgetContents.setGeometry(QRect(0, 0, 697, 1350)) self.gridLayout_28 = QGridLayout(self.scrollAreaWidgetContents) - self.gridLayout_28.setObjectName(u"gridLayout_28") + self.gridLayout_28.setObjectName("gridLayout_28") self.tabWidget = QTabWidget(self.scrollAreaWidgetContents) - self.tabWidget.setObjectName(u"tabWidget") - sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) + self.tabWidget.setObjectName("tabWidget") + sizePolicy2 = QSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding + ) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth()) self.tabWidget.setSizePolicy(sizePolicy2) self.tabWidget.setAutoFillBackground(False) - self.tabWidget.setStyleSheet(u"") + self.tabWidget.setStyleSheet("") self.tabWidget.setElideMode(Qt.TextElideMode.ElideRight) self.General = QWidget() - self.General.setObjectName(u"General") + self.General.setObjectName("General") self.General.setEnabled(True) self.General.setAutoFillBackground(True) self.gridLayout_9 = QGridLayout(self.General) - self.gridLayout_9.setObjectName(u"gridLayout_9") + self.gridLayout_9.setObjectName("gridLayout_9") self.groupBox = QGroupBox(self.General) - self.groupBox.setObjectName(u"groupBox") + self.groupBox.setObjectName("groupBox") self.groupBox.setMinimumSize(QSize(0, 120)) font = QFont() font.setBold(True) self.groupBox.setFont(font) self.gridLayout_8 = QGridLayout(self.groupBox) - self.gridLayout_8.setObjectName(u"gridLayout_8") + self.gridLayout_8.setObjectName("gridLayout_8") self.gridLayout_8.setContentsMargins(6, 6, 6, 6) self.EnableBackup = QCheckBox(self.groupBox) - self.EnableBackup.setObjectName(u"EnableBackup") + self.EnableBackup.setObjectName("EnableBackup") font1 = QFont() font1.setBold(False) self.EnableBackup.setFont(font1) @@ -87,20 +134,26 @@ def setupUi(self, Settings): self.gridLayout_8.addWidget(self.EnableBackup, 0, 0, 1, 1) self.groupBox_Backup = QGroupBox(self.groupBox) - self.groupBox_Backup.setObjectName(u"groupBox_Backup") + self.groupBox_Backup.setObjectName("groupBox_Backup") self.groupBox_Backup.setEnabled(False) - sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed) + sizePolicy3 = QSizePolicy( + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed + ) sizePolicy3.setHorizontalStretch(0) sizePolicy3.setVerticalStretch(0) - sizePolicy3.setHeightForWidth(self.groupBox_Backup.sizePolicy().hasHeightForWidth()) + sizePolicy3.setHeightForWidth( + self.groupBox_Backup.sizePolicy().hasHeightForWidth() + ) self.groupBox_Backup.setSizePolicy(sizePolicy3) self.groupBox_Backup.setMinimumSize(QSize(0, 50)) self.groupBox_Backup.setFont(font1) self.gridLayout_13 = QGridLayout(self.groupBox_Backup) - self.gridLayout_13.setObjectName(u"gridLayout_13") + self.gridLayout_13.setObjectName("gridLayout_13") self.label_4 = QLabel(self.groupBox_Backup) - self.label_4.setObjectName(u"label_4") - sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred) + self.label_4.setObjectName("label_4") + sizePolicy4 = QSizePolicy( + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred + ) sizePolicy4.setHorizontalStretch(0) sizePolicy4.setVerticalStretch(0) sizePolicy4.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth()) @@ -108,48 +161,54 @@ def setupUi(self, Settings): self.label_4.setMinimumSize(QSize(400, 0)) self.label_4.setFrameShape(QFrame.Shape.Box) self.label_4.setScaledContents(True) - self.label_4.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignVCenter) + self.label_4.setAlignment( + Qt.AlignmentFlag.AlignLeading + | Qt.AlignmentFlag.AlignLeft + | Qt.AlignmentFlag.AlignVCenter + ) self.gridLayout_13.addWidget(self.label_4, 0, 0, 1, 1) self.BackUpLocation = QPushButton(self.groupBox_Backup) - self.BackUpLocation.setObjectName(u"BackUpLocation") + self.BackUpLocation.setObjectName("BackUpLocation") sizePolicy5 = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) sizePolicy5.setHorizontalStretch(20) sizePolicy5.setVerticalStretch(0) - sizePolicy5.setHeightForWidth(self.BackUpLocation.sizePolicy().hasHeightForWidth()) + sizePolicy5.setHeightForWidth( + self.BackUpLocation.sizePolicy().hasHeightForWidth() + ) self.BackUpLocation.setSizePolicy(sizePolicy5) self.BackUpLocation.setMinimumSize(QSize(20, 0)) self.gridLayout_13.addWidget(self.BackUpLocation, 0, 1, 1, 1) - self.gridLayout_8.addWidget(self.groupBox_Backup, 1, 0, 1, 1) - self.gridLayout_9.addWidget(self.groupBox, 0, 0, 2, 1) self.groupBox1 = QGroupBox(self.General) - self.groupBox1.setObjectName(u"groupBox1") + self.groupBox1.setObjectName("groupBox1") self.groupBox1.setMinimumSize(QSize(0, 300)) self.groupBox1.setFont(font) self.gridLayout_4 = QGridLayout(self.groupBox1) - self.gridLayout_4.setObjectName(u"gridLayout_4") + self.gridLayout_4.setObjectName("gridLayout_4") self.gridLayout_3 = QGridLayout() - self.gridLayout_3.setObjectName(u"gridLayout_3") + self.gridLayout_3.setObjectName("gridLayout_3") self.groupBox_3 = QGroupBox(self.groupBox1) - self.groupBox_3.setObjectName(u"groupBox_3") + self.groupBox_3.setObjectName("groupBox_3") self.groupBox_3.setFont(font1) self.gridLayout_2 = QGridLayout(self.groupBox_3) - self.gridLayout_2.setObjectName(u"gridLayout_2") + self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout_26 = QGridLayout() - self.gridLayout_26.setObjectName(u"gridLayout_26") + self.gridLayout_26.setObjectName("gridLayout_26") self.ShowText_Medium = QCheckBox(self.groupBox_3) - self.ShowText_Medium.setObjectName(u"ShowText_Medium") + self.ShowText_Medium.setObjectName("ShowText_Medium") sizePolicy6 = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) sizePolicy6.setHorizontalStretch(0) sizePolicy6.setVerticalStretch(0) - sizePolicy6.setHeightForWidth(self.ShowText_Medium.sizePolicy().hasHeightForWidth()) + sizePolicy6.setHeightForWidth( + self.ShowText_Medium.sizePolicy().hasHeightForWidth() + ) self.ShowText_Medium.setSizePolicy(sizePolicy6) self.ShowText_Medium.setMinimumSize(QSize(100, 0)) self.ShowText_Medium.setFont(font1) @@ -157,15 +216,17 @@ def setupUi(self, Settings): self.gridLayout_26.addWidget(self.ShowText_Medium, 1, 0, 1, 1) self.EnableWrap_Large = QCheckBox(self.groupBox_3) - self.EnableWrap_Large.setObjectName(u"EnableWrap_Large") + self.EnableWrap_Large.setObjectName("EnableWrap_Large") self.EnableWrap_Large.setEnabled(True) self.EnableWrap_Large.setChecked(True) self.gridLayout_26.addWidget(self.EnableWrap_Large, 2, 2, 1, 1) self.ShowText_Large = QCheckBox(self.groupBox_3) - self.ShowText_Large.setObjectName(u"ShowText_Large") - sizePolicy6.setHeightForWidth(self.ShowText_Large.sizePolicy().hasHeightForWidth()) + self.ShowText_Large.setObjectName("ShowText_Large") + sizePolicy6.setHeightForWidth( + self.ShowText_Large.sizePolicy().hasHeightForWidth() + ) self.ShowText_Large.setSizePolicy(sizePolicy6) self.ShowText_Large.setMinimumSize(QSize(100, 0)) self.ShowText_Large.setFont(font1) @@ -174,34 +235,38 @@ def setupUi(self, Settings): self.gridLayout_26.addWidget(self.ShowText_Large, 2, 0, 1, 1) self.ShowText_Small = QCheckBox(self.groupBox_3) - self.ShowText_Small.setObjectName(u"ShowText_Small") - sizePolicy6.setHeightForWidth(self.ShowText_Small.sizePolicy().hasHeightForWidth()) + self.ShowText_Small.setObjectName("ShowText_Small") + sizePolicy6.setHeightForWidth( + self.ShowText_Small.sizePolicy().hasHeightForWidth() + ) self.ShowText_Small.setSizePolicy(sizePolicy6) self.ShowText_Small.setMinimumSize(QSize(100, 0)) self.ShowText_Small.setFont(font1) self.gridLayout_26.addWidget(self.ShowText_Small, 0, 0, 1, 1) - self.horizontalSpacer_9 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_9 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_26.addItem(self.horizontalSpacer_9, 0, 2, 1, 1) self.EnableWrap_Medium = QCheckBox(self.groupBox_3) - self.EnableWrap_Medium.setObjectName(u"EnableWrap_Medium") + self.EnableWrap_Medium.setObjectName("EnableWrap_Medium") self.EnableWrap_Medium.setEnabled(False) self.EnableWrap_Medium.setChecked(True) self.gridLayout_26.addWidget(self.EnableWrap_Medium, 1, 2, 1, 1) - self.gridLayout_2.addLayout(self.gridLayout_26, 0, 0, 1, 1) - self.gridLayout_3.addWidget(self.groupBox_3, 2, 0, 1, 1) self.groupBox_10 = QGroupBox(self.groupBox1) - self.groupBox_10.setObjectName(u"groupBox_10") - sizePolicy7 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum) + self.groupBox_10.setObjectName("groupBox_10") + sizePolicy7 = QSizePolicy( + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum + ) sizePolicy7.setHorizontalStretch(0) sizePolicy7.setVerticalStretch(0) sizePolicy7.setHeightForWidth(self.groupBox_10.sizePolicy().hasHeightForWidth()) @@ -209,20 +274,20 @@ def setupUi(self, Settings): self.groupBox_10.setMinimumSize(QSize(0, 0)) self.groupBox_10.setFont(font1) self.gridLayout_25 = QGridLayout(self.groupBox_10) - self.gridLayout_25.setObjectName(u"gridLayout_25") + self.gridLayout_25.setObjectName("gridLayout_25") self.gridLayout_24 = QGridLayout() - self.gridLayout_24.setObjectName(u"gridLayout_24") + self.gridLayout_24.setObjectName("gridLayout_24") self.ToolbarPositions = QComboBox(self.groupBox_10) self.ToolbarPositions.addItem("") self.ToolbarPositions.addItem("") - self.ToolbarPositions.setObjectName(u"ToolbarPositions") + self.ToolbarPositions.setObjectName("ToolbarPositions") self.ToolbarPositions.setMinimumSize(QSize(180, 0)) self.ToolbarPositions.setFont(font1) self.gridLayout_24.addWidget(self.ToolbarPositions, 1, 1, 1, 1) self.HideTitleBarFC = QCheckBox(self.groupBox_10) - self.HideTitleBarFC.setObjectName(u"HideTitleBarFC") + self.HideTitleBarFC.setObjectName("HideTitleBarFC") self.HideTitleBarFC.setFont(font1) self.HideTitleBarFC.setChecked(True) @@ -232,67 +297,75 @@ def setupUi(self, Settings): self.TabbarStyle.addItem("") self.TabbarStyle.addItem("") self.TabbarStyle.addItem("") - self.TabbarStyle.setObjectName(u"TabbarStyle") + self.TabbarStyle.setObjectName("TabbarStyle") self.TabbarStyle.setMinimumSize(QSize(180, 0)) self.TabbarStyle.setFont(font1) self.gridLayout_24.addWidget(self.TabbarStyle, 0, 1, 1, 1) self.label_24 = QLabel(self.groupBox_10) - self.label_24.setObjectName(u"label_24") + self.label_24.setObjectName("label_24") self.label_24.setFont(font1) self.gridLayout_24.addWidget(self.label_24, 0, 0, 1, 1) self.label_36 = QLabel(self.groupBox_10) - self.label_36.setObjectName(u"label_36") + self.label_36.setObjectName("label_36") self.label_36.setFont(font1) self.gridLayout_24.addWidget(self.label_36, 1, 0, 1, 1) self.label_8 = QLabel(self.groupBox_10) - self.label_8.setObjectName(u"label_8") + self.label_8.setObjectName("label_8") self.label_8.setMinimumSize(QSize(0, 0)) self.label_8.setWordWrap(True) self.label_8.setOpenExternalLinks(True) - self.label_8.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction) + self.label_8.setTextInteractionFlags( + Qt.TextInteractionFlag.TextBrowserInteraction + ) self.gridLayout_24.addWidget(self.label_8, 3, 0, 1, 2) - self.gridLayout_25.addLayout(self.gridLayout_24, 0, 0, 1, 1) - self.horizontalSpacer_7 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_7 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_25.addItem(self.horizontalSpacer_7, 0, 1, 1, 1) - self.gridLayout_3.addWidget(self.groupBox_10, 0, 0, 1, 1) self.groupBox_4 = QGroupBox(self.groupBox1) - self.groupBox_4.setObjectName(u"groupBox_4") + self.groupBox_4.setObjectName("groupBox_4") self.groupBox_4.setFont(font1) self.gridLayout_5 = QGridLayout(self.groupBox_4) - self.gridLayout_5.setObjectName(u"gridLayout_5") + self.gridLayout_5.setObjectName("gridLayout_5") self.gridLayout = QGridLayout() - self.gridLayout.setObjectName(u"gridLayout") + self.gridLayout.setObjectName("gridLayout") self.label_23 = QLabel(self.groupBox_4) - self.label_23.setObjectName(u"label_23") + self.label_23.setObjectName("label_23") self.gridLayout.addWidget(self.label_23, 5, 0, 1, 1) self.IconSize_Medium = QSpinBox(self.groupBox_4) - self.IconSize_Medium.setObjectName(u"IconSize_Medium") - sizePolicy8 = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred) + self.IconSize_Medium.setObjectName("IconSize_Medium") + sizePolicy8 = QSizePolicy( + QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred + ) sizePolicy8.setHorizontalStretch(0) sizePolicy8.setVerticalStretch(0) - sizePolicy8.setHeightForWidth(self.IconSize_Medium.sizePolicy().hasHeightForWidth()) + sizePolicy8.setHeightForWidth( + self.IconSize_Medium.sizePolicy().hasHeightForWidth() + ) self.IconSize_Medium.setSizePolicy(sizePolicy8) self.IconSize_Medium.setMinimumSize(QSize(50, 20)) self.IconSize_Medium.setBaseSize(QSize(0, 0)) self.IconSize_Medium.setFont(font1) self.IconSize_Medium.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.IconSize_Medium.setCorrectionMode(QAbstractSpinBox.CorrectionMode.CorrectToNearestValue) + self.IconSize_Medium.setCorrectionMode( + QAbstractSpinBox.CorrectionMode.CorrectToNearestValue + ) self.IconSize_Medium.setMinimum(16) self.IconSize_Medium.setMaximum(48) self.IconSize_Medium.setValue(44) @@ -300,14 +373,14 @@ def setupUi(self, Settings): self.gridLayout.addWidget(self.IconSize_Medium, 1, 1, 1, 1) self.TabbarHeight = QSpinBox(self.groupBox_4) - self.TabbarHeight.setObjectName(u"TabbarHeight") + self.TabbarHeight.setObjectName("TabbarHeight") self.TabbarHeight.setMinimumSize(QSize(50, 20)) self.TabbarHeight.setAlignment(Qt.AlignmentFlag.AlignCenter) self.gridLayout.addWidget(self.TabbarHeight, 5, 1, 1, 1) self.IconSize_ApplicationButton = QSpinBox(self.groupBox_4) - self.IconSize_ApplicationButton.setObjectName(u"IconSize_ApplicationButton") + self.IconSize_ApplicationButton.setObjectName("IconSize_ApplicationButton") self.IconSize_ApplicationButton.setMinimumSize(QSize(50, 20)) self.IconSize_ApplicationButton.setAlignment(Qt.AlignmentFlag.AlignCenter) self.IconSize_ApplicationButton.setMinimum(30) @@ -317,17 +390,17 @@ def setupUi(self, Settings): self.gridLayout.addWidget(self.IconSize_ApplicationButton, 3, 1, 1, 1) self.label_22 = QLabel(self.groupBox_4) - self.label_22.setObjectName(u"label_22") + self.label_22.setObjectName("label_22") self.gridLayout.addWidget(self.label_22, 6, 0, 1, 1) self.label_5 = QLabel(self.groupBox_4) - self.label_5.setObjectName(u"label_5") + self.label_5.setObjectName("label_5") self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1) self.label_10 = QLabel(self.groupBox_4) - self.label_10.setObjectName(u"label_10") + self.label_10.setObjectName("label_10") sizePolicy8.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth()) self.label_10.setSizePolicy(sizePolicy8) self.label_10.setMinimumSize(QSize(130, 0)) @@ -336,12 +409,12 @@ def setupUi(self, Settings): self.gridLayout.addWidget(self.label_10, 0, 0, 1, 1) self.label_21 = QLabel(self.groupBox_4) - self.label_21.setObjectName(u"label_21") + self.label_21.setObjectName("label_21") self.gridLayout.addWidget(self.label_21, 4, 0, 1, 1) self.label_11 = QLabel(self.groupBox_4) - self.label_11.setObjectName(u"label_11") + self.label_11.setObjectName("label_11") sizePolicy8.setHeightForWidth(self.label_11.sizePolicy().hasHeightForWidth()) self.label_11.setSizePolicy(sizePolicy8) self.label_11.setMinimumSize(QSize(130, 0)) @@ -350,7 +423,7 @@ def setupUi(self, Settings): self.gridLayout.addWidget(self.label_11, 1, 0, 1, 1) self.IconSize_QuickAccessButton = QSpinBox(self.groupBox_4) - self.IconSize_QuickAccessButton.setObjectName(u"IconSize_QuickAccessButton") + self.IconSize_QuickAccessButton.setObjectName("IconSize_QuickAccessButton") self.IconSize_QuickAccessButton.setMinimumSize(QSize(50, 20)) self.IconSize_QuickAccessButton.setAlignment(Qt.AlignmentFlag.AlignCenter) self.IconSize_QuickAccessButton.setMinimum(16) @@ -359,19 +432,19 @@ def setupUi(self, Settings): self.gridLayout.addWidget(self.IconSize_QuickAccessButton, 4, 1, 1, 1) self.IconSize_rightToolbarButton = QSpinBox(self.groupBox_4) - self.IconSize_rightToolbarButton.setObjectName(u"IconSize_rightToolbarButton") + self.IconSize_rightToolbarButton.setObjectName("IconSize_rightToolbarButton") self.IconSize_rightToolbarButton.setMinimumSize(QSize(50, 20)) self.IconSize_rightToolbarButton.setAlignment(Qt.AlignmentFlag.AlignCenter) self.gridLayout.addWidget(self.IconSize_rightToolbarButton, 6, 1, 1, 1) self.label_25 = QLabel(self.groupBox_4) - self.label_25.setObjectName(u"label_25") + self.label_25.setObjectName("label_25") self.gridLayout.addWidget(self.label_25, 2, 0, 1, 1) self.IconSize_Large = QSpinBox(self.groupBox_4) - self.IconSize_Large.setObjectName(u"IconSize_Large") + self.IconSize_Large.setObjectName("IconSize_Large") self.IconSize_Large.setMinimumSize(QSize(50, 0)) self.IconSize_Large.setAlignment(Qt.AlignmentFlag.AlignCenter) self.IconSize_Large.setMinimum(16) @@ -380,8 +453,10 @@ def setupUi(self, Settings): self.gridLayout.addWidget(self.IconSize_Large, 2, 1, 1, 1) self.IconSize_Small = QSpinBox(self.groupBox_4) - self.IconSize_Small.setObjectName(u"IconSize_Small") - sizePolicy8.setHeightForWidth(self.IconSize_Small.sizePolicy().hasHeightForWidth()) + self.IconSize_Small.setObjectName("IconSize_Small") + sizePolicy8.setHeightForWidth( + self.IconSize_Small.sizePolicy().hasHeightForWidth() + ) self.IconSize_Small.setSizePolicy(sizePolicy8) self.IconSize_Small.setMinimumSize(QSize(50, 20)) self.IconSize_Small.setSizeIncrement(QSize(0, 0)) @@ -390,37 +465,41 @@ def setupUi(self, Settings): self.IconSize_Small.setFocusPolicy(Qt.FocusPolicy.WheelFocus) self.IconSize_Small.setFrame(True) self.IconSize_Small.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.IconSize_Small.setCorrectionMode(QAbstractSpinBox.CorrectionMode.CorrectToNearestValue) - self.IconSize_Small.setProperty(u"showGroupSeparator", False) + self.IconSize_Small.setCorrectionMode( + QAbstractSpinBox.CorrectionMode.CorrectToNearestValue + ) + self.IconSize_Small.setProperty("showGroupSeparator", False) self.IconSize_Small.setMinimum(16) self.IconSize_Small.setMaximum(36) self.IconSize_Small.setValue(24) self.gridLayout.addWidget(self.IconSize_Small, 0, 1, 1, 1) - self.gridLayout_5.addLayout(self.gridLayout, 1, 0, 1, 1) - self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_3 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_5.addItem(self.horizontalSpacer_3, 1, 1, 1, 1) - self.gridLayout_3.addWidget(self.groupBox_4, 1, 0, 1, 1) self.groupBox_5 = QGroupBox(self.groupBox1) - self.groupBox_5.setObjectName(u"groupBox_5") + self.groupBox_5.setObjectName("groupBox_5") sizePolicy4.setHeightForWidth(self.groupBox_5.sizePolicy().hasHeightForWidth()) self.groupBox_5.setSizePolicy(sizePolicy4) self.groupBox_5.setMinimumSize(QSize(0, 0)) self.groupBox_5.setFont(font1) self.gridLayout_11 = QGridLayout(self.groupBox_5) - self.gridLayout_11.setObjectName(u"gridLayout_11") + self.gridLayout_11.setObjectName("gridLayout_11") self.gridLayout_10 = QGridLayout() - self.gridLayout_10.setObjectName(u"gridLayout_10") + self.gridLayout_10.setObjectName("gridLayout_10") self.MaxPanelColumn = QSpinBox(self.groupBox_5) - self.MaxPanelColumn.setObjectName(u"MaxPanelColumn") - sizePolicy6.setHeightForWidth(self.MaxPanelColumn.sizePolicy().hasHeightForWidth()) + self.MaxPanelColumn.setObjectName("MaxPanelColumn") + sizePolicy6.setHeightForWidth( + self.MaxPanelColumn.sizePolicy().hasHeightForWidth() + ) self.MaxPanelColumn.setSizePolicy(sizePolicy6) self.MaxPanelColumn.setMinimumSize(QSize(50, 20)) self.MaxPanelColumn.setAlignment(Qt.AlignmentFlag.AlignCenter) @@ -431,47 +510,49 @@ def setupUi(self, Settings): self.gridLayout_10.addWidget(self.MaxPanelColumn, 0, 1, 1, 1) self.label = QLabel(self.groupBox_5) - self.label.setObjectName(u"label") + self.label.setObjectName("label") self.gridLayout_10.addWidget(self.label, 0, 0, 1, 1) - self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_10.addItem(self.horizontalSpacer, 0, 2, 1, 1) self.label_2 = QLabel(self.groupBox_5) - self.label_2.setObjectName(u"label_2") + self.label_2.setObjectName("label_2") self.label_2.setMinimumSize(QSize(0, 10)) self.gridLayout_10.addWidget(self.label_2, 1, 0, 1, 3) - self.gridLayout_11.addLayout(self.gridLayout_10, 0, 0, 1, 1) - self.gridLayout_3.addWidget(self.groupBox_5, 4, 0, 1, 1) self.groupBox_14 = QGroupBox(self.groupBox1) - self.groupBox_14.setObjectName(u"groupBox_14") + self.groupBox_14.setObjectName("groupBox_14") self.groupBox_14.setFont(font1) self.gridLayout_39 = QGridLayout(self.groupBox_14) - self.gridLayout_39.setObjectName(u"gridLayout_39") + self.gridLayout_39.setObjectName("gridLayout_39") self.gridLayout_38 = QGridLayout() - self.gridLayout_38.setObjectName(u"gridLayout_38") + self.gridLayout_38.setObjectName("gridLayout_38") self.label_32 = QLabel(self.groupBox_14) - self.label_32.setObjectName(u"label_32") + self.label_32.setObjectName("label_32") self.label_32.setMinimumSize(QSize(191, 0)) self.gridLayout_38.addWidget(self.label_32, 0, 0, 1, 1) self.label_34 = QLabel(self.groupBox_14) - self.label_34.setObjectName(u"label_34") + self.label_34.setObjectName("label_34") self.gridLayout_38.addWidget(self.label_34, 2, 0, 1, 1) self.TextSize_Menus = QSpinBox(self.groupBox_14) - self.TextSize_Menus.setObjectName(u"TextSize_Menus") - sizePolicy8.setHeightForWidth(self.TextSize_Menus.sizePolicy().hasHeightForWidth()) + self.TextSize_Menus.setObjectName("TextSize_Menus") + sizePolicy8.setHeightForWidth( + self.TextSize_Menus.sizePolicy().hasHeightForWidth() + ) self.TextSize_Menus.setSizePolicy(sizePolicy8) self.TextSize_Menus.setMinimumSize(QSize(50, 20)) self.TextSize_Menus.setSizeIncrement(QSize(0, 0)) @@ -480,8 +561,10 @@ def setupUi(self, Settings): self.TextSize_Menus.setFocusPolicy(Qt.FocusPolicy.WheelFocus) self.TextSize_Menus.setFrame(True) self.TextSize_Menus.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.TextSize_Menus.setCorrectionMode(QAbstractSpinBox.CorrectionMode.CorrectToNearestValue) - self.TextSize_Menus.setProperty(u"showGroupSeparator", False) + self.TextSize_Menus.setCorrectionMode( + QAbstractSpinBox.CorrectionMode.CorrectToNearestValue + ) + self.TextSize_Menus.setProperty("showGroupSeparator", False) self.TextSize_Menus.setMinimum(8) self.TextSize_Menus.setMaximum(24) self.TextSize_Menus.setValue(11) @@ -490,20 +573,22 @@ def setupUi(self, Settings): self.gridLayout_38.addWidget(self.TextSize_Menus, 0, 1, 1, 1) self.label_35 = QLabel(self.groupBox_14) - self.label_35.setObjectName(u"label_35") + self.label_35.setObjectName("label_35") self.gridLayout_38.addWidget(self.label_35, 3, 0, 1, 1) self.label_33 = QLabel(self.groupBox_14) - self.label_33.setObjectName(u"label_33") + self.label_33.setObjectName("label_33") self.gridLayout_38.addWidget(self.label_33, 1, 0, 1, 1) self.TextSize_Buttons = QSpinBox(self.groupBox_14) - self.TextSize_Buttons.setObjectName(u"TextSize_Buttons") + self.TextSize_Buttons.setObjectName("TextSize_Buttons") self.TextSize_Buttons.setFont(font1) self.TextSize_Buttons.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.TextSize_Buttons.setCorrectionMode(QAbstractSpinBox.CorrectionMode.CorrectToNearestValue) + self.TextSize_Buttons.setCorrectionMode( + QAbstractSpinBox.CorrectionMode.CorrectToNearestValue + ) self.TextSize_Buttons.setMinimum(8) self.TextSize_Buttons.setMaximum(24) self.TextSize_Buttons.setValue(11) @@ -511,7 +596,7 @@ def setupUi(self, Settings): self.gridLayout_38.addWidget(self.TextSize_Buttons, 1, 1, 1, 1) self.TextSize_Tabs = QSpinBox(self.groupBox_14) - self.TextSize_Tabs.setObjectName(u"TextSize_Tabs") + self.TextSize_Tabs.setObjectName("TextSize_Tabs") self.TextSize_Tabs.setFont(font1) self.TextSize_Tabs.setAlignment(Qt.AlignmentFlag.AlignCenter) self.TextSize_Tabs.setMinimum(8) @@ -521,7 +606,7 @@ def setupUi(self, Settings): self.gridLayout_38.addWidget(self.TextSize_Tabs, 2, 1, 1, 1) self.TextSize_Panels = QSpinBox(self.groupBox_14) - self.TextSize_Panels.setObjectName(u"TextSize_Panels") + self.TextSize_Panels.setObjectName("TextSize_Panels") self.TextSize_Panels.setFont(font1) self.TextSize_Panels.setAlignment(Qt.AlignmentFlag.AlignCenter) self.TextSize_Panels.setMinimum(8) @@ -530,22 +615,23 @@ def setupUi(self, Settings): self.gridLayout_38.addWidget(self.TextSize_Panels, 3, 1, 1, 1) - self.gridLayout_39.addLayout(self.gridLayout_38, 0, 0, 1, 1) - self.horizontalSpacer_12 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_12 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_39.addItem(self.horizontalSpacer_12, 0, 1, 1, 1) - self.gridLayout_3.addWidget(self.groupBox_14, 3, 0, 1, 1) - self.gridLayout_4.addLayout(self.gridLayout_3, 0, 0, 1, 1) self.groupBox_2 = QGroupBox(self.groupBox1) - self.groupBox_2.setObjectName(u"groupBox_2") - sizePolicy9 = QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed) + self.groupBox_2.setObjectName("groupBox_2") + sizePolicy9 = QSizePolicy( + QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed + ) sizePolicy9.setHorizontalStretch(0) sizePolicy9.setVerticalStretch(0) sizePolicy9.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) @@ -553,34 +639,38 @@ def setupUi(self, Settings): self.groupBox_2.setMinimumSize(QSize(0, 60)) self.groupBox_2.setFont(font1) self.gridLayout_12 = QGridLayout(self.groupBox_2) - self.gridLayout_12.setObjectName(u"gridLayout_12") + self.gridLayout_12.setObjectName("gridLayout_12") self.gridLayout_12.setContentsMargins(-1, 9, -1, -1) self.label_7 = QLabel(self.groupBox_2) - self.label_7.setObjectName(u"label_7") + self.label_7.setObjectName("label_7") self.label_7.setFrameShape(QFrame.Shape.Box) self.label_7.setScaledContents(True) - self.label_7.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignVCenter) + self.label_7.setAlignment( + Qt.AlignmentFlag.AlignLeading + | Qt.AlignmentFlag.AlignLeft + | Qt.AlignmentFlag.AlignVCenter + ) self.gridLayout_12.addWidget(self.label_7, 0, 0, 1, 1) self.StyleSheetLocation = QPushButton(self.groupBox_2) - self.StyleSheetLocation.setObjectName(u"StyleSheetLocation") - sizePolicy5.setHeightForWidth(self.StyleSheetLocation.sizePolicy().hasHeightForWidth()) + self.StyleSheetLocation.setObjectName("StyleSheetLocation") + sizePolicy5.setHeightForWidth( + self.StyleSheetLocation.sizePolicy().hasHeightForWidth() + ) self.StyleSheetLocation.setSizePolicy(sizePolicy5) self.StyleSheetLocation.setMinimumSize(QSize(20, 0)) self.gridLayout_12.addWidget(self.StyleSheetLocation, 0, 1, 1, 1) - self.gridLayout_4.addWidget(self.groupBox_2, 1, 0, 1, 1) - self.gridLayout_9.addWidget(self.groupBox1, 2, 0, 1, 1) self.verticalLayout_2 = QVBoxLayout() - self.verticalLayout_2.setObjectName(u"verticalLayout_2") + self.verticalLayout_2.setObjectName("verticalLayout_2") self.DebugMode = QCheckBox(self.General) - self.DebugMode.setObjectName(u"DebugMode") + self.DebugMode.setObjectName("DebugMode") sizePolicy3.setHeightForWidth(self.DebugMode.sizePolicy().hasHeightForWidth()) self.DebugMode.setSizePolicy(sizePolicy3) self.DebugMode.setMinimumSize(QSize(0, 0)) @@ -590,7 +680,7 @@ def setupUi(self, Settings): self.verticalLayout_2.addWidget(self.DebugMode) self.label_3 = QLabel(self.General) - self.label_3.setObjectName(u"label_3") + self.label_3.setObjectName("label_3") sizePolicy4.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth()) self.label_3.setSizePolicy(sizePolicy4) self.label_3.setMinimumSize(QSize(300, 0)) @@ -599,36 +689,39 @@ def setupUi(self, Settings): self.verticalLayout_2.addWidget(self.label_3) - self.gridLayout_9.addLayout(self.verticalLayout_2, 6, 0, 1, 1) - self.verticalSpacer_7 = QSpacerItem(20, 10, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.verticalSpacer_7 = QSpacerItem( + 20, 10, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.gridLayout_9.addItem(self.verticalSpacer_7, 5, 0, 1, 1) self.tabWidget.addTab(self.General, "") self.tab = QWidget() - self.tab.setObjectName(u"tab") + self.tab.setObjectName("tab") self.gridLayout_14 = QGridLayout(self.tab) - self.gridLayout_14.setObjectName(u"gridLayout_14") - self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.gridLayout_14.setObjectName("gridLayout_14") + self.verticalSpacer = QSpacerItem( + 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.gridLayout_14.addItem(self.verticalSpacer, 3, 0, 1, 1) self.groupBox_6 = QGroupBox(self.tab) - self.groupBox_6.setObjectName(u"groupBox_6") + self.groupBox_6.setObjectName("groupBox_6") self.gridLayout_16 = QGridLayout(self.groupBox_6) - self.gridLayout_16.setObjectName(u"gridLayout_16") + self.gridLayout_16.setObjectName("gridLayout_16") self.gridLayout_15 = QGridLayout() - self.gridLayout_15.setObjectName(u"gridLayout_15") + self.gridLayout_15.setObjectName("gridLayout_15") self.EnableEnterEvent = QCheckBox(self.groupBox_6) - self.EnableEnterEvent.setObjectName(u"EnableEnterEvent") + self.EnableEnterEvent.setObjectName("EnableEnterEvent") self.EnableEnterEvent.setChecked(True) self.gridLayout_15.addWidget(self.EnableEnterEvent, 0, 0, 1, 1) self.ScrollSpeed_Ribbon = QSlider(self.groupBox_6) - self.ScrollSpeed_Ribbon.setObjectName(u"ScrollSpeed_Ribbon") + self.ScrollSpeed_Ribbon.setObjectName("ScrollSpeed_Ribbon") self.ScrollSpeed_Ribbon.setMaximum(10) self.ScrollSpeed_Ribbon.setPageStep(1) self.ScrollSpeed_Ribbon.setValue(5) @@ -639,7 +732,7 @@ def setupUi(self, Settings): self.gridLayout_15.addWidget(self.ScrollSpeed_Ribbon, 2, 1, 1, 1) self.label_12 = QLabel(self.groupBox_6) - self.label_12.setObjectName(u"label_12") + self.label_12.setObjectName("label_12") sizePolicy8.setHeightForWidth(self.label_12.sizePolicy().hasHeightForWidth()) self.label_12.setSizePolicy(sizePolicy8) self.label_12.setMinimumSize(QSize(130, 0)) @@ -648,7 +741,7 @@ def setupUi(self, Settings): self.gridLayout_15.addWidget(self.label_12, 2, 0, 1, 1) self.label_13 = QLabel(self.groupBox_6) - self.label_13.setObjectName(u"label_13") + self.label_13.setObjectName("label_13") sizePolicy8.setHeightForWidth(self.label_13.sizePolicy().hasHeightForWidth()) self.label_13.setSizePolicy(sizePolicy8) self.label_13.setMinimumSize(QSize(130, 0)) @@ -657,11 +750,15 @@ def setupUi(self, Settings): self.gridLayout_15.addWidget(self.label_13, 1, 0, 1, 1) self.ScrollSpeed_TabBar = QSlider(self.groupBox_6) - self.ScrollSpeed_TabBar.setObjectName(u"ScrollSpeed_TabBar") - sizePolicy10 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) + self.ScrollSpeed_TabBar.setObjectName("ScrollSpeed_TabBar") + sizePolicy10 = QSizePolicy( + QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed + ) sizePolicy10.setHorizontalStretch(0) sizePolicy10.setVerticalStretch(0) - sizePolicy10.setHeightForWidth(self.ScrollSpeed_TabBar.sizePolicy().hasHeightForWidth()) + sizePolicy10.setHeightForWidth( + self.ScrollSpeed_TabBar.sizePolicy().hasHeightForWidth() + ) self.ScrollSpeed_TabBar.setSizePolicy(sizePolicy10) self.ScrollSpeed_TabBar.setMaximum(10) self.ScrollSpeed_TabBar.setSingleStep(1) @@ -674,14 +771,12 @@ def setupUi(self, Settings): self.gridLayout_15.addWidget(self.ScrollSpeed_TabBar, 1, 1, 1, 1) - self.gridLayout_16.addLayout(self.gridLayout_15, 0, 0, 1, 1) - self.gridLayout_14.addWidget(self.groupBox_6, 0, 0, 1, 1) self.label_41 = QLabel(self.tab) - self.label_41.setObjectName(u"label_41") + self.label_41.setObjectName("label_41") font2 = QFont() font2.setItalic(True) self.label_41.setFont(font2) @@ -689,14 +784,16 @@ def setupUi(self, Settings): self.gridLayout_14.addWidget(self.label_41, 2, 0, 1, 1) self.groupBox_7 = QGroupBox(self.tab) - self.groupBox_7.setObjectName(u"groupBox_7") + self.groupBox_7.setObjectName("groupBox_7") self.gridLayout_18 = QGridLayout(self.groupBox_7) - self.gridLayout_18.setObjectName(u"gridLayout_18") + self.gridLayout_18.setObjectName("gridLayout_18") self.gridLayout_17 = QGridLayout() - self.gridLayout_17.setObjectName(u"gridLayout_17") + self.gridLayout_17.setObjectName("gridLayout_17") self.ScrollClicks_TabBar = QSpinBox(self.groupBox_7) - self.ScrollClicks_TabBar.setObjectName(u"ScrollClicks_TabBar") - sizePolicy8.setHeightForWidth(self.ScrollClicks_TabBar.sizePolicy().hasHeightForWidth()) + self.ScrollClicks_TabBar.setObjectName("ScrollClicks_TabBar") + sizePolicy8.setHeightForWidth( + self.ScrollClicks_TabBar.sizePolicy().hasHeightForWidth() + ) self.ScrollClicks_TabBar.setSizePolicy(sizePolicy8) self.ScrollClicks_TabBar.setMinimumSize(QSize(50, 0)) self.ScrollClicks_TabBar.setSizeIncrement(QSize(0, 0)) @@ -704,8 +801,10 @@ def setupUi(self, Settings): self.ScrollClicks_TabBar.setFont(font1) self.ScrollClicks_TabBar.setFrame(True) self.ScrollClicks_TabBar.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.ScrollClicks_TabBar.setCorrectionMode(QAbstractSpinBox.CorrectionMode.CorrectToNearestValue) - self.ScrollClicks_TabBar.setProperty(u"showGroupSeparator", False) + self.ScrollClicks_TabBar.setCorrectionMode( + QAbstractSpinBox.CorrectionMode.CorrectToNearestValue + ) + self.ScrollClicks_TabBar.setProperty("showGroupSeparator", False) self.ScrollClicks_TabBar.setMinimum(0) self.ScrollClicks_TabBar.setMaximum(10) self.ScrollClicks_TabBar.setValue(1) @@ -714,7 +813,7 @@ def setupUi(self, Settings): self.gridLayout_17.addWidget(self.ScrollClicks_TabBar, 0, 1, 1, 1) self.label_14 = QLabel(self.groupBox_7) - self.label_14.setObjectName(u"label_14") + self.label_14.setObjectName("label_14") sizePolicy8.setHeightForWidth(self.label_14.sizePolicy().hasHeightForWidth()) self.label_14.setSizePolicy(sizePolicy8) self.label_14.setMinimumSize(QSize(130, 0)) @@ -723,14 +822,18 @@ def setupUi(self, Settings): self.gridLayout_17.addWidget(self.label_14, 1, 0, 1, 1) self.ScrollClicks_Ribbon = QSpinBox(self.groupBox_7) - self.ScrollClicks_Ribbon.setObjectName(u"ScrollClicks_Ribbon") - sizePolicy8.setHeightForWidth(self.ScrollClicks_Ribbon.sizePolicy().hasHeightForWidth()) + self.ScrollClicks_Ribbon.setObjectName("ScrollClicks_Ribbon") + sizePolicy8.setHeightForWidth( + self.ScrollClicks_Ribbon.sizePolicy().hasHeightForWidth() + ) self.ScrollClicks_Ribbon.setSizePolicy(sizePolicy8) self.ScrollClicks_Ribbon.setMinimumSize(QSize(50, 0)) self.ScrollClicks_Ribbon.setBaseSize(QSize(0, 0)) self.ScrollClicks_Ribbon.setFont(font1) self.ScrollClicks_Ribbon.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.ScrollClicks_Ribbon.setCorrectionMode(QAbstractSpinBox.CorrectionMode.CorrectToNearestValue) + self.ScrollClicks_Ribbon.setCorrectionMode( + QAbstractSpinBox.CorrectionMode.CorrectToNearestValue + ) self.ScrollClicks_Ribbon.setMaximum(10) self.ScrollClicks_Ribbon.setValue(1) self.ScrollClicks_Ribbon.setDisplayIntegerBase(10) @@ -738,7 +841,7 @@ def setupUi(self, Settings): self.gridLayout_17.addWidget(self.ScrollClicks_Ribbon, 1, 1, 1, 1) self.label_15 = QLabel(self.groupBox_7) - self.label_15.setObjectName(u"label_15") + self.label_15.setObjectName("label_15") sizePolicy8.setHeightForWidth(self.label_15.sizePolicy().hasHeightForWidth()) self.label_15.setSizePolicy(sizePolicy8) self.label_15.setMinimumSize(QSize(130, 0)) @@ -746,49 +849,53 @@ def setupUi(self, Settings): self.gridLayout_17.addWidget(self.label_15, 0, 0, 1, 1) - self.gridLayout_18.addLayout(self.gridLayout_17, 0, 0, 1, 1) - self.horizontalSpacer_4 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_4 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_18.addItem(self.horizontalSpacer_4, 0, 1, 1, 1) - self.gridLayout_14.addWidget(self.groupBox_7, 1, 0, 1, 1) self.tabWidget.addTab(self.tab, "") self.tab_2 = QWidget() - self.tab_2.setObjectName(u"tab_2") + self.tab_2.setObjectName("tab_2") self.gridLayout_19 = QGridLayout(self.tab_2) - self.gridLayout_19.setObjectName(u"gridLayout_19") + self.gridLayout_19.setObjectName("gridLayout_19") self.groupBox_9 = QGroupBox(self.tab_2) - self.groupBox_9.setObjectName(u"groupBox_9") + self.groupBox_9.setObjectName("groupBox_9") self.gridLayout_23 = QGridLayout(self.groupBox_9) - self.gridLayout_23.setObjectName(u"gridLayout_23") + self.gridLayout_23.setObjectName("gridLayout_23") self.CustomIcons = QCheckBox(self.groupBox_9) - self.CustomIcons.setObjectName(u"CustomIcons") + self.CustomIcons.setObjectName("CustomIcons") self.gridLayout_23.addWidget(self.CustomIcons, 0, 0, 1, 1) - self.horizontalSpacer_6 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_6 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_23.addItem(self.horizontalSpacer_6, 1, 1, 1, 1) self.IconS = QGroupBox(self.groupBox_9) - self.IconS.setObjectName(u"IconS") + self.IconS.setObjectName("IconS") self.IconS.setEnabled(False) self.gridLayout_33 = QGridLayout(self.IconS) - self.gridLayout_33.setObjectName(u"gridLayout_33") + self.gridLayout_33.setObjectName("gridLayout_33") self.gridLayout_22 = QGridLayout() - self.gridLayout_22.setObjectName(u"gridLayout_22") + self.gridLayout_22.setObjectName("gridLayout_22") self.label_16 = QLabel(self.IconS) - self.label_16.setObjectName(u"label_16") + self.label_16.setObjectName("label_16") self.gridLayout_22.addWidget(self.label_16, 0, 0, 1, 1) self.Tab_Scroll_Left = QPushButton(self.IconS) - self.Tab_Scroll_Left.setObjectName(u"Tab_Scroll_Left") - sizePolicy6.setHeightForWidth(self.Tab_Scroll_Left.sizePolicy().hasHeightForWidth()) + self.Tab_Scroll_Left.setObjectName("Tab_Scroll_Left") + sizePolicy6.setHeightForWidth( + self.Tab_Scroll_Left.sizePolicy().hasHeightForWidth() + ) self.Tab_Scroll_Left.setSizePolicy(sizePolicy6) self.Tab_Scroll_Left.setMinimumSize(QSize(10, 20)) self.Tab_Scroll_Left.setMaximumSize(QSize(20, 20)) @@ -797,13 +904,15 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.Tab_Scroll_Left, 0, 1, 1, 1) self.label_17 = QLabel(self.IconS) - self.label_17.setObjectName(u"label_17") + self.label_17.setObjectName("label_17") self.gridLayout_22.addWidget(self.label_17, 1, 0, 1, 1) self.Tab_Scroll_Right = QPushButton(self.IconS) - self.Tab_Scroll_Right.setObjectName(u"Tab_Scroll_Right") - sizePolicy6.setHeightForWidth(self.Tab_Scroll_Right.sizePolicy().hasHeightForWidth()) + self.Tab_Scroll_Right.setObjectName("Tab_Scroll_Right") + sizePolicy6.setHeightForWidth( + self.Tab_Scroll_Right.sizePolicy().hasHeightForWidth() + ) self.Tab_Scroll_Right.setSizePolicy(sizePolicy6) self.Tab_Scroll_Right.setMinimumSize(QSize(10, 20)) self.Tab_Scroll_Right.setMaximumSize(QSize(20, 20)) @@ -812,13 +921,15 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.Tab_Scroll_Right, 1, 1, 1, 1) self.label_18 = QLabel(self.IconS) - self.label_18.setObjectName(u"label_18") + self.label_18.setObjectName("label_18") self.gridLayout_22.addWidget(self.label_18, 2, 0, 1, 1) self.Ribbon_Scroll_Left = QPushButton(self.IconS) - self.Ribbon_Scroll_Left.setObjectName(u"Ribbon_Scroll_Left") - sizePolicy6.setHeightForWidth(self.Ribbon_Scroll_Left.sizePolicy().hasHeightForWidth()) + self.Ribbon_Scroll_Left.setObjectName("Ribbon_Scroll_Left") + sizePolicy6.setHeightForWidth( + self.Ribbon_Scroll_Left.sizePolicy().hasHeightForWidth() + ) self.Ribbon_Scroll_Left.setSizePolicy(sizePolicy6) self.Ribbon_Scroll_Left.setMinimumSize(QSize(20, 60)) self.Ribbon_Scroll_Left.setMaximumSize(QSize(20, 60)) @@ -826,13 +937,15 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.Ribbon_Scroll_Left, 2, 1, 1, 1) self.label_19 = QLabel(self.IconS) - self.label_19.setObjectName(u"label_19") + self.label_19.setObjectName("label_19") self.gridLayout_22.addWidget(self.label_19, 3, 0, 1, 1) self.Ribbon_Scroll_Right = QPushButton(self.IconS) - self.Ribbon_Scroll_Right.setObjectName(u"Ribbon_Scroll_Right") - sizePolicy6.setHeightForWidth(self.Ribbon_Scroll_Right.sizePolicy().hasHeightForWidth()) + self.Ribbon_Scroll_Right.setObjectName("Ribbon_Scroll_Right") + sizePolicy6.setHeightForWidth( + self.Ribbon_Scroll_Right.sizePolicy().hasHeightForWidth() + ) self.Ribbon_Scroll_Right.setSizePolicy(sizePolicy6) self.Ribbon_Scroll_Right.setMinimumSize(QSize(20, 60)) self.Ribbon_Scroll_Right.setMaximumSize(QSize(20, 60)) @@ -840,13 +953,15 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.Ribbon_Scroll_Right, 3, 1, 1, 1) self.label_20 = QLabel(self.IconS) - self.label_20.setObjectName(u"label_20") + self.label_20.setObjectName("label_20") self.gridLayout_22.addWidget(self.label_20, 4, 0, 1, 1) self.MoreCommands = QPushButton(self.IconS) - self.MoreCommands.setObjectName(u"MoreCommands") - sizePolicy6.setHeightForWidth(self.MoreCommands.sizePolicy().hasHeightForWidth()) + self.MoreCommands.setObjectName("MoreCommands") + sizePolicy6.setHeightForWidth( + self.MoreCommands.sizePolicy().hasHeightForWidth() + ) self.MoreCommands.setSizePolicy(sizePolicy6) self.MoreCommands.setMinimumSize(QSize(30, 20)) self.MoreCommands.setMaximumSize(QSize(30, 20)) @@ -855,13 +970,15 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.MoreCommands, 4, 1, 1, 1) self.label_28 = QLabel(self.IconS) - self.label_28.setObjectName(u"label_28") + self.label_28.setObjectName("label_28") self.gridLayout_22.addWidget(self.label_28, 5, 0, 1, 1) self.pinButton_open = QPushButton(self.IconS) - self.pinButton_open.setObjectName(u"pinButton_open") - sizePolicy6.setHeightForWidth(self.pinButton_open.sizePolicy().hasHeightForWidth()) + self.pinButton_open.setObjectName("pinButton_open") + sizePolicy6.setHeightForWidth( + self.pinButton_open.sizePolicy().hasHeightForWidth() + ) self.pinButton_open.setSizePolicy(sizePolicy6) self.pinButton_open.setMinimumSize(QSize(30, 30)) self.pinButton_open.setMaximumSize(QSize(30, 30)) @@ -869,13 +986,15 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.pinButton_open, 5, 1, 1, 1) self.label_29 = QLabel(self.IconS) - self.label_29.setObjectName(u"label_29") + self.label_29.setObjectName("label_29") self.gridLayout_22.addWidget(self.label_29, 6, 0, 1, 1) self.pinButton_closed = QPushButton(self.IconS) - self.pinButton_closed.setObjectName(u"pinButton_closed") - sizePolicy6.setHeightForWidth(self.pinButton_closed.sizePolicy().hasHeightForWidth()) + self.pinButton_closed.setObjectName("pinButton_closed") + sizePolicy6.setHeightForWidth( + self.pinButton_closed.sizePolicy().hasHeightForWidth() + ) self.pinButton_closed.setSizePolicy(sizePolicy6) self.pinButton_closed.setMinimumSize(QSize(30, 30)) self.pinButton_closed.setMaximumSize(QSize(30, 30)) @@ -883,43 +1002,42 @@ def setupUi(self, Settings): self.gridLayout_22.addWidget(self.pinButton_closed, 6, 1, 1, 1) - self.gridLayout_33.addLayout(self.gridLayout_22, 0, 0, 1, 1) - self.gridLayout_23.addWidget(self.IconS, 1, 0, 1, 1) - self.gridLayout_19.addWidget(self.groupBox_9, 1, 0, 1, 1) - self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.verticalSpacer_2 = QSpacerItem( + 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.gridLayout_19.addItem(self.verticalSpacer_2, 2, 0, 1, 1) self.groupBox_8 = QGroupBox(self.tab_2) - self.groupBox_8.setObjectName(u"groupBox_8") + self.groupBox_8.setObjectName("groupBox_8") self.gridLayout_21 = QGridLayout(self.groupBox_8) - self.gridLayout_21.setObjectName(u"gridLayout_21") + self.gridLayout_21.setObjectName("gridLayout_21") self.CustomColors = QCheckBox(self.groupBox_8) - self.CustomColors.setObjectName(u"CustomColors") + self.CustomColors.setObjectName("CustomColors") self.gridLayout_21.addWidget(self.CustomColors, 0, 0, 1, 1) self.ColorS = QGroupBox(self.groupBox_8) - self.ColorS.setObjectName(u"ColorS") + self.ColorS.setObjectName("ColorS") self.ColorS.setEnabled(False) self.gridLayout_35 = QGridLayout(self.ColorS) - self.gridLayout_35.setObjectName(u"gridLayout_35") + self.gridLayout_35.setObjectName("gridLayout_35") self.gridLayout_20 = QGridLayout() - self.gridLayout_20.setObjectName(u"gridLayout_20") + self.gridLayout_20.setObjectName("gridLayout_20") self.gridLayout_20.setVerticalSpacing(6) self.Color_Background_App = Gui_ColorButton(self.ColorS) - self.Color_Background_App.setObjectName(u"Color_Background_App") + self.Color_Background_App.setObjectName("Color_Background_App") self.gridLayout_20.addWidget(self.Color_Background_App, 2, 1, 1, 2) self.label_30 = QLabel(self.ColorS) - self.label_30.setObjectName(u"label_30") + self.label_30.setObjectName("label_30") self.label_30.setMinimumSize(QSize(200, 0)) self.label_30.setMaximumSize(QSize(200, 16777215)) self.label_30.setWordWrap(True) @@ -927,12 +1045,12 @@ def setupUi(self, Settings): self.gridLayout_20.addWidget(self.label_30, 1, 0, 1, 1) self.Color_Borders = Gui_ColorButton(self.ColorS) - self.Color_Borders.setObjectName(u"Color_Borders") + self.Color_Borders.setObjectName("Color_Borders") self.gridLayout_20.addWidget(self.Color_Borders, 0, 1, 1, 2) self.label_6 = QLabel(self.ColorS) - self.label_6.setObjectName(u"label_6") + self.label_6.setObjectName("label_6") self.label_6.setMinimumSize(QSize(200, 0)) self.label_6.setMaximumSize(QSize(300, 16777215)) self.label_6.setWordWrap(True) @@ -940,7 +1058,7 @@ def setupUi(self, Settings): self.gridLayout_20.addWidget(self.label_6, 0, 0, 1, 1) self.label_9 = QLabel(self.ColorS) - self.label_9.setObjectName(u"label_9") + self.label_9.setObjectName("label_9") self.label_9.setMinimumSize(QSize(200, 0)) self.label_9.setMaximumSize(QSize(200, 16777215)) self.label_9.setWordWrap(True) @@ -948,97 +1066,110 @@ def setupUi(self, Settings): self.gridLayout_20.addWidget(self.label_9, 2, 0, 1, 1) self.Color_Background_Hover = Gui_ColorButton(self.ColorS) - self.Color_Background_Hover.setObjectName(u"Color_Background_Hover") + self.Color_Background_Hover.setObjectName("Color_Background_Hover") self.gridLayout_20.addWidget(self.Color_Background_Hover, 1, 1, 1, 2) - self.gridLayout_35.addLayout(self.gridLayout_20, 0, 0, 1, 1) - self.horizontalSpacer_5 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_5 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_35.addItem(self.horizontalSpacer_5, 0, 2, 1, 1) - self.gridLayout_21.addWidget(self.ColorS, 2, 0, 1, 1) - self.verticalSpacer_4 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.verticalSpacer_4 = QSpacerItem( + 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.gridLayout_21.addItem(self.verticalSpacer_4, 2, 1, 1, 1) self.BorderTransparant = QCheckBox(self.groupBox_8) - self.BorderTransparant.setObjectName(u"BorderTransparant") + self.BorderTransparant.setObjectName("BorderTransparant") self.gridLayout_21.addWidget(self.BorderTransparant, 1, 0, 1, 1) - self.gridLayout_19.addWidget(self.groupBox_8, 0, 0, 1, 1) self.tabWidget.addTab(self.tab_2, "") self.tab_3 = QWidget() - self.tab_3.setObjectName(u"tab_3") + self.tab_3.setObjectName("tab_3") self.gridLayout_34 = QGridLayout(self.tab_3) - self.gridLayout_34.setObjectName(u"gridLayout_34") + self.gridLayout_34.setObjectName("gridLayout_34") self.EnableOverlay = QGroupBox(self.tab_3) - self.EnableOverlay.setObjectName(u"EnableOverlay") - sizePolicy4.setHeightForWidth(self.EnableOverlay.sizePolicy().hasHeightForWidth()) + self.EnableOverlay.setObjectName("EnableOverlay") + sizePolicy4.setHeightForWidth( + self.EnableOverlay.sizePolicy().hasHeightForWidth() + ) self.EnableOverlay.setSizePolicy(sizePolicy4) self.EnableOverlay.setCheckable(True) self.gridLayout_32 = QGridLayout(self.EnableOverlay) - self.gridLayout_32.setObjectName(u"gridLayout_32") + self.gridLayout_32.setObjectName("gridLayout_32") self.gridLayout_30 = QGridLayout() - self.gridLayout_30.setObjectName(u"gridLayout_30") + self.gridLayout_30.setObjectName("gridLayout_30") self.FCOverlayEnabled = QCheckBox(self.EnableOverlay) - self.FCOverlayEnabled.setObjectName(u"FCOverlayEnabled") + self.FCOverlayEnabled.setObjectName("FCOverlayEnabled") self.FCOverlayEnabled.setChecked(False) self.gridLayout_30.addWidget(self.FCOverlayEnabled, 1, 0, 1, 1) self.UseButtonBackGround = QCheckBox(self.EnableOverlay) - self.UseButtonBackGround.setObjectName(u"UseButtonBackGround") + self.UseButtonBackGround.setObjectName("UseButtonBackGround") self.UseButtonBackGround.setEnabled(False) self.gridLayout_30.addWidget(self.UseButtonBackGround, 2, 0, 1, 1) - self.verticalSpacer_6 = QSpacerItem(20, 1, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.verticalSpacer_6 = QSpacerItem( + 20, 1, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.gridLayout_30.addItem(self.verticalSpacer_6, 3, 0, 1, 1) self.label_26 = QLabel(self.EnableOverlay) - self.label_26.setObjectName(u"label_26") + self.label_26.setObjectName("label_26") self.label_26.setEnabled(False) - sizePolicy11 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding) + sizePolicy11 = QSizePolicy( + QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding + ) sizePolicy11.setHorizontalStretch(0) sizePolicy11.setVerticalStretch(0) sizePolicy11.setHeightForWidth(self.label_26.sizePolicy().hasHeightForWidth()) self.label_26.setSizePolicy(sizePolicy11) - self.label_26.setAlignment(Qt.AlignmentFlag.AlignLeading|Qt.AlignmentFlag.AlignLeft|Qt.AlignmentFlag.AlignTop) + self.label_26.setAlignment( + Qt.AlignmentFlag.AlignLeading + | Qt.AlignmentFlag.AlignLeft + | Qt.AlignmentFlag.AlignTop + ) self.label_26.setWordWrap(True) self.gridLayout_30.addWidget(self.label_26, 0, 1, 4, 2) - self.gridLayout_32.addLayout(self.gridLayout_30, 0, 0, 2, 2) - self.horizontalSpacer_10 = QSpacerItem(80, 20, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_10 = QSpacerItem( + 80, 20, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum + ) self.gridLayout_32.addItem(self.horizontalSpacer_10, 0, 2, 1, 1) - self.gridLayout_34.addWidget(self.EnableOverlay, 1, 0, 2, 2) self.groupBox_11 = QGroupBox(self.tab_3) - self.groupBox_11.setObjectName(u"groupBox_11") + self.groupBox_11.setObjectName("groupBox_11") self.gridLayout_29 = QGridLayout(self.groupBox_11) - self.gridLayout_29.setObjectName(u"gridLayout_29") - self.horizontalSpacer_8 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.gridLayout_29.setObjectName("gridLayout_29") + self.horizontalSpacer_8 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_29.addItem(self.horizontalSpacer_8, 0, 1, 1, 1) self.gridLayout_27 = QGridLayout() - self.gridLayout_27.setObjectName(u"gridLayout_27") + self.gridLayout_27.setObjectName("gridLayout_27") self.label_27 = QLabel(self.groupBox_11) - self.label_27.setObjectName(u"label_27") + self.label_27.setObjectName("label_27") self.gridLayout_27.addWidget(self.label_27, 0, 0, 1, 1) @@ -1047,29 +1178,28 @@ def setupUi(self, Settings): self.PreferedViewPanel.addItem("") self.PreferedViewPanel.addItem("") self.PreferedViewPanel.addItem("") - self.PreferedViewPanel.setObjectName(u"PreferedViewPanel") + self.PreferedViewPanel.setObjectName("PreferedViewPanel") self.PreferedViewPanel.setMinimumSize(QSize(200, 0)) self.gridLayout_27.addWidget(self.PreferedViewPanel, 0, 1, 1, 1) - self.gridLayout_29.addLayout(self.gridLayout_27, 0, 0, 1, 1) self.gridLayout_31 = QGridLayout() - self.gridLayout_31.setObjectName(u"gridLayout_31") + self.gridLayout_31.setObjectName("gridLayout_31") self.EnableToolsPanel = QCheckBox(self.groupBox_11) - self.EnableToolsPanel.setObjectName(u"EnableToolsPanel") + self.EnableToolsPanel.setObjectName("EnableToolsPanel") self.EnableToolsPanel.setChecked(True) self.gridLayout_31.addWidget(self.EnableToolsPanel, 0, 0, 1, 1) - self.gridLayout_29.addLayout(self.gridLayout_31, 1, 0, 1, 1) - self.gridLayout_34.addWidget(self.groupBox_11, 0, 0, 1, 1) - self.verticalSpacer_3 = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding) + self.verticalSpacer_3 = QSpacerItem( + 20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding + ) self.gridLayout_34.addItem(self.verticalSpacer_3, 3, 0, 1, 1) @@ -1081,43 +1211,44 @@ def setupUi(self, Settings): self.gridLayout_6.addWidget(self.scrollArea, 0, 0, 1, 3) - self.gridLayout_36.addLayout(self.gridLayout_6, 0, 0, 1, 1) self.gridLayout_7 = QGridLayout() - self.gridLayout_7.setObjectName(u"gridLayout_7") + self.gridLayout_7.setObjectName("gridLayout_7") self.Cancel = QPushButton(Settings) - self.Cancel.setObjectName(u"Cancel") + self.Cancel.setObjectName("Cancel") self.gridLayout_7.addWidget(self.Cancel, 0, 3, 1, 1) - self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_2 = QSpacerItem( + 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum + ) self.gridLayout_7.addItem(self.horizontalSpacer_2, 0, 1, 1, 1) - self.horizontalSpacer_11 = QSpacerItem(10, 20, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum) + self.horizontalSpacer_11 = QSpacerItem( + 10, 20, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Minimum + ) self.gridLayout_7.addItem(self.horizontalSpacer_11, 0, 4, 1, 1) self.Reset = QPushButton(Settings) - self.Reset.setObjectName(u"Reset") + self.Reset.setObjectName("Reset") self.gridLayout_7.addWidget(self.Reset, 0, 0, 1, 1) self.GenerateJsonExit = QPushButton(Settings) - self.GenerateJsonExit.setObjectName(u"GenerateJsonExit") + self.GenerateJsonExit.setObjectName("GenerateJsonExit") self.gridLayout_7.addWidget(self.GenerateJsonExit, 0, 2, 1, 1) self.HelpButton = QToolButton(Settings) - self.HelpButton.setObjectName(u"HelpButton") + self.HelpButton.setObjectName("HelpButton") self.gridLayout_7.addWidget(self.HelpButton, 0, 5, 1, 1) - self.gridLayout_36.addLayout(self.gridLayout_7, 1, 0, 1, 1) - self.retranslateUi(Settings) self.EnableBackup.toggled.connect(self.groupBox_Backup.setEnabled) self.CustomColors.toggled.connect(self.ColorS.setEnabled) @@ -1129,118 +1260,365 @@ def setupUi(self, Settings): self.tabWidget.setCurrentIndex(3) - QMetaObject.connectSlotsByName(Settings) + # setupUi def retranslateUi(self, Settings): - Settings.setWindowTitle(QCoreApplication.translate("Settings", u"Preferences", None)) - self.groupBox.setTitle(QCoreApplication.translate("Settings", u"Backup settings", None)) - self.EnableBackup.setText(QCoreApplication.translate("Settings", u"Create backup", None)) - self.groupBox_Backup.setTitle(QCoreApplication.translate("Settings", u"Backup location", None)) - self.label_4.setText(QCoreApplication.translate("Settings", u"...\\", None)) - self.BackUpLocation.setText(QCoreApplication.translate("Settings", u"Browse...", None)) - self.groupBox1.setTitle(QCoreApplication.translate("Settings", u"Ribbon settings", None)) - self.groupBox_3.setTitle(QCoreApplication.translate("Settings", u"Show text", None)) - self.ShowText_Medium.setText(QCoreApplication.translate("Settings", u"Medium buttons", None)) - self.EnableWrap_Large.setText(QCoreApplication.translate("Settings", u"Enable text wrap", None)) - self.ShowText_Large.setText(QCoreApplication.translate("Settings", u"Large buttons", None)) - self.ShowText_Small.setText(QCoreApplication.translate("Settings", u"Small buttons", None)) - self.EnableWrap_Medium.setText(QCoreApplication.translate("Settings", u"Enable text wrap", None)) - self.groupBox_10.setTitle(QCoreApplication.translate("Settings", u"Tab style", None)) - self.ToolbarPositions.setItemText(0, QCoreApplication.translate("Settings", u"Toolbars above tabbar", None)) - self.ToolbarPositions.setItemText(1, QCoreApplication.translate("Settings", u"Toolbars inline with tabbar", None)) - - self.ToolbarPositions.setCurrentText(QCoreApplication.translate("Settings", u"Toolbars above tabbar", None)) - self.HideTitleBarFC.setText(QCoreApplication.translate("Settings", u"Hide the titlebar of FreeCAD", None)) - self.TabbarStyle.setItemText(0, QCoreApplication.translate("Settings", u"Icon + text", None)) - self.TabbarStyle.setItemText(1, QCoreApplication.translate("Settings", u"Icon only", None)) - self.TabbarStyle.setItemText(2, QCoreApplication.translate("Settings", u"Text only", None)) - - self.TabbarStyle.setCurrentText(QCoreApplication.translate("Settings", u"Icon + text", None)) - self.label_24.setText(QCoreApplication.translate("Settings", u"

Set the tab style:

", None)) - self.label_36.setText(QCoreApplication.translate("Settings", u"

Set the toolbar positions:

", None)) - self.label_8.setText(QCoreApplication.translate("Settings", u"

For linux users: When running under Wayland, you have to set a window rule to hide the titlebar or change your theme! See " Wayland workaround" for an example.

", None)) - self.groupBox_4.setTitle(QCoreApplication.translate("Settings", u"Button size", None)) - self.label_23.setText(QCoreApplication.translate("Settings", u"Size of tabbar tabs:", None)) - self.label_22.setText(QCoreApplication.translate("Settings", u"Size of right toolbar buttons:", None)) - self.label_5.setText(QCoreApplication.translate("Settings", u"Size of application button:", None)) - self.label_10.setText(QCoreApplication.translate("Settings", u"Size of small buttons:", None)) - self.label_21.setText(QCoreApplication.translate("Settings", u"

Size of quick access toolbar buttons:

", None)) - self.label_11.setText(QCoreApplication.translate("Settings", u"Size of medium buttons:", None)) - self.label_25.setText(QCoreApplication.translate("Settings", u"Size of large buttons:", None)) - self.groupBox_5.setTitle(QCoreApplication.translate("Settings", u"Panels", None)) - self.label.setText(QCoreApplication.translate("Settings", u"No. of columns per panel:", None)) - self.label_2.setText(QCoreApplication.translate("Settings", u"

Set to '0' to disable the maximum of columns

", None)) - self.groupBox_14.setTitle(QCoreApplication.translate("Settings", u"Text size", None)) - self.label_32.setText(QCoreApplication.translate("Settings", u"Text size of menus", None)) - self.label_34.setText(QCoreApplication.translate("Settings", u"Text size of tabs", None)) - self.label_35.setText(QCoreApplication.translate("Settings", u"Text size of panel titles", None)) - self.label_33.setText(QCoreApplication.translate("Settings", u"Text size of buttons", None)) - self.groupBox_2.setTitle(QCoreApplication.translate("Settings", u"Select stylesheet", None)) - self.label_7.setText(QCoreApplication.translate("Settings", u"...\\", None)) - self.StyleSheetLocation.setText(QCoreApplication.translate("Settings", u"Browse...", None)) - self.DebugMode.setText(QCoreApplication.translate("Settings", u"Debug mode", None)) - self.label_3.setText(QCoreApplication.translate("Settings", u"

Debug mode enables extra reports in the report view for debugging purposes.

", None)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.General), QCoreApplication.translate("Settings", u"General", None)) - self.groupBox_6.setTitle(QCoreApplication.translate("Settings", u"Mouse settings", None)) - self.EnableEnterEvent.setText(QCoreApplication.translate("Settings", u"Show ribbon on hover. ", None)) - self.label_12.setText(QCoreApplication.translate("Settings", u"

Scroll speed for ribbon:

", None)) - self.label_13.setText(QCoreApplication.translate("Settings", u"

Scroll speed for tab bar:

", None)) - self.label_41.setText(QCoreApplication.translate("Settings", u"Commands are now implemented in FreeCAD. Use the \"Tools->Customize...\" menu to set shortcuts.", None)) - self.groupBox_7.setTitle(QCoreApplication.translate("Settings", u"Scroll buttons", None)) - self.label_14.setText(QCoreApplication.translate("Settings", u"

Scroll steps per click for ribbon:

", None)) - self.label_15.setText(QCoreApplication.translate("Settings", u"

Scroll steps per click for tab bar:

", None)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("Settings", u"Navigation", None)) - self.groupBox_9.setTitle(QCoreApplication.translate("Settings", u"Icons", None)) - self.CustomIcons.setText(QCoreApplication.translate("Settings", u"Enable custom icons", None)) - self.label_16.setText(QCoreApplication.translate("Settings", u"

Tab bar scroll left:

", None)) + Settings.setWindowTitle( + QCoreApplication.translate("Settings", "Preferences", None) + ) + self.groupBox.setTitle( + QCoreApplication.translate("Settings", "Backup settings", None) + ) + self.EnableBackup.setText( + QCoreApplication.translate("Settings", "Create backup", None) + ) + self.groupBox_Backup.setTitle( + QCoreApplication.translate("Settings", "Backup location", None) + ) + self.label_4.setText(QCoreApplication.translate("Settings", "...\\", None)) + self.BackUpLocation.setText( + QCoreApplication.translate("Settings", "Browse...", None) + ) + self.groupBox1.setTitle( + QCoreApplication.translate("Settings", "Ribbon settings", None) + ) + self.groupBox_3.setTitle( + QCoreApplication.translate("Settings", "Show text", None) + ) + self.ShowText_Medium.setText( + QCoreApplication.translate("Settings", "Medium buttons", None) + ) + self.EnableWrap_Large.setText( + QCoreApplication.translate("Settings", "Enable text wrap", None) + ) + self.ShowText_Large.setText( + QCoreApplication.translate("Settings", "Large buttons", None) + ) + self.ShowText_Small.setText( + QCoreApplication.translate("Settings", "Small buttons", None) + ) + self.EnableWrap_Medium.setText( + QCoreApplication.translate("Settings", "Enable text wrap", None) + ) + self.groupBox_10.setTitle( + QCoreApplication.translate("Settings", "Tab style", None) + ) + self.ToolbarPositions.setItemText( + 0, QCoreApplication.translate("Settings", "Toolbars above tabbar", None) + ) + self.ToolbarPositions.setItemText( + 1, + QCoreApplication.translate("Settings", "Toolbars inline with tabbar", None), + ) + + self.ToolbarPositions.setCurrentText( + QCoreApplication.translate("Settings", "Toolbars above tabbar", None) + ) + self.HideTitleBarFC.setText( + QCoreApplication.translate("Settings", "Hide the titlebar of FreeCAD", None) + ) + self.TabbarStyle.setItemText( + 0, QCoreApplication.translate("Settings", "Icon + text", None) + ) + self.TabbarStyle.setItemText( + 1, QCoreApplication.translate("Settings", "Icon only", None) + ) + self.TabbarStyle.setItemText( + 2, QCoreApplication.translate("Settings", "Text only", None) + ) + + self.TabbarStyle.setCurrentText( + QCoreApplication.translate("Settings", "Icon + text", None) + ) + self.label_24.setText( + QCoreApplication.translate( + "Settings", + "

Set the tab style:

", + None, + ) + ) + self.label_36.setText( + QCoreApplication.translate( + "Settings", + "

Set the toolbar positions:

", + None, + ) + ) + self.label_8.setText( + QCoreApplication.translate( + "Settings", + '

For linux users: When running under Wayland, you have to set a window rule to hide the titlebar or change your theme! See " Wayland workaround" for an example.

', + None, + ) + ) + self.groupBox_4.setTitle( + QCoreApplication.translate("Settings", "Button size", None) + ) + self.label_23.setText( + QCoreApplication.translate("Settings", "Size of tabbar tabs:", None) + ) + self.label_22.setText( + QCoreApplication.translate( + "Settings", "Size of right toolbar buttons:", None + ) + ) + self.label_5.setText( + QCoreApplication.translate("Settings", "Size of application button:", None) + ) + self.label_10.setText( + QCoreApplication.translate("Settings", "Size of small buttons:", None) + ) + self.label_21.setText( + QCoreApplication.translate( + "Settings", + "

Size of quick access toolbar buttons:

", + None, + ) + ) + self.label_11.setText( + QCoreApplication.translate("Settings", "Size of medium buttons:", None) + ) + self.label_25.setText( + QCoreApplication.translate("Settings", "Size of large buttons:", None) + ) + self.groupBox_5.setTitle(QCoreApplication.translate("Settings", "Panels", None)) + self.label.setText( + QCoreApplication.translate("Settings", "No. of columns per panel:", None) + ) + self.label_2.setText( + QCoreApplication.translate( + "Settings", + "

Set to '0' to disable the maximum of columns

", + None, + ) + ) + self.groupBox_14.setTitle( + QCoreApplication.translate("Settings", "Text size", None) + ) + self.label_32.setText( + QCoreApplication.translate("Settings", "Text size of menus", None) + ) + self.label_34.setText( + QCoreApplication.translate("Settings", "Text size of tabs", None) + ) + self.label_35.setText( + QCoreApplication.translate("Settings", "Text size of panel titles", None) + ) + self.label_33.setText( + QCoreApplication.translate("Settings", "Text size of buttons", None) + ) + self.groupBox_2.setTitle( + QCoreApplication.translate("Settings", "Select stylesheet", None) + ) + self.label_7.setText(QCoreApplication.translate("Settings", "...\\", None)) + self.StyleSheetLocation.setText( + QCoreApplication.translate("Settings", "Browse...", None) + ) + self.DebugMode.setText( + QCoreApplication.translate("Settings", "Debug mode", None) + ) + self.label_3.setText( + QCoreApplication.translate( + "Settings", + '

Debug mode enables extra reports in the report view for debugging purposes.

', + None, + ) + ) + self.tabWidget.setTabText( + self.tabWidget.indexOf(self.General), + QCoreApplication.translate("Settings", "General", None), + ) + self.groupBox_6.setTitle( + QCoreApplication.translate("Settings", "Mouse settings", None) + ) + self.EnableEnterEvent.setText( + QCoreApplication.translate("Settings", "Show ribbon on hover. ", None) + ) + self.label_12.setText( + QCoreApplication.translate( + "Settings", + "

Scroll speed for ribbon:

", + None, + ) + ) + self.label_13.setText( + QCoreApplication.translate( + "Settings", + "

Scroll speed for tab bar:

", + None, + ) + ) + self.label_41.setText( + QCoreApplication.translate( + "Settings", + 'Commands are now implemented in FreeCAD. Use the "Tools->Customize..." menu to set shortcuts.', + None, + ) + ) + self.groupBox_7.setTitle( + QCoreApplication.translate("Settings", "Scroll buttons", None) + ) + self.label_14.setText( + QCoreApplication.translate( + "Settings", + "

Scroll steps per click for ribbon:

", + None, + ) + ) + self.label_15.setText( + QCoreApplication.translate( + "Settings", + "

Scroll steps per click for tab bar:

", + None, + ) + ) + self.tabWidget.setTabText( + self.tabWidget.indexOf(self.tab), + QCoreApplication.translate("Settings", "Navigation", None), + ) + self.groupBox_9.setTitle(QCoreApplication.translate("Settings", "Icons", None)) + self.CustomIcons.setText( + QCoreApplication.translate("Settings", "Enable custom icons", None) + ) + self.label_16.setText( + QCoreApplication.translate( + "Settings", + "

Tab bar scroll left:

", + None, + ) + ) self.Tab_Scroll_Left.setText("") - self.label_17.setText(QCoreApplication.translate("Settings", u"Tab bar scroll right:", None)) + self.label_17.setText( + QCoreApplication.translate("Settings", "Tab bar scroll right:", None) + ) self.Tab_Scroll_Right.setText("") - self.label_18.setText(QCoreApplication.translate("Settings", u"Ribbon bar scroll left:", None)) + self.label_18.setText( + QCoreApplication.translate("Settings", "Ribbon bar scroll left:", None) + ) self.Ribbon_Scroll_Left.setText("") - self.label_19.setText(QCoreApplication.translate("Settings", u"

Ribbon bar scroll right:

", None)) + self.label_19.setText( + QCoreApplication.translate( + "Settings", + "

Ribbon bar scroll right:

", + None, + ) + ) self.Ribbon_Scroll_Right.setText("") - self.label_20.setText(QCoreApplication.translate("Settings", u"

More commands button:

", None)) + self.label_20.setText( + QCoreApplication.translate( + "Settings", + "

More commands button:

", + None, + ) + ) self.MoreCommands.setText("") - self.label_28.setText(QCoreApplication.translate("Settings", u"Pin button - unpinned:", None)) + self.label_28.setText( + QCoreApplication.translate("Settings", "Pin button - unpinned:", None) + ) self.pinButton_open.setText("") - self.label_29.setText(QCoreApplication.translate("Settings", u"Pin button - pinned:", None)) + self.label_29.setText( + QCoreApplication.translate("Settings", "Pin button - pinned:", None) + ) self.pinButton_closed.setText("") - self.groupBox_8.setTitle(QCoreApplication.translate("Settings", u"Colors", None)) - self.CustomColors.setText(QCoreApplication.translate("Settings", u"Enable custom colors", None)) - self.label_30.setText(QCoreApplication.translate("Settings", u"Set the color for buttons when hovering over them", None)) - self.label_6.setText(QCoreApplication.translate("Settings", u"Set the color for control borders when hovering over them:", None)) - self.label_9.setText(QCoreApplication.translate("Settings", u"Set the background color for the application button:", None)) - self.BorderTransparant.setText(QCoreApplication.translate("Settings", u"Set border invisible for ribbon buttons", None)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("Settings", u"Colors and icons", None)) - self.EnableOverlay.setTitle(QCoreApplication.translate("Settings", u"Enable overlay", None)) -#if QT_CONFIG(tooltip) - self.FCOverlayEnabled.setToolTip(QCoreApplication.translate("Settings", u"Use the overlay function from FreeCAD.\n" -"Uncheck this when there are issues with the overlay function and the FreeCAD Ribbon.", None)) -#endif // QT_CONFIG(tooltip) - self.FCOverlayEnabled.setText(QCoreApplication.translate("Settings", u"Use FreeCAD's overlay function.", None)) - self.UseButtonBackGround.setText(QCoreApplication.translate("Settings", u"Use background on buttons", None)) - self.label_26.setText(QCoreApplication.translate("Settings", u"

The FreeCAD overlay function can give issues. Use at your own risk. Few functions are disabled when using the FreeCAD overlay function.

When there are issues, place a file "OVERLAY_DISABLED" in the folder of the add-on. (No extension) This will restore the ribbon and its own overlay function.

", None)) - self.groupBox_11.setTitle(QCoreApplication.translate("Settings", u"Standard panels preference", None)) - self.label_27.setText(QCoreApplication.translate("Settings", u"Select preferred standard view panel: ", None)) - self.PreferedViewPanel.setItemText(0, QCoreApplication.translate("Settings", u"Individual views - Native", None)) - self.PreferedViewPanel.setItemText(1, QCoreApplication.translate("Settings", u"Views - Native", None)) - self.PreferedViewPanel.setItemText(2, QCoreApplication.translate("Settings", u"Views - Ribbon", None)) - self.PreferedViewPanel.setItemText(3, QCoreApplication.translate("Settings", u"None", None)) - - self.EnableToolsPanel.setText(QCoreApplication.translate("Settings", u"Use standard Tools panel", None)) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QCoreApplication.translate("Settings", u"Miscellaneous", None)) - self.Cancel.setText(QCoreApplication.translate("Settings", u"Cancel", None)) -#if QT_CONFIG(shortcut) - self.Cancel.setShortcut(QCoreApplication.translate("Settings", u"Esc", None)) -#endif // QT_CONFIG(shortcut) - self.Reset.setText(QCoreApplication.translate("Settings", u"Reset", None)) - self.GenerateJsonExit.setText(QCoreApplication.translate("Settings", u"Close", None)) -#if QT_CONFIG(shortcut) + self.groupBox_8.setTitle(QCoreApplication.translate("Settings", "Colors", None)) + self.CustomColors.setText( + QCoreApplication.translate("Settings", "Enable custom colors", None) + ) + self.label_30.setText( + QCoreApplication.translate( + "Settings", "Set the color for buttons when hovering over them", None + ) + ) + self.label_6.setText( + QCoreApplication.translate( + "Settings", + "Set the color for control borders when hovering over them:", + None, + ) + ) + self.label_9.setText( + QCoreApplication.translate( + "Settings", "Set the background color for the application button:", None + ) + ) + self.BorderTransparant.setText( + QCoreApplication.translate( + "Settings", "Set border invisible for ribbon buttons", None + ) + ) + self.tabWidget.setTabText( + self.tabWidget.indexOf(self.tab_2), + QCoreApplication.translate("Settings", "Colors and icons", None), + ) + self.EnableOverlay.setTitle( + QCoreApplication.translate("Settings", "Enable overlay", None) + ) + # if QT_CONFIG(tooltip) + self.FCOverlayEnabled.setToolTip( + QCoreApplication.translate( + "Settings", + "Use the overlay function from FreeCAD.\n" + "Uncheck this when there are issues with the overlay function and the FreeCAD Ribbon.", + None, + ) + ) + # endif // QT_CONFIG(tooltip) + self.FCOverlayEnabled.setText( + QCoreApplication.translate( + "Settings", "Use FreeCAD's overlay function.", None + ) + ) + self.UseButtonBackGround.setText( + QCoreApplication.translate("Settings", "Use background on buttons", None) + ) + self.label_26.setText( + QCoreApplication.translate( + "Settings", + "

The FreeCAD overlay function can give issues. Use at your own risk. Few functions are disabled when using the FreeCAD overlay function.

When there are issues, place a file "OVERLAY_DISABLED" in the folder of the add-on. (No extension) This will restore the ribbon and its own overlay function.

", + None, + ) + ) + self.groupBox_11.setTitle( + QCoreApplication.translate("Settings", "Standard panels preference", None) + ) + self.label_27.setText( + QCoreApplication.translate( + "Settings", "Select preferred standard view panel: ", None + ) + ) + self.PreferedViewPanel.setItemText( + 0, QCoreApplication.translate("Settings", "Individual views - Native", None) + ) + self.PreferedViewPanel.setItemText( + 1, QCoreApplication.translate("Settings", "Views - Native", None) + ) + self.PreferedViewPanel.setItemText( + 2, QCoreApplication.translate("Settings", "Views - Ribbon", None) + ) + self.PreferedViewPanel.setItemText( + 3, QCoreApplication.translate("Settings", "None", None) + ) + + self.EnableToolsPanel.setText( + QCoreApplication.translate("Settings", "Use standard Tools panel", None) + ) + self.tabWidget.setTabText( + self.tabWidget.indexOf(self.tab_3), + QCoreApplication.translate("Settings", "Miscellaneous", None), + ) + self.Cancel.setText(QCoreApplication.translate("Settings", "Cancel", None)) + # if QT_CONFIG(shortcut) + self.Cancel.setShortcut(QCoreApplication.translate("Settings", "Esc", None)) + # endif // QT_CONFIG(shortcut) + self.Reset.setText(QCoreApplication.translate("Settings", "Reset", None)) + self.GenerateJsonExit.setText( + QCoreApplication.translate("Settings", "Close", None) + ) + # if QT_CONFIG(shortcut) self.GenerateJsonExit.setShortcut("") -#endif // QT_CONFIG(shortcut) - self.HelpButton.setText(QCoreApplication.translate("Settings", u"...", None)) - # retranslateUi + # endif // QT_CONFIG(shortcut) + self.HelpButton.setText(QCoreApplication.translate("Settings", "...", None)) + # retranslateUi diff --git a/Scripts/UpdatePanelNames.py b/Scripts/UpdatePanelNames.py index 0801f46c..ef2cae5f 100644 --- a/Scripts/UpdatePanelNames.py +++ b/Scripts/UpdatePanelNames.py @@ -30,10 +30,10 @@ # Fill the correction list -> {workbenchname [[new toolbar, old toolbar], [new toolbar, old toolbar]]} CorrectionList = { "PartDesignWorkbench": [ - ['Part Design Helper Features', "Part Design Helper"], - ['Part Design Modeling Features', "Part Design Modeling"], - ['Part Design Dress-Up Features', "Part Design Derssup"], - ['Part Design Transformation Features', "Part Design Patterns"], + ["Part Design Helper Features", "Part Design Helper"], + ["Part Design Modeling Features", "Part Design Modeling"], + ["Part Design Dress-Up Features", "Part Design Derssup"], + ["Part Design Transformation Features", "Part Design Patterns"], ] } @@ -65,8 +65,8 @@ # If the toolbars match, update the json file Dict: dict = RibbonStructure["workbenches"][WorkBench]["toolbars"] if ToolBarToCorrect[1] == toolbar: - Dict.update({ToolBarToCorrect[0]: Dict.pop(toolbar)}) - + Dict.update({ToolBarToCorrect[0]: Dict.pop(toolbar)}) + # Write it to disk with open(JsonFile, "w") as outfile: diff --git a/Standard_Functions_Ribbon.py b/Standard_Functions_Ribbon.py index ece732fd..12cfc088 100644 --- a/Standard_Functions_Ribbon.py +++ b/Standard_Functions_Ribbon.py @@ -249,30 +249,32 @@ def SaveDialog(files, OverWrite: bool = True): if file is not None: return file + def OpenDirectory(path): import webbrowser import platform import subprocess import os - + try: if os.path.exists(path) is False: return False - + if platform.system().lower() == "darwin": - subprocess.run(['open', path]) + subprocess.run(["open", path]) elif platform.system().lower() == "Windows": os.startfile(path) else: - # Linux: try xdg-open, then sensible-browser as fallback - try: - subprocess.run(['xdg-open', path], check=True) - except Exception: - subprocess.run(['gio', 'open', path], check=False) + # Linux: try xdg-open, then sensible-browser as fallback + try: + subprocess.run(["xdg-open", path], check=True) + except Exception: + subprocess.run(["gio", "open", path], check=False) return True except Exception: return False + def GetLetterFromNumber(number: int, UCase: bool = True): """Number to Excel-style column name, e.g., 1 = A, 26 = Z, 27 = AA, 703 = AAA.""" Letter = "" @@ -532,9 +534,9 @@ def ReturnXML_Value_Git( # parsing process url = f"{host}/{User}/{Repository}/{Branch}/{File}" if host == "https://codeberg.org": - url = f"{host}/{User}/{Repository}/src/branch/{Branch}/{File}" + url = f"{host}/{User}/{Repository}/src/branch/{Branch}/{File}" if host == "https://github.com": - url = f"{host}/{User}/{Repository}/blob/{Branch}/{File}" + url = f"{host}/{User}/{Repository}/blob/{Branch}/{File}" url = "https://raw.githubusercontent.com/APEbbers/FreeCAD-Ribbon/refs/heads/main/package.xml" response = request.urlopen(url) data = response.read() @@ -729,7 +731,7 @@ def TranslationsMapping(WorkBenchName: str, string: str): # self.Dict_RibbonCommandPanel, # ["workbenches", WorkBenchName, "toolbars", Toolbar, "order"], # ) -def add_keys_nested_dict(dict, keys, default=1, endEmpty = False): +def add_keys_nested_dict(dict, keys, default=1, endEmpty=False): """_summary_ Args: @@ -971,7 +973,7 @@ def AddToClipboard(Text): # cmd = "clip" if platform.system() == "Windows" else "pbcopy" # subprocess.run(cmd, input=Text, text=True, shell=True) - + clipboard = QtWidgets.QApplication.clipboard() clipboard.setText(Text) @@ -987,7 +989,7 @@ def checkFreeCADVersion(main: int, sub: int, patch: int, git: int): Returns: True if the FreeCAD version is equal or higher than the given version number. - """ + """ version = App.Version() if main <= int(version[0]): diff --git a/StyleMapping_Ribbon.py b/StyleMapping_Ribbon.py index e3997728..47a83942 100644 --- a/StyleMapping_Ribbon.py +++ b/StyleMapping_Ribbon.py @@ -55,24 +55,25 @@ mw: QMainWindow = Gui.getMainWindow() -preferences = App.ParamGet('User parameter:BaseApp/Preferences/Themes/UserTokens/') -BackGroundColor = preferences.GetString('GeneralBackgroundColor') -HoverColor = preferences.GetString('GeneralBackgroundHoverColor') -BorderColor = preferences.GetString('GeneralBorderColor') -BorderColorHover = preferences.GetString('GeneralBorderHoverColor') -TextColor = preferences.GetString('TextForegroundColor') +preferences = App.ParamGet("User parameter:BaseApp/Preferences/Themes/UserTokens/") +BackGroundColor = preferences.GetString("GeneralBackgroundColor") +HoverColor = preferences.GetString("GeneralBackgroundHoverColor") +BorderColor = preferences.GetString("GeneralBorderColor") +BorderColorHover = preferences.GetString("GeneralBorderHoverColor") +TextColor = preferences.GetString("TextForegroundColor") btn = QToolButton() def GetColorSetting(settingName: str) -> object: - # Create a tuple from the int value of the color - result = QColor.fromRgba(preferences.GetUnsigned(settingName)).toTuple() + # Create a tuple from the int value of the color + result = QColor.fromRgba(preferences.GetUnsigned(settingName)).toTuple() - # correct the order of the tuple - result = (result[3], result[0], result[1], result[2]) + # correct the order of the tuple + result = (result[3], result[0], result[1], result[2]) + + return result - return result def DarkMode(): import xml.etree.ElementTree as ET @@ -181,9 +182,9 @@ def ReturnStyleItem(ControlName, ShowCustomIcon=False, IgnoreOverlay=False): # currentStyleSheet = "FreeCAD Light.qss" # if str("FreeCAD Dark").lower() in Theme.lower(): # currentStyleSheet = "FreeCAD Dark.qss" - + # currentStyleSheet = "FreeCAD.qss" - + IsInList = False for key, value in StyleMapping_default["Stylesheets"].items(): if key == currentStyleSheet: @@ -213,7 +214,10 @@ def ReturnStyleItem(ControlName, ShowCustomIcon=False, IgnoreOverlay=False): if isIcon is True: result = None PixmapName = "" - if Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True or ShowCustomIcon is True: + if ( + Parameters_Ribbon.BETA_FUNCTIONS_ENABLED is True + or ShowCustomIcon is True + ): PixmapName = StyleMapping["Stylesheets"][ControlName] else: PixmapName = "" @@ -342,10 +346,10 @@ def ReturnStyleSheet( + BorderColor + """;}""" + "QToolButton:disabled, QLabel:disabled {background-color: " - + ReturnStyleItem("Background_Color") - + ";border: 0.5px solid" - + BorderColor - + ";}" + + ReturnStyleItem("Background_Color") + + ";border: 0.5px solid" + + BorderColor + + ";}" ) return StyleSheet if control.lower() == "applicationbutton": @@ -473,6 +477,7 @@ def ReturnTitleBarIcons(): Icons.append(Icon) return Icons + def ReturnIcons_ThemeEditor(): lightIcons = { "ScrollLeftButton_Tab": "backward_small_default.svg", @@ -482,9 +487,13 @@ def ReturnIcons_ThemeEditor(): "OptionButton": "more_default.svg", "PinButton_open": "pin-icon-open.svg", "PinButton_closed": "pin-icon-default.svg", - "TitleBarButtons": ["maximize_default.svg", "restore_default.svg", "minimize_default.svg"] + "TitleBarButtons": [ + "maximize_default.svg", + "restore_default.svg", + "minimize_default.svg", + ], } - + darkIcons = { "ScrollLeftButton_Tab": "backward_small_default_white.svg", "ScrollRightButton_Tab": "forward_small_default_white.svg", @@ -493,9 +502,13 @@ def ReturnIcons_ThemeEditor(): "OptionButton": "more_default_white.svg", "PinButton_open": "pin-icon-open_white.svg", "PinButton_closed": "pin-icon-default_white.svg", - "TitleBarButtons": ["maximize_default_white.svg", "restore_default_white.svg", "minimize_default_white.svg"] + "TitleBarButtons": [ + "maximize_default_white.svg", + "restore_default_white.svg", + "minimize_default_white.svg", + ], } - color = GetColorSetting('TextForegroundColor') + color = GetColorSetting("TextForegroundColor") # if StandardFunctions.LightOrDark(color) == "dark": IsDarkTheme = darkMode if IsDarkTheme is False: @@ -503,6 +516,7 @@ def ReturnIcons_ThemeEditor(): else: return darkIcons + # Used when custom colors are enabled StyleMapping = { "Stylesheets": { @@ -528,9 +542,15 @@ def ReturnIcons_ThemeEditor(): "Stylesheets": { "": { "Background_Color": "none", - "Background_Color_Hover": StandardFunctions.ColorConvertor(mw.palette().highlight().color().toTuple(), 1, True, False), - "Border_Color": StandardFunctions.ColorConvertor(mw.palette().text().color().toTuple(), 1, True, False), - "ApplicationButton_Background": StandardFunctions.ColorConvertor(mw.palette().highlight().color().toTuple(), 1, True, False), + "Background_Color_Hover": StandardFunctions.ColorConvertor( + mw.palette().highlight().color().toTuple(), 1, True, False + ), + "Border_Color": StandardFunctions.ColorConvertor( + mw.palette().text().color().toTuple(), 1, True, False + ), + "ApplicationButton_Background": StandardFunctions.ColorConvertor( + mw.palette().highlight().color().toTuple(), 1, True, False + ), "FontColor": ReturnFontColor(), "UpdateColor": ReturnUpdateColor(), "DevelopColor": ReturnDevelopColor(), @@ -572,10 +592,14 @@ def ReturnIcons_ThemeEditor(): "DevelopColor": ReturnDevelopColor(), "ScrollLeftButton_Tab": ReturnIcons_ThemeEditor()["ScrollLeftButton_Tab"], "ScrollRightButton_Tab": ReturnIcons_ThemeEditor()["ScrollRightButton_Tab"], - "ScrollLeftButton_Category": ReturnIcons_ThemeEditor()["ScrollLeftButton_Category"], - "ScrollRightButton_Category": ReturnIcons_ThemeEditor()["ScrollRightButton_Category"], + "ScrollLeftButton_Category": ReturnIcons_ThemeEditor()[ + "ScrollLeftButton_Category" + ], + "ScrollRightButton_Category": ReturnIcons_ThemeEditor()[ + "ScrollRightButton_Category" + ], "OptionButton": ReturnIcons_ThemeEditor()["OptionButton"], - "PinButton_open": ReturnIcons_ThemeEditor()["PinButton_open"], + "PinButton_open": ReturnIcons_ThemeEditor()["PinButton_open"], "PinButton_closed": ReturnIcons_ThemeEditor()["PinButton_closed"], "TitleBarButtons": ReturnIcons_ThemeEditor()["TitleBarButtons"], }, @@ -748,4 +772,3 @@ def ReturnIcons_ThemeEditor(): }, } } -