The other day I met with a couple of local entrepreneurs whom Chani had met at the recent Qt Dev Days in California. The four of us gathered around some tasty vegetarian vittles and discussed small devices, Qt and Plasma. It was a good time and we found a lot of common ground .. including agreeing that Javascript is a great language for writing little user interface elements quickly that will run reliably.
In that vein, I've been working on getting the Simplified Javascript API for writing Plasmoids ready for creating more than just toys. To that end, all the Plasma user interface elements (pushbuttons, etc) are available including the complex ones like the TabBar, Animations are fully supported, we have AnchorLayouts (and maybe even GridLayouts soon) in addition to LinearLayouts and, perhaps most exciting, we now have the ability to load API extensions.
An API extension is a security controlled set of functions and objects that are loaded on demand. These extensions are requested by the widget by listing the required and/or the optional extensions it wants loaded in its metadata.desktop file. This way, even prior to the widget being loaded we can know what it will want. The Simplified Javascript Engine then decides if the widget will actually get that extension or not.
There are a set of built-in extensions currently defined: FileDialog, LocalIO, NetworkIO, HTTP and LaunchApp. They each do what you expect, with NetworkIO being a generalization of HTTP. I'm busy implementing each of them between now and the end of next week. We aren't limited to these built-ins, however: any QScriptEngine extension plugin can be loaded, security willing, just by listing it in the metadata.desktop file. This means that widgets can be extended with arbitrary functionality.
The security framework is still in development, but all the hooks are there with some of the pieces in place now. Most importantly, we know exactly how we want to implement the missing bits. I'll be working on filling in the gaps as I can, and hopefully when Rob returns with hacking time again (or someone else steps up in the meantime) that will go a bit faster.
The other important bit has been to actually document what the Simplified Javascript API provides. The relevant file in kdebase/workspace/plasma/design/ has been morphing into increasingly comprehensive API documentation. What I need to do is turn this mammoth file int a nice set of web pages that I can add to a revamped plasma.kde.org. Any one out there up to doing some HTML slicing and dicing?
There are also a growing number of examples to augment the documentation and which are just begging for Techbase tutorials to be written around.
Add to this the progress being made with Plasmate and the ability to script plasma-desktop itself with Javascript and things are looking better and better for Javascript in 4.4. Huzzah.
In an unrelated side note, Markey's blog entry on finding a balance in software configurability is really well written and makes several excellent points with great clarity. A must read if you haven't already seen it, in my humble opinion. :)
Thursday, November 19, 2009
Subscribe to:
Post Comments (Atom)

8 comments:
Interesting.
On a related note - are there javascript bindings for writing standard KDE4 apps?
a full set of JS bindings for Qt and KDE libraries that uses smoke and QtScript are being developed.
you can find the project here:
http://gitorious.org/qtscript-smoke/
when those are done, it should be possible.
Thanks. I'm interested because of QtWebKit (or KWebKit). One of the reasons I really like Firefox is its ease of extension via JavaScript/XUL, there's a lot of third party stuff out there that adds a huge amount of functionality. However its integration with KDE leaves a lot to be desired.
If we could script up a browser wrapper round WebKit using JS with a well defined extension api hopefully it could gain an equal amount of third party developer support.
Of course we could use kdebindings (Python, Ruby, Mono) but JS seems more popular for the task.
QtWebkit makes that very easy to accomplish; it could even done from within libplasma for webkit-using plasmoids if we provided bindings to the qtwebkit dom, etc. api.
Awesome
"What I need to do is turn this mammoth file int a nice set of web pages that I can add to a revamped plasma.kde.org."
Can you also leave it as one big HTML file? I hate looking through documentation spread over a bunch of little files. It's so hard to find stuff. If it's all in one big file then I can just tap <alt>+F and start typing.
"Any one out there up to doing some HTML slicing and dicing?"
I am.
@yman: can you send me an email or find me on irc? the document is growing by the day :)
Post a Comment