| Summary: | Notifier windowIsBeingCreated signal not wrapped correctly for Python | ||
|---|---|---|---|
| Product: | [Applications] krita | Reporter: | Adric Worley <adric.worley> |
| Component: | Scripting | Assignee: | Krita Bugs <krita-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | scottpetrovic |
| Priority: | NOR | ||
| Version First Reported In: | 4.3.0 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Other | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Yes. I can verify. I started looking at this a bit ago with adding a new python API and noticed the SIP was not named right. I imagine it was renamed while it was being developed and the SIP file was just not updated. I have a PR out to fix this. I also added a new Notifier to tell us when the main window can actually be referenced. You can see the sample extension I wrote to test this out in the PR. |
SUMMARY The notifier class's "windowIsBeingCreated" method is wrapped as "windowCreated" in Notifier.sip. The net result is that Python scripts can't properly access or connect to the signal. EXAMPLE CODE: class MyExtension(krita.Extension): def __init__(self, parent): super(MyExtension, self).__init__(parent) krita.Krita.instance().notifier().windowCreated.connect(self._on_window_created) @QtCore.Slot("Window*") def _on_window_created(self, window): do_stuff() EXAMPLE STACKTRACE: Traceback (most recent call last): File "C:\Users\adric\AppData\Roaming\krita\pykrita\krita_unpipe\krita_unpipe.py", line 47, in __init__ notifier.windowCreated.connect(self._on_window_created) TypeError: connect() failed between windowCreated(Window*) and _on_window_created() EXPECTED RESULT Wrapped signals match their C++ naming, and can be connected to Python methods. SOFTWARE/OS VERSIONS Windows: 10.0.18363 Qt Version: 5.12.8