From dda816611960f67e771f2f983b7eafd7864f5374 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 4 Sep 2023 20:04:22 +0200 Subject: [PATCH] Tux: apply clang format --- .pre-commit-config.yaml | 1 + src/Mod/Tux/CMakeLists.txt | 1 - src/Mod/Tux/InitGui.py | 1 - src/Mod/Tux/NavigationIndicatorGui.py | 401 ++++++++++++++++++++------ src/Mod/Tux/PersistentToolbarsGui.py | 11 +- 5 files changed, 318 insertions(+), 97 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fdc40a316b..8568d5c631 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,7 @@ files: | src/Mod/Surface| src/Mod/Start| src/Mod/Test| + src/Mod/Tux| src/Mod/Web ) exclude: | diff --git a/src/Mod/Tux/CMakeLists.txt b/src/Mod/Tux/CMakeLists.txt index 656e883fc2..78995ffec2 100644 --- a/src/Mod/Tux/CMakeLists.txt +++ b/src/Mod/Tux/CMakeLists.txt @@ -30,4 +30,3 @@ INSTALL( DESTINATION Mod/Tux ) - diff --git a/src/Mod/Tux/InitGui.py b/src/Mod/Tux/InitGui.py index 86e1c49dcf..e02e7da59a 100644 --- a/src/Mod/Tux/InitGui.py +++ b/src/Mod/Tux/InitGui.py @@ -33,4 +33,3 @@ if p.GetGroup("PersistentToolbars").GetBool("Enabled", 1): import PersistentToolbarsGui else: pass - diff --git a/src/Mod/Tux/NavigationIndicatorGui.py b/src/Mod/Tux/NavigationIndicatorGui.py index 243a6a8d89..e20c0be897 100644 --- a/src/Mod/Tux/NavigationIndicatorGui.py +++ b/src/Mod/Tux/NavigationIndicatorGui.py @@ -36,7 +36,9 @@ try: def translate(context, text): "convenience function for Qt 4 translator" return QtGui.QApplication.translate(context, text, None, _encoding) + except AttributeError: + def translate(context, text): "convenience function for Qt 5 translator" return QtGui.QApplication.translate(context, text, None) @@ -44,6 +46,7 @@ except AttributeError: class IndicatorButton(QtGui.QPushButton): """Detect language change events.""" + def __init__(self, parent=None): super(IndicatorButton, self).__init__() @@ -56,7 +59,7 @@ class IndicatorButton(QtGui.QPushButton): return super(IndicatorButton, self).changeEvent(event) def onChange(self, paramGrp, param): - if(param == "NavigationStyle"): + if param == "NavigationStyle": setCurrent() @@ -78,14 +81,27 @@ def retranslateUi(): t0 = translate("NavigationIndicator", "Navigation style not recognized.") global t1 - t1 = "

Blender " + text06 + """

