Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about open source (old posts, page 4)

New project: marave, a relaxed text editor

An­nounce­men­t:

Mar­ave (noth­ing, in guaraní) is a re­laxed text ed­i­tor. Its goal is to let you fo­cus in your writ­ing, free of vis­ual dis­trac­tions and clut­ter.

It is writ­ten us­ing PyQt, so it should work in all ma­jor plat­form­s, and it is li­censed un­der the GPLv2 so it is free soft­ware.

You can find the cur­rent SVN (no re­lease yet) at http://­mar­ave.­google­code.­com

Screen­shot­s:

snapshot10snapshot9snapshot8

Sta­tus:

It's not fin­ished yet, but it has the fol­low­ing fea­tures:

  • You can ed­it text

  • Min­i­­mal­is­tic, "van­ish­ing" us­er in­­ter­­face

  • (Op­­tion­al) au­­dio feed­back for the key­board

  • (Op­­tion­al) re­lax­ing mu­sic (re­quires in­­ter­net ac­cess)

  • You can cus­­tom­ize the back­­­ground, font, colours, and sounds

  • Live spell check­­ing (re­quires pyen­chan­t)

There are al­so some ma­jor miss­ing fea­tures:

  • Search and Search/Re­­place is not im­­ple­­men­t­ed

  • UI cus­­tomiza­­­tions are not stored

  • UI has to be cleaned up a lot more

  • It does­n't ask to save when clos­ing

  • Au­­tosave not im­­ple­­men­t­ed

And at least one known bug:

  • In win­­dows the wid­gets are not well placed Fixed in SVN

A litte his­to­ry:

A few days ago, I saw ommwrit­er men­tioned in a tweet or some­thing sim­i­lar.

I was think­ing "nice thing", but in the back of my mind I was al­so think­ing "that can't be too hard to do". Af­ter al­l, the hard part of cre­at­ing a pro­gram is mak­ing it do things, right?

Well, yes and no. I did man­age to cre­ate a some­what rea­son­able fac­sim­i­le in a day, but tweak­ing the looks of it is driv­ing me nuts :-)

python-keyring is seriously nice

Many pro­grams re­quire pass­words from the us­er.

It's nice when a pro­gram can re­mem­ber the pass­word you give it.

It's nicer when it stores said pass­word safe­ly. How­ev­er, it's not triv­ial to do that if you care for cross-­plat­form sup­port.

Or at least it was­n't un­til Kang Zhang wrote python keyring, a mod­ule that ab­stracts the pass­word stor­age mech­a­nisms for KDE, GNOME, OSX and win­dows (and adds a cou­ple of file-based back­ends just in case).

So, how does it work?

In­stall it in the usu­al way. If it's not pack­aged for your dis­tro/­op­er­at­ing sys­tem, just use easy_in­stal­l:

easy_install keyring

You could al­so get it from mer­cu­ri­al:

hg clone http://bitbucket.org/kang/python-keyring-lib/

The API is sim­plic­i­ty it­self. This is how you save a se­cret:

import keyring
keyring.set_password('keyring_demo','username','thisisabadpassword')

You may get this di­a­log (or some ana­log on oth­er plat­form­s):

keyring1

And here's the proof that it was saved cor­rect­ly (this is KDE's pass­word man­ager):

keyring2

And how do you get the se­cret back?

import keyring
print keyring.get_password('keyring_demo','username')

This is how it run­s:

$ python load.py
thisisabadpassword

As you can see, the API is as easy as it could pos­si­ble get. It even chose the KWal­let back­end au­to­mat­i­cal­ly be­cause I am in KDE!

Python-keyring is a mod­ule that fix­es a big prob­lem, so a big thank you to Kang Zhang and Tarek Zi­adé (who had the idea)

The smartest thing I ever wrote

When I was mi­grat­ing the com­ments I no­ticed a page looked wrong in the site, and start­ed fix­ing it.

While I was read­ing, I no­ticed a cou­ple of things:

  • It was pub­­lished al­­most ex­ac­t­­ly 5 years ago

  • It may be the smartest thing I ev­er wrote

