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

Ensure Gtk about dialog is destroyed #2812

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

rmartin16
Copy link
Member

@rmartin16 rmartin16 commented Sep 3, 2024

Changes

  • If the About Dialog's X button was clicked, a TypeError for the number of arguments for _close_about() was thrown
  • Now, an arbitrary number of positional arguments is accepted; it should be noted that pressing Escape does not send an extra pos arg...

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

- If the About Dialog's X button was clicked, a TypeError for the number
  of arguments for _close_about was thrown
- Now, an arbitrary number of positional arguments is accepted; it
  should be noted that pressing Escape does not send an extra pos arg...
@rmartin16
Copy link
Member Author

rmartin16 commented Sep 3, 2024

CI testbed failure, fyi:

______________________ ERROR at setup of test_select_pin _______________________
Traceback (most recent call last):
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/_pytest/runner.py", line 242, in <lambda>
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/pluggy/_callers.py", line 124, in _multicall
    teardown.send(result)  # type: ignore[union-attr]
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/_pytest/unraisableexception.py", line 90, in pytest_runtest_setup
    yield from unraisable_exception_runtest_hook()
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/_pytest/unraisableexception.py", line 85, in unraisable_exception_runtest_hook
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
pytest.PytestUnraisableExceptionWarning: Exception ignored on calling ctypes callback function: <rubicon.objc.api.objc_method object at 0x10c8c9ff0>

Traceback (most recent call last):
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/rubicon/objc/api.py", line 339, in __call__
    result = self.py_method(py_self, *args)
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/toga_cocoa/widgets/mapview.py", line 35, in mapView_regionDidChangeAnimated_
    region = self.impl.native.region
AttributeError: 'NoneType' object has no attribute 'native'

=========================== short test summary info ============================
ERROR tests/widgets/test_mapview.py::test_select_pin - pytest.PytestUnraisableExceptionWarning: Exception ignored on calling ctypes callback function: <rubicon.objc.api.objc_method object at 0x10c8c9ff0>

Traceback (most recent call last):
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/rubicon/objc/api.py", line 339, in __call__
    result = self.py_method(py_self, *args)
  File "/Users/runner/work/toga/toga/testbed/build/testbed/macos/app/Toga Testbed.app/Contents/Resources/app_packages/toga_cocoa/widgets/mapview.py", line 35, in mapView_regionDidChangeAnimated_
    region = self.impl.native.region
AttributeError: 'NoneType' object has no attribute 'native'

https://github.com/beeware/toga/actions/runs/10689167925/job/29630808654?pr=2812#step:6:685

ERROR tests\widgets\test_mapview.py::test_flex_widget_size - RuntimeError: MapView web canvas didn't initialize

https://github.com/beeware/toga/actions/runs/10689167925/job/29630809802?pr=2812#step:6:778

@rmartin16 rmartin16 marked this pull request as ready for review September 3, 2024 19:35
@rmartin16
Copy link
Member Author

hmm...thinking out loud...i guess this highlights that the testbed doesn't exercise some of the native callbacks... Although, I'm also not sure how the testbed would simulate clicking the X button...

@freakboy3742
Copy link
Member

CI testbed failure, fyi:
...
ERROR tests\widgets\test_mapview.py::test_flex_widget_size - RuntimeError: MapView web canvas didn't initialize

Yeah - both the Windows and GTK mapviews are prone to this one. As best as I can work out, it's to do with Github Actions network being flakier than a pie crust. #2632 is the error for Winforms; I've added a note to clarify that it's occasionally a problem on GTK as well.

hmm...thinking out loud...i guess this highlights that the testbed doesn't exercise some of the native callbacks... Although, I'm also not sure how the testbed would simulate clicking the X button...

I'm guessing the best we'd be able to do is emit a GTK event for a window close.

It's also worth noting why this fell through the cracks - on both of my Linux test desktops (Ubuntu default and Cinnamon), dialogs don't have X buttons. You can hit escape, or one of the "actual" buttons... but the dialogs are otherwise without any window decorations.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

I can't replicate this locally, but the change (and the way the bug would manifest) makes sense if you've got a GTK desktop theme that has close buttons on dialogs.

@freakboy3742 freakboy3742 merged commit ab29cb9 into beeware:main Sep 4, 2024
35 checks passed
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