+ t1 = ( + "

Blender " + + text06 + + """

- - - - - + + + + + @@ -95,17 +111,35 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """""" + + text04 + + """
- """ + text08 + ": " + text10 + "

" + """ + + text08 + + ": " + + text10 + + "

" + ) global t2 - t2 = "

CAD " + text06 + """

+ t2 = ( + "

CAD " + + text06 + + """

- - - - - + + + + + @@ -115,18 +149,38 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text03 + + """""" + + text04 + + """
- """ + text08 + ": " + text10 + "

" + """ + + text08 + + ": " + + text10 + + "

" + ) global t3 - t3 = "

Gesture " + text06 + """

+ t3 = ( + "

Gesture " + + text06 + + """

- - - - - - + + + + + + @@ -137,12 +191,24 @@ def retranslateUi(): - - - - - - + + + + + + @@ -153,19 +219,43 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """""" + text05 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text03 + + """""" + + text04 + + """""" + + text05 + + """
""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + text05 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """""" + + text04 + + """""" + + text05 + + """
-

""" + text02 + ": " + text07 + """
- """ + text08 + ": " + text09 + "

" +

""" + + text02 + + ": " + + text07 + + """
+ """ + + text08 + + ": " + + text09 + + "

" + ) global t4 - t4 = "

MayaGesture " + text06 + """

+ t4 = ( + "

MayaGesture " + + text06 + + """

- - - - - - + + + + + + @@ -176,12 +266,24 @@ def retranslateUi(): - - - - - - + + + + + + @@ -192,19 +294,43 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text05 + """""" + + text01 + + """""" + + text02 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """""" + + text05 + + """
""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + text05 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """""" + + text04 + + """""" + + text05 + + """
-

""" + text02 + ": " + text07 + """
- """ + text08 + ": " + text09 + "

" +

""" + + text02 + + ": " + + text07 + + """
+ """ + + text08 + + ": " + + text09 + + "

" + ) global t5 - t5 = "

OpenCascade " + text06 + """

+ t5 = ( + "

OpenCascade " + + text06 + + """

- - - - - - + + + + + + @@ -215,16 +341,30 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """""" + + text04 + + """
""" + ) global t6 - t6 = "

OpenInventor " + text06 + """

+ t6 = ( + "

OpenInventor " + + text06 + + """

- - - - - + + + + + @@ -234,17 +374,35 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """
- """ + text08 + ": " + text10 + "

" + """ + + text08 + + ": " + + text10 + + "

" + ) global t7 - t7 = "

OpenSCAD " + text06 + """

+ t7 = ( + "

OpenSCAD " + + text06 + + """

- - - - - + + + + + @@ -254,16 +412,30 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """
""" + ) global t8 - t8 = "

Revit " + text06 + """

+ t8 = ( + "

Revit " + + text06 + + """

- - - - - + + + + + @@ -273,16 +445,32 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """""" + + text04 + + """
- """ + text08 + ": " + text10 + "

" + """ + + text08 + + ": " + + text10 + + "

" + ) global t9 - t9 = "

TinkerCAD " + text06 + """

+ t9 = ( + "

TinkerCAD " + + text06 + + """

- - - - + + + + @@ -291,17 +479,33 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text03 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text04 + + """
""" + ) global t10 - t10 = "

Touchpad " + text06 + """

+ t10 = ( + "

Touchpad " + + text06 + + """

- - - - - - + + + + + + @@ -312,11 +516,21 @@ def retranslateUi(): - - - - - + + + + + @@ -326,7 +540,12 @@ def retranslateUi():
""" + text01 + """""" + text02 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text02 + + """""" + + text03 + + """""" + + text03 + + """""" + + text04 + + """
""" + text01 + """""" + text02 + """""" + text03 + """""" + text03 + """""" + text04 + """""" + + text01 + + """""" + + text02 + + """""" + + text03 + + """""" + + text03 + + """""" + + text04 + + """
-

""" + text02 + ": " + text07 + "

" +

""" + + text02 + + ": " + + text07 + + "

" + ) menuSettings.setTitle(translate("NavigationIndicator", "Settings")) menuOrbit.setTitle(translate("NavigationIndicator", "Orbit style")) @@ -389,7 +608,7 @@ a1.setData("Gui::BlenderNavigationStyle") a1.setObjectName("Indicator_NavigationBlender") a2 = QtGui.QAction(gStyle) -a2.setIcon(QtGui.QIcon(':/icons/NavigationCAD_dark.svg')) +a2.setIcon(QtGui.QIcon(":/icons/NavigationCAD_dark.svg")) a2.setText("CAD ") a2.setData("Gui::CADNavigationStyle") a2.setObjectName("Indicator_NavigationCAD") diff --git a/src/Mod/Tux/PersistentToolbarsGui.py b/src/Mod/Tux/PersistentToolbarsGui.py index 5f3b4c0ed1..781766d3ba 100644 --- a/src/Mod/Tux/PersistentToolbarsGui.py +++ b/src/Mod/Tux/PersistentToolbarsGui.py @@ -28,6 +28,7 @@ conectedToolbars = [] timer = QtCore.QTimer() mw = Gui.getMainWindow() + def pythonToolbars(): """Manage Python based toolbar in BIM workbench.""" @@ -85,10 +86,12 @@ def onRestore(active): # Reduce flickering. for i in toolbars: - if (i not in topRestore and - i not in leftRestore and - i not in rightRestore and - i not in bottomRestore): + if ( + i not in topRestore + and i not in leftRestore + and i not in rightRestore + and i not in bottomRestore + ): area = mw.toolBarArea(toolbars[i])