Skip to content

Mac os icon - #124

Open
ispielma wants to merge 7 commits into
labscript-suite:masterfrom
ispielma:MacOS_icon
Open

Mac os icon#124
ispielma wants to merge 7 commits into
labscript-suite:masterfrom
ispielma:MacOS_icon

Conversation

@ispielma

Copy link
Copy Markdown

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.

@ispielma

Copy link
Copy Markdown
Author

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.

@dihm dihm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions...

Comment thread labscript_utils/splash.py
Comment on lines +46 to +50
icon_path = qapplication.property('_labscript_icon_path')
if icon_path:
icon = QtGui.QIcon(icon_path)
if not icon.isNull():
qapplication.setWindowIcon(icon)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread labscript_utils/splash.py
Comment on lines +53 to +61
# 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread labscript_utils/splash.py
# current palette so dark/light appearance still follows the active
# theme.
palette = QtGui.QPalette(qapplication.palette())
style = QtWidgets.QStyleFactory.create('Fusion')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants