[Solved] Macro editor background colour
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Solved] Macro editor background colour
A while ago I started a thread about this over at Macro editor background colour, but if I'm going to do anything about it then this is probably a better place to discuss it.
I was having a sniff around src/Gui/DlgEditorImp.cpp to see how hard it'd be to add a preference for a background that's a bit more (less?) contrasty/less blindy. Totally achievable.
Then I had a look in PythonConsole.cpp and I see that the colours used there are hard coded. Admittedly I haven't thought too hard about this, but wouldn't the editor colours be appropriate for the Python console too?
And the Output window/Report view would need a similar preference. And the tree view. Combo view... Maybe a global background preference?
Does anyone have any opinions about this?
I was having a sniff around src/Gui/DlgEditorImp.cpp to see how hard it'd be to add a preference for a background that's a bit more (less?) contrasty/less blindy. Totally achievable.
Then I had a look in PythonConsole.cpp and I see that the colours used there are hard coded. Admittedly I haven't thought too hard about this, but wouldn't the editor colours be appropriate for the Python console too?
And the Output window/Report view would need a similar preference. And the tree view. Combo view... Maybe a global background preference?
Does anyone have any opinions about this?
Last edited by Sam on Mon Sep 18, 2017 8:38 am, edited 1 time in total.
Re: Macro editor background colour
As a user (KUbuntu 14.4 and Win7) with default desktop I don't have a problem. But FreeCAD is a very configurable app. We have 7 mouse models after all. So I think if you don't change the default, go for it. It could be a preferences option, or in the parameter editor if it's considered too intrusive.
"fight the good fight"
Re: Macro editor background colour
Have you tried if the result you are after is achievable by using a custom stylesheet?
Re: Macro editor background colour
Under Edit -> Preferences ... -> General -> Style sheet you already have some options available. If you don't want to use a full stylesheet you can crate a file:
And use for example:
More reference:
https://github.com/FreeCAD/FreeCAD/tree ... tylesheets
Code: Select all
.FreeCAD/Gui/Stylesheets/custom.qss
Code: Select all
QPlainTextEdit {
background-color: gray;
}
https://github.com/FreeCAD/FreeCAD/tree ... tylesheets
Re: Macro editor background colour
This is something I have wondered a few times while developing the Dark and Light styles: I use just a set of colours and repeat them for each Qt element; it would be great if I can create an special stylesheet where I place colour variables which are then configurable by users inside FreeCAD preferences...
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
Re: Macro editor background colour
That would be a UI gamechanger. +1pablogil wrote: ↑Sat Sep 16, 2017 10:21 pm This is something I have wondered a few times while developing the Dark and Light styles: I use just a set of colours and repeat them for each Qt element; it would be great if I can create an special stylesheet where I place colour variables which are then configurable by users inside FreeCAD preferences...
Edit:
Did a cursory search on this possibility and found this: http://wiki.qt.io/Dynamic_Properties_and_Stylesheets
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Macro editor background colour
We could even potentially test it with a code snippet pasted in to the python console (but I don't know how to modify the snippet to do that yet )
https://stackoverflow.com/a/27160435
https://stackoverflow.com/a/27160435
Code: Select all
from PySide import QtCore, QtGui
class Window(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
self.edit = QtGui.QLineEdit(self)
self.edit.setProperty('warning', False)
self.edit.setStyleSheet("""
/* other rules go here */
QLineEdit[warning="true"] {background-color: yellow};
QLineEdit[warning="false"] {background-color: palette(base)};
""")
self.button = QtGui.QPushButton('Test', self)
self.button.clicked.connect(self.handleButton)
layout = QtGui.QVBoxLayout(self)
layout.addWidget(self.edit)
layout.addWidget(self.button)
def handleButton(self):
self.edit.setProperty(
'warning', not self.edit.property('warning'))
self.edit.style().unpolish(self.edit)
self.edit.style().polish(self.edit)
if __name__ == '__main__':
import sys
app = QtGui.QApplication(sys.argv)
window = Window()
window.show()
sys.exit(app.exec_())
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Macro editor background colour
Well, it's not exactly what we need here, with dynamic properties you can switch from one property to other but you cannot have a real variable inside the values...
In any case I would need a programmer that codes it because I don't know C++ so if anyone wants to collaborate I'll be happy to modify the stylesheets in other to introduce the variables.
In any case I would need a programmer that codes it because I don't know C++ so if anyone wants to collaborate I'll be happy to modify the stylesheets in other to introduce the variables.
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here