From b1208496bc99724b1d1e206ab27cc781fca1dd3a Mon Sep 17 00:00:00 2001 From: Andrew Shkolik Date: Wed, 3 Mar 2021 16:30:02 -0600 Subject: [PATCH 1/2] - tree view item text color exposed to parameters - issue with renaming copied from original PR #6 --- GlassGui.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/GlassGui.py b/GlassGui.py index 2ff312c..ae3b4dd 100644 --- a/GlassGui.py +++ b/GlassGui.py @@ -41,13 +41,13 @@ def firstRun(): pTree = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/DockWindows/TreeView") pTree.SetBool("Enabled", True) - pStyle = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/MainWindow") - pStyle.SetString("StyleSheet", "Dark-blue.qss") + #pStyle = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/MainWindow") + #pStyle.SetString("StyleSheet", "Dark-blue.qss") - pView = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") - pView.SetUnsigned("BackgroundColor2", 1852731135) - pView.SetUnsigned("BackgroundColor3", 2829625599) - pView.SetUnsigned("BackgroundColor4", 1852731135) + #pView = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") + #pView.SetUnsigned("BackgroundColor2", 1852731135) + #pView.SetUnsigned("BackgroundColor3", 2829625599) + #pView.SetUnsigned("BackgroundColor4", 1852731135) def findDock(): @@ -93,11 +93,18 @@ def applyGlass(boolean, widget): widget.setAttribute(QtCore.Qt.WA_TranslucentBackground, boolean) except: pass + transparent_classes = [QtGui.QScrollBar, QtGui.QLineEdit, QtGui.QAbstractButton, QtGui.QHeaderView, QtGui.QDockWidget] + + if not p.GetString("TextColor"): + p.SetString("TextColor", "black") + + pColor = p.GetString("TextColor") + try: - if boolean: - widget.setStyleSheet("background:transparent; border:none; color:white;") + if boolean and (widget.__class__ in transparent_classes) or (widget.objectName() in ['qt_scrollarea_hcontainer', 'qt_scrollarea_vcontainer']): + widget.setStyleSheet(f"background:transparent; border:none; color:{pColor};") else: - widget.setStyleSheet("") + widget.setStyleSheet(f"color:{pColor};") except: pass try: @@ -151,8 +158,10 @@ def widgetList(boolean): child = True for child in children: - applyGlass(boolean, child) - + if isinstance(child, QtGui.QWidget): + applyGlass(boolean, child) + if boolean: + dock.setStyleSheet("") def setMode(): """Set dock or overlay widget mode.""" @@ -189,7 +198,7 @@ def onResize(): if mode == 1: x = 0 y = 0 - w = mdi.geometry().width() / 100 * 20 + w = mdi.geometry().width() / 100 * 15 h = (mdi.geometry().height() - mdi.findChild(QtGui.QTabBar).geometry().height()) dock.setGeometry(x, y, w, h) From 2bb1c9a768d7ae267d3d5a4bb8aa96f0f69a87dc Mon Sep 17 00:00:00 2001 From: Andrew Shkolik Date: Thu, 11 Mar 2021 18:30:06 -0600 Subject: [PATCH 2/2] Do not start macro if Linkstage3 branch of FreeCad --- GlassGui.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GlassGui.py b/GlassGui.py index ae3b4dd..25f4333 100644 --- a/GlassGui.py +++ b/GlassGui.py @@ -228,6 +228,7 @@ def onStart(): p.SetBool("FirstRun", 0) -timer = QtCore.QTimer() -timer.timeout.connect(onStart) -timer.start(500) +if (not FreeCAD.Version().__contains__("LinkStage3")): + timer = QtCore.QTimer() + timer.timeout.connect(onStart) + timer.start(500) \ No newline at end of file