JS Scriptengine in libplasma

Richard Dale richard.j.dale at gmail.com
Thu May 7 13:55:14 CEST 2009


On Thu, May 7, 2009 at 12:26 PM, Marco Martin <notmart at gmail.com> wrote:
> On Thursday 07 May 2009, Leonardo Franchi wrote:
>> On Thursday 07 May 2009 11:48:48 Richard Dale wrote:
>> > On Wed, May 6, 2009 at 8:59 PM, Leonardo Franchi <lfranchi at kde.org>
> wrote:
>> > > hola folks,
>> > >
>> > > so i'm (finally) looking into adding scripted applet/dataengine support
>> > > to amarok. it's really easy and transparent and all of that (yay
>> > > plasma!) but we have a minor issue. we depend only on kdelibs, and the
>> > > scriptengines are in kdebase/workspace.
>> > >
>> > > i understand that most of them have external deps, which may be
>> > > undesirable. Indeed, we'll most likely restrict all applets/engines to
>> > > being javascript, so as to not require the user to install random
>> > > *-bindings package. But moving the javascript dataengine to the plasma
>> > > in kdelibs would really be nice.
>> >
>> > I agree that the python and ruby script engine bindings have more
>> > dependency problems than QScript bindings, and it wouldn't make sense
>> > to put them in kdelibs.
>> >
>> > However, on the other hand, the python and ruby ones are not really
>> > equivalent to the QScript bindings in kdebase as they pretty much
>> > cover the entire C++ Plasma Applet api, whereas the QScript one covers
>> > a simpler minimal api. At one time, in the kde playground module,
>> > there was work going on into developing some more complete JavaScript
>> > bindings based on the QtJambi parser/code generator. So I wonder if
>> > anyone is intending to develop the more complex bindings further? Have
>> > we had enough feedback yet to know whether or not the simpler bindings
>> > are sufficient for what most people want to do?
>>
>> Ah, I wasn't aware that the JS bindings aren't "full" bindings like the
>> Ruby or Python ones. In amarok 2 we decided to limit all scripts two
>> javascript/qtscript in order to a) avoid the mess of having scripts require
>> certain *-qt4/kde4 bindings, which lead to users not being able to install
>> them, and b) with the qtscriptgenerator bindings we get "for free" a full
>> set of qt bindings. We then expose an additional qtscript API for amarok.
>>
>> We will most  likely limit scripted amarok applets to qtscript as well.
>> What sort of limitations do the JS bindings have?
> you have access only to methods decalred as Q_PROPERTY or Q_INVOKABLE
> all the plasma widgets export as properties most of their functionality but
> not nativeWidget() (so it's not accessible the full api of the underlying
> qwidget)
Can you create Plasma widgets though? Maybe I'm completely missing
something, but looking at the code I can only see a reference to a
Plasma VideoWidget being created, along with loading things from a .ui
 file at runtime. Is it possible to have Plasma widgets in a .ui file?

-- Richard


More information about the Plasma-devel mailing list