ChaniBlog











{January 18, 2009}   adventures in plasmaland, part 3

it’s day… 2? now, and near the end of the presentations I got the urge to write code. so now I bet everyone else is in the ocean, but I just can’t tear myself away until I get a few more bits working. :) perhaps it’s a good thing the internet is being crap, or I’d end up on irc… although not being able to commit is a PITA, and will make it harder for me to show incremental code improvements. we need git.

anyways, I started a new plasmoid. I think I might rewrite the other one in C++ – it’s either that or write a bunch of bindings or write a dataengine. but this new one should be more suited to scripting. it’s something pete calls a “victory calendar”. the idea is that you have a list of tasks that you need to do every day (like studying a language or doing pushups), and every day you record whether you did a lot, a little or nothing for each task, and so long as you don’t have lots of nothing you reach victory. :) recording your progress is meant to motivate you to actually do things – either by showing you that you’ve been slacking off, or showing you that you’re doing well – either way you’re less likely to forget about it and give up.

so, being lazy, I start by copying my last plasmoid. then we change the metadata – we need a name, icon, description and sane default size – and delete half the crap in the old code. now we’ve got something we can install and run and it shows a pretty icon. :)

next, I added a label.

layout = new LinearLayout(plasmoid);
layout.setOrientation(QtHorizontal);

//start with one task and name it
taskName = new Label();
layout.addItem(taskName);
taskName.text = "do something"; //setText doesn't exist. interesting.

I stole this code from the nowplaying example. what I found interesting is that it’s using the qt properties system, so instead of taskName.setText(“do something”); we have taskName.text = “do something”;
while adding the label, I also set the layout to be horizontal. I’ll need a better layout later, but for now I’m just making one task with one day’s record.

so, that pretty icon… that turns into the progress indicator. :)

progress = new IconWidget();
progress.setIcon("view-calendar-tasks");
layout.addItem(progress);

//and the icon does something!
plasmoid.moreProgress = function()
{
print("triggered!");
progress.setIcon("configure");
}
progress.clicked.connect(plasmoid.moreProgress);

we make a function to change its icon, and connect that to its clicked signal. we’ll need three states with appropriate icons soon, but for now I’ll just make it change back to the configure icon.

victory!

and so another plasmoid has begun… and I want to go to the beach now. :) after we get that progress icon working we’ll need to configure the name of the task, allow more than one task, then track and display data from previous days.



So that’s where you disappeared to after the talks… I’m feeling the itch to code too, but of course I’m getting distracted by Planet and IRC.

I love the idea of the Victory Calendar, I’ve wanted something similar or a damn long time.

Beach!



wadejolson says:

Hacking on the beach … they don’t exclude each other.

— sebas, Chani, Jos, Blauzahl, WindowsUninstall, Zack, Wade, Till, Romain



doviende says:

original victory calendar idea came from here:
http://www.alljapaneseallthetime.com/blog/chinese-project-notes-10-big-developments-anki-text-to-speech-cantonese-victory-calendar

scroll down to where it says “victory calendar” and it has khatsumoto’s explanation and motivation for it.



Comments are closed.

et cetera
%d bloggers like this: