Posts about qt (old posts, page 3)

2010-01-19 14:12

Happy 10th blogiversary to me!

Since yesterday this blog is ten years old so, time for some history.

It all started in advogato where you could still read it today! (Please read it here instead ;-)

Then it moved to PyDS an early python desktop blog platform with a web interface, and was hosted in PyCS, a free service.

Then PyCS kinda died, and I started generating a static blog and hosting it in my ISP's free hosting. That sucked bad.

Then I started my own company, and I had my own servers, so I started hosting it there (even today this blog is completely static HTML!)

Then PyDS started acting weird, so I wrote my own blogging software, which is a real mess, perhaps 25% finished, but it does things exactly the way I like them.

Currently, this blog is syndicated in Planeta PyAr, Planet Python, Planet Qt, Planeta LUGLI, and a couple other places.

This year, I decided to make the blog completely bilingual (English and Spanish), but I hate translating it.

According to the stats I have available, the blog is in average more popular now than ever (but yes, my most popular posts were years ago ;-)

stats

These are the most popular pages in the last year:

Lessons:

  1. I need to write more about Qt and/or start flamewars with clueless IT writers
  2. I need to search for ancient material and deprecate it
  3. Having your own hosting and blogging software is neat
  4. 10 years is a lot of time: 860 posts (or 913, depending on how you count)

2009-12-21 14:39

python-keyring is seriously nice

Many programs require passwords from the user.

It's nice when a program can remember the password you give it.

It's nicer when it stores said password safely. However, it's not trivial to do that if you care for cross-platform support.

Or at least it wasn't until Kang Zhang wrote python keyring, a module that abstracts the password storage mechanisms for KDE, GNOME, OSX and windows (and adds a couple of file-based backends just in case).

So, how does it work?

Install it in the usual way. If it's not packaged for your distro/operating system, just use easy_install:

easy_install keyring

You could also get it from mercurial:

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

The API is simplicity itself. This is how you save a secret:

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

You may get this dialog (or some analog on other platforms):

keyring1

And here's the proof that it was saved correctly (this is KDE's password manager):

keyring2

And how do you get the secret back?

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

This is how it runs:

$ python load.py
thisisabadpassword

As you can see, the API is as easy as it could possible get. It even chose the KWallet backend automatically because I am in KDE!

Python-keyring is a module that fixes a big problem, so a big thank you to Kang Zhang and Tarek Ziadé (who had the idea)

2009-12-16 17:12

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

First a short explanation:

24-hour apps are small, self-contained projects where I intend to create a decent, useful application in 24 hours. The concept is that:

  1. I will think about this app a lot for a while
  2. I will design it in my head or in written notes
  3. I will code, from scratch, for 24 hours.
  4. That's not one day, really, but 24 hours of work. I can't work 24 hours straight anymore.

The last time around this didn't quite work as I intended, but it was fun and educational (for me at least ;-) and the resulting app is really not bad!

So, what's foley going to be? A note-taking app aimed at students and conference public.

In your last geeky conference, did you notice everyone is using a computer?

And what are they taking notes on? Vi? Kwrite? OpenOffice? Whatever it is they use, it's not meant to be used for this purpose.

So, what will foley do different? I don't quite know yet, but I have some ideas:

  1. A strong timeline orientation. Every paragraph will be dated.
  2. Twitter/Identica support. Want to liveblog your notes? Just click.
  3. Multimedia incorporated in the timeline.
    • Webcam/Audio recording synced to your notes?
    • Images imported and added in the timeline?
    • Attach files to the timeline? (Useful for slides?)
  4. If provided with a PDF of slides, attach each slide to the right moment in the timeline
  5. Easy web publishing: find a way to put this on a webpage easy and quick (single-click publishing is the goal)

I have only thought about this for about 10 minutes, but I see potential here.

The bad news is... I have a ton of paying work to do. So this will probably only happen in January. However, I wanted to post it so I can take input while in this planning phase.

So, any ideas?

2009-12-11 11:04

Making a unique application using python and DBUS

