Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about open source (old posts, page 3)

DBUS-reactor, or AsusOSD must die!

How to write a tiny python app (less than 50 lines) that re­acts to events on the DBUS bus­es. For ex­am­ple, dis­play­ing a no­ti­fi­ca­tion when you press one of your key­board­s' spe­cial keys.

Read all about it

I knew not doing it was smarter, or how HTML5 and Qt do my work for me.

I wrote a while ago a RSS pro­gram called uRSSus. I ex­pect I am the on­ly us­er of it be­cause it has some prob­lems (all of them my fault ;-) but I re­al­ly like it.

For a while now I have want­ed it to have pod­cast sup­port. The thing is... that al­ways seemed like a lot of work. Sure, us­ing phonon I can cre­ate an au­dio play­er and ev­ery­thing, but...

I am us­ing a HTML wid­get to dis­play the post­s, so I would have to find a way to add the au­dio play­er to the UI and ... too much work.

So, to­day I woke up and thought... wait a minute... Qt's HTML wid­get is based on We­bkit. And We­bkit sup­ports HTM­L5. And HTM­L5 has an "au­dio" tag.

So, if I fixed uRSSus to fetch the en­clo­sure links, and added them in the database, and then added this to the post tem­plate:

<?py for enclosure in  post.enclosures: ?>
  <audio autobuffer="Yes" controls="controls" src=#{enclosure.href}></audio><br>
<?py #end ?>

Would­n't that ac­tu­al­ly work? Well, yeah!


So there you have it, I was right not to im­ple­ment it, be­cause the eas­i­est way is to let Qt do it ;-)

My first public python code works!

No, this is not a post an­nounc­ing I just wrote my first pub­lic python code. This is a post about my first pub­lic python code... from 1996!

In 1996, the soon-­to-be-here year of the Lin­ux desk­top was fu­eled by one of the mar­quee open source ap­pli­ca­tions of the time: LyX.

LyX was (is) a sort of word pro­ces­sor where you wrote and gen­er­at­ed La­TeX which then pro­duced what­ev­er you used to print. But I am di­gress­ing: LyX was cool be­cause it used one of the first good free graph­i­cal toolk­it­s: XForm­s.

Ok, it was not re­al­ly free, be­cause you could­n't dis­trib­ute patch­es.

And it was not all that good ei­ther, but we were com­par­ing it with Mo­tif, so it was much more free and much bet­ter than that mon­stros­i­ty.

BTW: The lat­est re­lease of XForms is from au­gust of 2009.

At the time, a 25-year-old me was in love with Python 1.3. Here's how I de­scribed it:

Python 1.3

It's a beau­ti­ful ,free, lan­guage. Get it from ft­p://ft­

Yes, Python 1.3. So, I want­ed to use this C GUI tool­kit used in this cool ap­p, and this neat lan­guage I was learn­ing and use them at the same time.

I ran (not walked) to my faith­ful Slack­ware 3.0 ELF in my 486DX2 PC and start­ed hack­ing. In a week­end or so I had a work­ing bind­ing.

I even start­ed writ­ing the holy grail of desk­top ap­pli­ca­tion­s, a GUI ver­sion of Pine, us­ing python and its IMAP mod­ule (python mail­er, or PyM):


I re­leased ver­sion 0.1 al­pha in 1996, May 13 ... and a few months lat­er Matthias Et­trich start­ed KDE and I found Qt and nev­er thought about XForms again.

Un­til this month.

For rea­sons that don't mat­ter, I men­tioned PyM in the PyAr mail­ing list the oth­er day, and ... well, would pyx­forms still work?

Why, pret­ty much, yeah!

I got the pyx­form­s-0.1-al­pha sources from some­where in the in­ter­net, in­stalled XForms 1.0.92sp2 (yes, the lat­est re­lease, from three months ago), of course I al­ready had python 2.6.4 in­stalled, added a set­, edit­ed 10 lines of code and...


Yes, it work­s. You can get this 0.2 ver­sion (co­de­name "C­thul­hu was here") here just 13 years af­ter 0.1.

No, I don't un­der­stand the weird round­ed cor­ner­s, or why the cur­sor looks weird and old when it's in­side the win­dow.

It's a RE­AL­LY small and fast toolk­it, though.

Hon­est­ly, is it use­ful for ay­one? Al­most cer­tain­ly not. Am I amazed some­thing I wrote in 1996 still work­s? Oh, yeah I am.

24-hour app #1: Die Schere, a video editor

I have long known that ap­pli­ca­tion de­vel­op­ment is an ar­du­ous process. I have al­so long sus­pect­ed one of the rea­sons it's ar­du­ous is the de­vel­op­er. I should be more speci­fic, I am one of the rea­son­s.

That's be­cause I don't know what I am do­ing, and I don't mean that in the "I am a lame pro­gram­mer" sense (even if that's al­so true some­what), but in the sense that I lit­er­al­ly don't know what the app should look like, or what its fea­ture set should be.

So, I have de­cid­ed to em­bark on a se­ries of ex­per­i­ments I will call 24-hour app­s.

Here are the rules:

  • I shall cre­ate a neat ap­­pli­­ca­­tion, sta­ble, use­­ful, us­able and de­­cen­t-look­ing.

  • I shall do it in no more than 24 hours. Af­ter that time, it should be at least good enough for a pre­view re­lease, if not a be­­ta.

  • Those 24 hours can be split in two or three ses­­sions

  • Time spent do­ing icon­s, doc­s, etc, counts.

  • All de­vel­op­­ment shall be pub­­lic (I am us­ing github)

  • I must have a use for the re­­sult­ing ap­­pli­­ca­­tion, and it should be at least an ad­e­quate so­lu­­tion for that prob­lem.

So, what's the first pro­jec­t? I call it Die Schere (The Scis­sors in ger­man) and it's a video ed­i­tor.

It's not a kden­live re­place­men­t, it's just the video ed­i­tor I wish I had when I need­ed to glue a piece of one video with a piece of an­oth­er.

In the old, pre-dig­i­tal world, that was done us­ing a cut­ter and scotch tape. I want Die Schere to be as use­ful and com­pre­hen­si­ble as that was, but use­ful for clum­sy peo­ple like my­self.

Here is a video af­ter to­day's ses­sion, which last­ed 8 hours:

The ba­sic func­tions are there, even if lots of work is still need­ed.

  • You can load clips to work with them

  • You can cut clips (like us­ing a cut­ter!)

  • You can choose the cut points in­­ter­ac­­tive­­ly or by ed­it­ing a time

  • You can ar­range them (like us­ing scotch tape!)

  • You can gen­er­ate the out­­put video

As a back­end it's us­ing men­coder, but there's no rea­son it should­n't work with ffm­peg or melt if some­one writes 20 lines of code.

Contents © 2000-2020 Roberto Alsina