From 17a38b0f6efc4a0d847ab502773dafa9939999d8 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 26 Apr 2016 17:09:25 +0200 Subject: Enable g-ir-scanner to scan ScintillaObject signals Currently, the ScintillaObject signals can't be used from python code via gobject-introspection. This is because g-ir-scanner does not properly scan the signals. For signals, there is the additional requirement that parameters have are registered GTypes. For the sci-notify signal, this can be accomplished by boxing SCNotification. In addition, g-ir-scanner also runs on Scintilla.h where it picks up additional structs. test/gi/ is updated accordingly. The test python script is enhanced to showcase the signals (some fixes to the makefile are included as well). --- test/gi/gi-test.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/gi/gi-test.py') diff --git a/test/gi/gi-test.py b/test/gi/gi-test.py index 6c775ea0c..b047ecec9 100644 --- a/test/gi/gi-test.py +++ b/test/gi/gi-test.py @@ -8,9 +8,18 @@ gi.require_version('Scintilla', '0.1') from gi.repository import Scintilla from gi.repository import Gtk +def on_notify(sci, id, scn): + if (scn.nmhdr.code == 2001): # SCN_CHARADDED + print ("sci-notify: id: %d, char added: %d" % (id, scn.ch)) + elif (scn.nmhdr.code == 2008): # SCN_MODIFIED + print ("sci-notify: id: %d, pos: %d, mod type: %d" % (id, scn.position, scn.modificationType)) + else: + print ("sci-notify: id: %d, scn.nmhdr.code: %d" % (id, scn.nmhdr.code)) + win = Gtk.Window() win.connect("delete-event", Gtk.main_quit) sci = Scintilla.Object() +sci.connect("sci-notify", on_notify) win.add(sci) win.show_all() win.resize(400,300) -- cgit v1.2.3