Sunday, April 26, 2009

plasmoidviewer

If you're writing Plasmoids, testing them is made a lot easier with plasmoidviewer. With scripted Plasmoids you can even skip the compile stage and go straight to ... damn ... plasmapkg -u <path/to/package>. Having to run that command every time and wait for the call to ksycoca is a major buzz kill. It's like racing on the autobahn with the wind in your hair only to hit a playground zone.

A small voice whispered in my ear, "Use the source, Luke!" and I was like, "Dude, for the millionth time, my name's not Luke!" Having ghostly voices whisper mystic wisdom in your ear is bad enough, but at least he could get my name right. ;P

So I added Applet::loadPlasmoid to libplasma and added a couple lines to plasmoidviewer so that you can have it load Plasmoids right from their location on disk without installing them. This means if your package is in ~/src/MyAwesomePlasmoid you can just do: `plasmoidviewer ~/src/MyAwesomePlasmoid`. Even better, if you are in ~/src/MyAwesomePlasmoid you can just do `plasmoidviewer .` Having accomplished that I realized that even that was one character too much and so with a very minor tweak (involving deleting a couple of lines, actually) you can now sit in the root of your Plasmoid structure and run `plasmoidviewer` and up comes your work.

Plasmate will make this even easier, but until it's ready and for those of us who are console addicted this is quite nice. Speaking of Plasmate, it also required this new Applet::loadPlasmoid method. We had an irc meeting today about Plasmate with a couple of SoC/SoK students. Artur led it and Richard Moore helped steer the discussion. I was asleep for most of it (dang timezones!), but they did a great job without me (no big surprise there :) and it seems we'll be off to a running start in no time on getting Plasmate in working order.

12 comments:

rat said...

A similar voice poked me a months ago :) But I ignored him, this time he found a right person to talk with, thanks to the force :)

I always getting trouble with this and I fixed it with very hacky way;

$ cat `which mkplasma `
#!/bin/bash
cd $1
rm ../$1.zip
zip -r ../$1.zip .
plasmapkg -r $1
cd ..
plasmapkg -i $1

for now we dont need to install it yay \o/

Aaron J. Seigo said...

@rat: a couple of comments on your script (which is useful for people on 4.2):

a) you don't need to zip it; plasmapkg works on directories too.

b) `plasmapkg -u` is equivalent to doing -r then -i

Jan Schulz said...

Unfortunately this is still manual. Can't there be a scripted version (maybe even with a kind of recorder), which can be used for unit testing?

Kevin said...

On the topic of plasmoidviewer:

a user in forum.kde.org once complained that he didn't like how more and more "system tray" funcationality was being moved to plasmoids.

Telling him that he could run individual ones with plasmoidviewer made him a happy camper again :)

Gökmen Göksel said...

I didn't know it is working with directories, because before 4.2 it was not working, thanks :)

Aaron J. Seigo said...

@Jan Schulz: what sort of unit test functionality are you looking for exactly?

Jaye said...

I always knew the force liked you better! :)

Peter said...

Oh sorry just ignore my prev. comment. Very please??

Peter said...

Thanks for the great update!
What about defaulting to "." when just starting "plasmoidviewer" without any arguments? :)

Storytots said...

Can you please kindly post some recent screenshots of plasma and its theming. The new cashew and tabbing of the desktops looks very interesting. Thanks!

Jan Schulz said...

Unitests: If the viewer could record the clicks (or whatever the inputs) and the responses in a scriptlike way, you could use that for unitests: replay the input script and you should get the same output. Ok, output expectations would only be useful if you can specify ranges or similar things. But at least for the data engines it would be a great way to write test cases.

Aaron J. Seigo said...

@Jan: an input record/replay system is probably slightly out of scope for plasmoidviewer; you can test dataengines quite easily from non-gui code (e.g. unit-tests)