Monday, February 15, 2010

javascript plasmoid errata; rekonq

With the Javascript Jam Session in full swing, a number of people are off to the races writing their Plasmoids in Javascript. That's the good news. The bad news is that they've uncovered some annoyances. So here are some quick notes/errata:


  • In 4.4.0 print() and debug() are broken; I thought a commit that made them work had been part of the 4.4.0 tag. Apparently it wasn't. This commit is in the 4.4 branch, however, and so will be part of 4.4.1. Some distributions offer packages that use the 4.4 branch directly, and if you are using one of those distributions I recommend taking advantage of that. :)

  • Assigning a pixmap to an IconWidget does not work. e.g. this fails (where icon.png is in contents/images/)
    var icon = new Iconwidget
    var pixmap = new QPixmap("icon.png")
    icon.icon = pixmap

    This is due to an unexpected (though understandable) limitation in QScript's magical abilities. It's usually so good on the "principle of least surprise" I was surprised to see that this didn't work. However, all is not lost as you can do this:
    var icon = new Iconwidget
    icon.setIcon("icon.png")

    I've put a QIcon bridge on the 4.5 feature list, though, to make this Suck Less(tm)

  • To get rid of a UI element permanently, you can call deleteLater() on it, e.g.:
    var icon = new IconWidget
    icon.deleteLater()

    This was undocumented because I was really hoping to find a slightly less ugly way (e.g. "delete icon") but didn't manage to get to that for 4.4.



Documentation continues to be improved and updated, but there are such holes / annoyances. I'll be adding errata .. somewhere .. on Techbase. I'm also working out how best to show API added in later versions, e.g. just keep adding to the current Javascript API page or to start a new page with just additions so it's easy to see what each version adds. Input welcome. :)

On a side note, I've started using the rekonq web browser lately. I'm using it straight from the git repository and even that is nice and stable. The KDE WebKit integration from the KDE Dev Platform is really great (passwords and what not from Konqi appear in rekonq) and my bookmarks are all there. Most importantly, it's fast and in my week or so of usage rock solid stable. There are some rough edges (keep in mind I'm using the mainline devel version of it) and some features I'd like to see implemented (which I'm not going to grouse about unless I find some time to whip up a patch or two or unless a rekonq devel asks me about it :), but so far I'm very happy with it. Some of the features like the thumbnails that appear when a tab is hovered are very nice, however, even if some graphical loving could improve it even more (e.g. fading them in/out would make it feel a lot less jumpy). I think I'll be sticking with rekonq for the time being, which might mean I'll be compelled to start submitting patches to iron out some wrinkles. We'll see. :)

23 comments:

Tom said...

I am impressed with Rekonq as well. I think it needs a cooler name quick or everybody will use it and the name will have stuck.
I love the adblocking and the speed. Really impressive.

tobami said...

It is good to see it goes on being developed and that it is not so far from being ready.

@Tom: agreed. Rekonq is really not a good option. It doesn't have to be the coolest name in the world, just something that can be written and pronounced without thinking thrice.

Don't underestimate the importance of a name!

illissius said...

"I think it needs a cooler name quick or everybody will use it and the name will have stuck."

I'm not sure. On the one hand maybe it's already happened; on the other hand plenty of people are using it already, yet as far as I can tell the only people who don't think it needs a better name are the developers, so there's probably not much danger of the name getting more entrenched just by more people using it.

Spockfish said...

Rekonq is my preferred browser at the moment. Konqueror is not up to it, and Firefox integration on KDE is ugly.

Now, to get more traction (and become the default KDE browser) it really needs a different name. I've checked it with my wife (as she fit's the 'non-geek-profile' :-) and she didn't understand it.

When I tried to explain to her the Konqueror/webkit/rekonq stuff .... Well, you can guess :-)

My simple wish for KDE 4.5 would be that Rekonq renamed would become the preferred KDE browser!

Dennis Martin said...

Remember Rekonq is in its early stages and there's already plenty of stuff planned for development. But yeah it's an amazing browser and I believe it will be the prefered choice for a lot of October distributions this year. Someone like you contributing would only make things even better :)

megabigbug said...

"the only people who don't think it needs a better name are the developers"

No, Rekonq's developers think it needs a better name and a better icon. They are just not good at this game (I admit they are a bit attached to the name).

I made the icon of rekonq 0.3 (with Ivan Čukić) because nobody in the oxygen team was interested. Nobody, perhaps because Rekonq was underestimated.

Now, Aaron uses rekonq, it means this browser is accepted by the community.

I hope the community will find a good name and a good icon design that keep the main idea of Rekonq: Renewal.

DeKay said...

