Creating Plasma::Containments or Plasma::PopupApplets via the scripting api
Richard Dale
richard.j.dale at gmail.com
Fri Apr 24 13:22:15 CEST 2009
On Thu, Apr 23, 2009 at 9:56 PM, Aaron J. Seigo <aseigo at kde.org> wrote:
> On Thursday 23 April 2009, Richard Dale wrote:
>> There are gl bindings for Ruby which work well with the Qt GL*
>> classes, and I would think python has some.
>>
>> I need to add a new servicetype for the new PopupApplet and so I've
>> got a file called plasma-applet-popupapplet.desktop containing this:
>>
>> [Desktop Entry]
>> Type=ServiceType
>> X-KDE-ServiceType=Plasma/PopupApplet
>
> this would require one for each type of applet, and might give people the
> wrong idea about having to include that in their c++ ones? well, can't hurt
> any.. only other option would be to have an X-Plasma-AppletSpecialization
> entry or some other nonsense, so this looks the cleanest.
>
>> The Containment one also has these lines:
>>
>> [PropertyDef::X-Plasma-ContainmentCategories]
>> Type=QStringList
>>
>> Do I need an equivalent one for Plasma/PopupApplets?
>
> no, this is to map containments to panel vs desktop vs screensaver, etc.
>
> applets don't need (and shouldn't have) this...
>
>> C++ PopupApplets don't seem to have their own service defined and they
>> are just Plasma/Applets. I think I've seen this in a .desktop file
>> though:
>>
>> ServiceTypes=Plasma/Applet,Plasma/PopupApplet
>>
>> Is that what we should have - or is it just wrong, and there should
>> only ever be one ServiceType defined for plasma things in .desktop
>> files?
>
> it isn't wrong, but it also doesn't matter for c++ applets.
>
>> I was going to add this to the 4.2 branch, but if it needs
>> translations in the service type files, then maybe I shouldn't.
>
> yes, it probably would unless there was no Name= entry, and i don't think
> that's valid?
OK, I've added the new Plasma/PopupApplet service type to the trunk
only, and not the 4.2 branch. I have added the code to instantiate a
scripting popup applet to applet.cpp in both the trunk and branch
though.
The ruby bindings for the script engine in the 4.2 branch and the
trunk, also have new PlasmaScripting::Containment and
PlasmaScripting::PopupApplet classes. I've added the Techbase Extender
Tutorial example translated to Ruby in
kdebase/workspace/plasma/scriptengines/ruby/examples/applets/extendertutorial.
We can't add scripting GLApplets because we would need a callback for
paintGLInterface, and for now I don't think it is worth bothering
(maybe wait until there is a possible craze in the future for writing
3D applets).
/**
* Reimplement this method to render using OpenGL. QPainter passed
* to this method will always use OpenGL engine and rendering
* using OpenGL api directly is supported.
*/
virtual void paintGLInterface(QPainter *painter,
const QStyleOptionGraphicsItem *option);
-- Richard
More information about the Plasma-devel
mailing list