Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI/gmodeler: fix setToolBar failing on macOS #5298

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pesekon2
Copy link
Contributor

@pesekon2 pesekon2 commented Mar 4, 2025

The bug seems to be in wxpython: wxWidgets/wxWidgets#24560

One of the workarounds mentioned in the linked issue is to call Realize() before setToolBar() - this is an attempt to fix it with this trick

@pesekon2 pesekon2 requested a review from nilason March 4, 2025 13:52
@pesekon2 pesekon2 self-assigned this Mar 4, 2025
@github-actions github-actions bot added GUI wxGUI related Python Related code is in Python labels Mar 4, 2025
@@ -29,15 +29,15 @@ class ModelerToolbar(BaseToolbar):
def __init__(self, parent):
BaseToolbar.__init__(self, parent)

# realize the toolbar
self.Realize()

# workaround for http://trac.wxwidgets.org/ticket/13888
if sys.platform == "darwin":
Copy link
Contributor

Choose a reason for hiding this comment

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

This workaround, is what causes the problem. It is apparently not needed anymore, can't tell since when...

Copy link
Contributor

Choose a reason for hiding this comment

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

That is the workaround in our code: if sys.platform == "darwin": ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nilason: Shall we fully remove the snippet then?

       # workaround for http://trac.wxwidgets.org/ticket/13888
        if sys.platform == "darwin":
            parent.SetToolBar(self)

Copy link
Contributor

Choose a reason for hiding this comment

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

if sys.platform == "darwin" and not CheckWxVersion([4, 2, 1]): seems to work for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nilason: What about if sys.platform == "darwin" and not CheckWxVersion([4, 2, 0]):? If the 4.2 version of wx brought the incosistency to macOS, it was probably already in the 4.2.0 version.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about if sys.platform == "darwin" and not CheckWxVersion([4, 2, 0]):?

I could test only with 4.2.1 and 4.2.2.

If the 4.2 version of wx brought the incosistency to macOS, it was probably already in the 4.2.0 version.

Let us go safe and fix what has been tested. If someone, however unlikely, will attempt to run with 4.2.0 and report then I'd say we're happy to address it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in your proposed way in 289dd1c

@neteler neteler added the backport to 8.4 PR needs to be backported to release branch 8.4 label Mar 4, 2025
@pesekon2 pesekon2 added the bug Something isn't working label Mar 4, 2025
@pesekon2 pesekon2 marked this pull request as ready for review March 4, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working GUI wxGUI related Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] g.gui.gmodeler fails in 8.4.1
3 participants