I had proposed the name "Surfboard" to them a while back. If you are surfing the net, ya gotta have a good board. A pretty good name, IMHO. Easy to remember, easily pronounced, kinda cool.

illissius said...

I had proposed "Duck" simply because I like ducks, and it goes well with Dolphin, but perhaps that's too silly.

If everyone does in fact want a better name though then I'll start actually brainstorming to see what I can think of. Any specific goals in mind for what the name should be like?

Spockfish said...

"Duck" is nice, but I suggest 'Orca'. Orca and Dolphin, you're perfect tool box for (file) browsing!

Daniel said...

Spockfish : Unfortunately, the name "Orca" is already taken by a Firefox-based web browser on Windows.

vladimir said...

I found some more issues, and made workarounds:
1. None of the movementDirections for animations are defined in the script(at least I could not find a way to access them), so what I did was put these lines to the beginning of the main script file:

var MovementDir = {
'MoveLeft' : -8,
'MoveUpLeft' : -7,
'MoveDownLeft' : -4,
'MoveUpLeft' : -3,
'MoveUp' : 1,
'MoveRight' : 2,
'MoveUpRight' : 3,
'MoveDown' : 4,
'MoveDownRight' : 6
}


2. EasingCurves are not defined either, so I used these values.

So now I can define my animations like that:

anim = animation('slide');
anim.distance = 70;
anim.movementDirection = MovementDirMoveDownLeft;
anim.easingCurve = QEasingCurve(38);// outBounce easing curve

xbullethammer said...

What about sharK? hehe

Aaron J. Seigo said...

@vladmir: try this instead:

var anim = animation("slide")
anim.easingCurve = new QEasingCurve(QEasingCurve.OutBounce)
anim.movementDirection = animation.MoveLeft

Gerardo said...

"In 4.4.0 print() and debug() are broken;"

Wow, this explains much :-)

At the JavaScript Jam Session on Friday I wondered that nobody said anything about that. I was very confused that my example-Plasmoids always ended in "Script failure on line xxx: TypeError: Result of expression'print' [true] is not a function." and I assumed that's because of a configuration problem made by myself. Now I'm relieved ;-)

In this context, has anyone the same problems I have with the following two lines?

plasmoid.hasConfigurationInterface = false

plasmoid.apectRatioMode = IgnoreAspectRatio

I found them in one of Aarons blog entry, but they don't work for me...

Though the plasmoid doesn't crash, but (I think) this two lines were simply ignored by the JavaScript-Engine...

Gerardo said...

@Gerardo: Problem partly solved ;-)

The AspectRatio-thing was a stupid copy&paste error:

"plasmoid.aspectRatioMode = IgnoreAspectRatio"

..and after that, I'm not sure if I understand what the hasConfigurationInterface-thing really does. I thought that's for not showing the Configuration-dialog by clicking on the spanner-icon... (?)

Aaron J. Seigo said...

the configuration interface is usually still shown so the user can set things like a global shortcut for the Plasmoid.

this is pretty specific to plasma-desktop, however, and other plasma based apps may not do this (making setting whether or not there's a config interface still useful in the generic case)

pano said...

@aseigo:

We would be glad to hear about your wishes :-)
If you can find the time, please share them with us :-D (e.g. on rekonq@kde.org or on bko (bugs.kde.org))

For other people interested in rekonq's roadmap:
http://techbase.kde.org/Projects/rekonq/Roadmap

:-)

Federico said...

aaseigo: I think you are much more interested in the "home" page is'n it? ;)
I was waiting to learn to write scripted plasmoids to work on it, but... now you noticed it, so... astonish us!

gab said...

Name brainstorming!!! yeah!!! :))

jumper
surf
nomad
ride

...or the more classic ones:
katamaran
kimba
viktor

Nikita Melnichenko said...

Could you publish a patch for print-debug issue for KDE SC 4.4.0?

Nikita Melnichenko said...

Never mind, I've found your post with errata tarball.

Aaron J. Seigo said...

for others reading these comments, the post Nikita refers to is this one:

http://aseigo.blogspot.com/2010/02/daily-javascript-update.html

MetalByte said...

@Spockfish, take a look at OpenSuse 11.2 Firefox integration, plus new theme on kde-look (on the top of the highest rated) and some Firefox addons like Flashgot, ect. Now, Firefox looks and works at best on KDE4... The problem is Firefox itself, leaving the impression of a large dinosaur that only fat and fat. KDE users we need a good brand browser fully integrated, and rekonq seems the way. So what will happen then with Konqueror (my default browser right now)?

Orca sounds good for 1.0 (rekonq 4.0) presentation inside the KDE stream, but we can use Orka instead :)