[Scribus] [SCRIBUS] [SCRIBUS] [ANN] MY FIRST PLUGIN: SCRIPTERNG

Petr Vanek petr
Wed Nov 14 09:34:25 CET 2007


> 
> 2007/11/13, Petr Vanek <petr at scribus.info>:
> > Is it writtent to work with 135svn or anything else?
> I developed the plugin on svn trunk. But any version using Qt4
> should work.

great. SVN trunk is one and only Qt4 version we have.

> > I had a little talk with one guy from Kross team. He said they will have
> > pure Qt (no kde deps) Kross ready in 2 months propably. What are
> > dis/advantages of your solution comparing to Kross?
> Kross is great but as you said it currently still depends on kdelibs.
> ScripterNG is available now. Of course it isn't that mature but it
> depends on mature technologies (PyQt, sip, pythonize). One main
> difference is that I try to do most stuff in Python. So I can be more
> flexible and development should be faster. I don't expect any sensible
> speed loss by this approach.
> Additionally if we start writing the C++ api now, we could switch later
> to Kross and could still use this api.

That's the greatest one. Let's focus on the scripting "API" now. You know,
I'd like to have some logical "object-related" structure for it. Something
like e.g.:
scribus.Document().pages[0].items[0].text()

but it should be designed very carefully. Your description below explains
implementation clearly.

> Here is an example.
> 
>  class CoreModule;
> 
>  CoreModule::CoreModule() : QObject(
>            QApplication::instance()->findChild("ScripterNG")) {
>    setObjectName("Core");
>  }
> 
>  void CoreModule::quit(bool ask_save) {
>    if (ask_save() && confirm() .. ) {
>       qDebug("Bye");
>       QApplication::instance()->quit();
>    }
>  }
> 
>  int CoreModule::answer() {
>    return 42;
>  }
> 
>  CoreModule *m_core = new CoreModule();
> 
> 
> Now you can do
>  >> print Application.Core.answer()
>  42
>  >> Application.Core.quit()
>  Bye

> > > PS: There still seems to be a problem in loading the module. Call
> > > scribus from INSTALLPREFIX/lib/scribus/plugins/scripterng
> > [..]
> > ImportError: No module named _scribuspyqt
> > Loading failed
> _scribusqt.so could be put into /usr/Lib/python2.5/site-packages
> libscribusqt.so could be put into INSTALLPREFIX/lib/scribus or
> something like that
> Or you set LD_LIBRARY_PATH ;)

There is one problem. I cannot find any _scribuspyqt.so or _scribusqt.so in
my compiled objects.
Maybe the PYTHONPATH setting shoudl work too.

cheers
petr





More information about the scribus mailing list