Some­times, you get an idea, and you can give it shape. Since I re­al­ly think it's not com­plete­ly stupid, I trans­lat­ed it to sp­nish (there was on­ly an eng­lish ver­sion) y "reprint" it to­day.

It's about pro­gram­ming, it's about evo­lu­tion, and I hope you like Be­ing a good Lamar­ck­ian frog­gie!.

New 24-hour app coming (not so) soon: foley

First a short ex­pla­na­tion:

24-hour apps are smal­l, self­-­con­tained projects where I in­tend to cre­ate a de­cen­t, use­ful ap­pli­ca­tion in 24 hours. The con­cept is that:

  1. I will think about this app a lot for a while

  2. I will de­sign it in my head or in writ­ten notes

  3. I will code, from scratch, for 24 hours.

  4. That's not one day, re­al­­ly, but 24 hours of work. I can't work 24 hours straight any­­more.

The last time around this did­n't quite work as I in­tend­ed, but it was fun and ed­u­ca­tion­al (for me at least ;-) and the re­sult­ing app is re­al­ly not bad!

So, what's fo­ley go­ing to be? A note-­tak­ing app aimed at stu­dents and con­fer­ence pub­lic.

In your last geeky con­fer­ence, did you no­tice ev­ery­one is us­ing a com­put­er?

And what are they tak­ing notes on? Vi? Kwrite? OpenOf­fice? What­ev­er it is they use, it's not meant to be used for this pur­pose.

So, what will fo­ley do dif­fer­en­t? I don't quite know yet, but I have some ideas:

  1. A strong time­­line ori­en­­ta­­tion. Ev­ery para­­graph will be dat­ed.

  2. Twit­ter/I­­den­ti­­ca sup­­port. Want to live­blog your notes? Just click.

  3. Mul­ti­me­­dia in­­­cor­po­rat­ed in the time­­line.

    • We­b­­­cam/Au­­­dio record­ing synced to your notes?

    • Im­ages im­­­port­ed and added in the time­­­line?

    • At­­­tach files to the time­­­line? (Use­­­ful for slides?)

  4. If pro­vid­ed with a PDF of slides, at­­tach each slide to the right mo­­ment in the time­­line

  5. Easy web pub­­lish­ing: find a way to put this on a we­b­­page easy and quick (s­in­­gle-click pub­­lish­ing is the goal)

I have on­ly thought about this for about 10 min­utes, but I see po­ten­tial here.

The bad news is... I have a ton of pay­ing work to do. So this will prob­a­bly on­ly hap­pen in Jan­u­ary. How­ev­er, I want­ed to post it so I can take in­put while in this plan­ning phase.

So, any ideas?

Making a unique application using python and DBUS

No, not unique in the sense "o­h, this app is a spe­cial snowflake", but unique in the sense "y­ou can on­ly run one copy of this ap­pli­ca­tion".

I tried googling for it and I al­ways found the same an­swer, "use dbus, try to own the name, if it ex­ists al­ready, then a copy is al­ready run­ning".

What I could not find is one work­ing ex­am­ple of this, or at least not some­thing con­ve­nient­ly la­beled "here is how you do a unique ap­pli­ca­tion us­ing dbus and python".

So, here is how you do a unique ap­pli­ca­tion us­ing dbus and python:

Sup­pos­ing your ap­pli­ca­tion is called uRSSus (mine is):

session_bus = dbus.SessionBus()
try:
    session_bus.get_object("org.urssus.service", "/uRSSus")
    # This is the second copy, make the first one show instead
    # TODO: implement
except dbus.DBusException: # No other copy running
    # This will 'take' the DBUS name
    name = dbus.service.BusName("org.urssus.service", bus=session_bus)
    # Now, start your app:
    window=MainWindow()
    object = UrssusServer(window,name)
    :
    :
    :
    etc, etc

And that's it. No, it's not hard, but since the DBUS docs seem to be... rather they seem al­most not to be some­times, ev­ery lit­tle bit may help.