Mac os icon - #124
Conversation
|
Updated so qt sets the application name correctly: it is always set to the 0-th argument of the argv passed in. The problem is that this is main.py most of the time. So here we replace that with an application provided string ideally the application name. I will have pull requests for all of the labscript applications to use this. |
| icon_path = qapplication.property('_labscript_icon_path') | ||
| if icon_path: | ||
| icon = QtGui.QIcon(icon_path) | ||
| if not icon.isNull(): | ||
| qapplication.setWindowIcon(icon) |
There was a problem hiding this comment.
I'll admit to being surprised that this is the actual method that has to be used on Mac OS. Wild. I don't have a mac to test on, but I'll take your word for it that it works.
| # Native macOS widget styling makes many Qt controls look inconsistent | ||
| # with the rest of the suite. Use Qt's own style, but preserve the | ||
| # current palette so dark/light appearance still follows the active | ||
| # theme. | ||
| palette = QtGui.QPalette(qapplication.palette()) | ||
| style = QtWidgets.QStyleFactory.create('Fusion') | ||
| if style is not None: | ||
| qapplication.setStyle(style) | ||
| qapplication.setPalette(palette) |
There was a problem hiding this comment.
Does this have to be done here? I'd prefer to keep all the style and theming local to each application if at all possible. I realize that makes more distributed work, but the fact styling/palette controls were scattered to the winds is the main reason porting to PyQt6 took so long. I really don't want to let the entropy back in just after it (somewhat) got tamed.
| # current palette so dark/light appearance still follows the active | ||
| # theme. | ||
| palette = QtGui.QPalette(qapplication.palette()) | ||
| style = QtWidgets.QStyleFactory.create('Fusion') |
There was a problem hiding this comment.
When I did the PyQt6 port, I remember briefly looking at moving everything to Fusion and finding it a pretty serious downgrade. Could you share a couple screenshots, since I don't have an easy way to see for myself?
This fixes two MacOS specific issues. First using the QT "MacOS native-style" widgets did not preserve the layout present in windows or linux, so we ask for the "fusion" widgets. The runmanager tabs specifically did not get the desired stacking behavior to the left of the tabs (and many other things looked bad).
Second the mac desktop apps did not get icons in the dock (they were just generic place holders).
This patches labscript_utils.splash with macos specific updates to fix these problems.
There is a Lyse partner to this pull request.