No, not unique in the sense "oh, this app is a special snowflake", but unique in the sense "you can only run one copy of this application".

I tried googling for it and I always found the same answer, "use dbus, try to own the name, if it exists already, then a copy is already running".

What I could not find is one working example of this, or at least not something conveniently labeled "here is how you do a unique application using dbus and python".

So, here is how you do a unique application using dbus and python:

Supposing your application 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 almost not to be sometimes, every little bit may help.

2009-12-03 10:44

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

I wrote a while ago a RSS program called uRSSus. I expect I am the only user of it because it has some problems (all of them my fault ;-) but I really like it.

For a while now I have wanted it to have podcast support. The thing is... that always seemed like a lot of work. Sure, using phonon I can create an audio player and everything, but...

I am using a HTML widget to display the posts, so I would have to find a way to add the audio player to the UI and ... too much work.

So, today I woke up and thought... wait a minute... Qt's HTML widget is based on Webkit. And Webkit supports HTML5. And HTML5 has an "audio" tag.

So, if I fixed uRSSus to fetch the enclosure links, and added them in the database, and then added this to the post template:

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

Wouldn't that actually work? Well, yeah!

urssus26

So there you have it, I was right not to implement it, because the easiest way is to let Qt do it ;-)

2009-10-23 23:27

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

I have long known that application development is an arduous process. I have also long suspected one of the reasons it's arduous is the developer. I should be more specific, I am one of the reasons.

That's because I don't know what I am doing, and I don't mean that in the "I am a lame programmer" sense (even if that's also true somewhat), but in the sense that I literally don't know what the app should look like, or what its feature set should be.

So, I have decided to embark on a series of experiments I will call 24-hour apps.

Here are the rules:

  • I shall create a neat application, stable, useful, usable and decent-looking.
  • I shall do it in no more than 24 hours. After that time, it should be at least good enough for a preview release, if not a beta.
  • Those 24 hours can be split in two or three sessions
  • Time spent doing icons, docs, etc, counts.
  • All development shall be public (I am using github)
  • I must have a use for the resulting application, and it should be at least an adequate solution for that problem.

So, what's the first project? I call it Die Schere (The Scissors in german) and it's a video editor.

It's not a kdenlive replacement, it's just the video editor I wish I had when I needed to glue a piece of one video with a piece of another.

In the old, pre-digital world, that was done using a cutter and scotch tape. I want Die Schere to be as useful and comprehensible as that was, but useful for clumsy people like myself.

Here is a video after today's session, which lasted 8 hours:

The basic functions are there, even if lots of work is still needed.

  • You can load clips to work with them
  • You can cut clips (like using a cutter!)
  • You can choose the cut points interactively or by editing a time
  • You can arrange them (like using scotch tape!)
  • You can generate the output video

As a backend it's using mencoder, but there's no reason it shouldn't work with ffmpeg or melt if someone writes 20 lines of code.

2009-10-02 22:58

Bookrest: the stylesheet editor in action

As usual, a video showing it:

The current status is that the infrastructure required for the stylesheet editor is in place:

  • I figured out how to turn the StyleSheet object back into a JSON stylesheet.
  • The changes are done and merged back into the same file.
  • There is UI for 3 of the 6 required pieces. The missing ones are text styles, embedded fonts, and config options (like, break subsections to odd pages)
  • The UI for the whole app is pretty rough, I am in full make-it-functional mode right now. It will be rethought later on.

2009-09-28 11:24

Bookrest: it was meant to be a stylesheet editor.

In my original post about it I was referring to Bookrest as a stylesheet editor for rst2pdf, because that's what I wanted, a way to test style changes and see what they did.

Of course, one thing lead to another and it's starting to look more like a word processor than anything else, but ... well, how about a stylesheet editor?

Sure, you can use the "Style" tab, and edit at will, but that's not exactly fun for everyone.

So, let's work on one. Here's the video of the current status:

Of course, this is about 1/20th of the stylesheet editor, but at least the dialog is there, and most of the remaining work is wiring dialogs, which is quick using designer.

Contents © 2000-2018 Roberto Alsina