[Scribus] Events, Actions, Handlers, etc..

Craig Ringer craig
Tue Feb 13 01:55:19 CET 2007


Craig Bradney wrote:
>> ----- Original Message -----
>> Subject: [Scribus] Events, Actions, Handlers, etc..
>> From: Ruslan V. Sulakov <ruslan2007t at gmail.com>
>> To: scribus at nashi.altmuehlnet.de
>> Date: 05-02-2007 14:11
>>
>>
>> My question concerns python plugins...
>>
>> Is is possible to hook some events from Scribus into python plugin/script?
>>
>> For example, if a user moves an object.. is is a way to catch an event of
>> object movement?
>> Or handle an event of inserting a new object? Or handle other events by
>> python script?
>>
>> Is it possible?
> 
> No there is no feedback into the Scripter plugin. This will not be developed
> in the near future as Scripter will be rewritten post 1.3.6.

Even after that, it'll require quite a fair bit of help from Scribus's 
core code to support even notification of events in a safe way. 
Intercepting events to do something /instead/ or to ignore the event 
will probably be trickier too.

The only exception is events that're clearly related to a single Qt 
signal, in which case the event hook can be a method that calls a series 
of Python hooks and if none of them handles the event just re-emits the 
signal to the "real" slot. Those are not only fairly easy and safe to 
handle, but the hook has zero runtime cost (since the signal can point 
straight at the real slot) until a Python script asks for a hook to be 
created.

So, it's possible, and I was interested in doing it for a few things 
like file open, etc. It should even be possible to support event filters 
in python for at least some hooks. Right now, though, it's not 
implemented and it'll probably wait (as Craig B. said) until the 
Scripter gets an update/rewrite to make it more maintainable once the 
1.3.x core code settles down.

--
Craig Ringer



More information about the scribus mailing list