Bug 424515 - Notifier windowIsBeingCreated signal not wrapped correctly for Python
Summary: Notifier windowIsBeingCreated signal not wrapped correctly for Python
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.3.0
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-21 19:25 UTC by Adric Worley
Modified: 2020-07-22 12:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adric Worley 2020-07-21 19:25:20 UTC
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
Comment 1 Scott Petrovic 2020-07-21 19:34:01 UTC
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.
Comment 2 Scott Petrovic 2020-07-21 23:34:58 UTC
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.