Posts about programming (old posts, page 22)

2008-10-30 16:59

Blogging from LatinoWare

Just finished speaking about PyQt programming in LatinoWare.

It went ok, but I ran out of time, so no Q&A, and I couldn't show about 20% of the code. :-(

Anyway, here is the code in its different stages, so you can see the "evolution" of a simple PyQt app. I will probably turn it into a real tutorial in a few days and post it.

Here is the guide I was using for myself when doing the presentation:

    1. App backend (1/
    2. Basic window with a treewidget Columns Task/Date/Tags
    3. Compile archivo .ui, show how it works
    4. Template for
    1. Load backend data in the task list
    2. Show interaction is broken
    1. Explain signals/slots
    2. Show difference between 1/ 2/
    3. Explain autoconnect, show on_lista_itemChanged
    4. Show task persistence working
    1. Fix tree decorations
    2. Make items editable
    3. Explain changes in on_lista_itemChanged
    4. Explain the problem with editing date and tags inline
    5. New idea: use a dialog to edit tasks (editor.ui)
    6. Explain layout managers
    1. Show changes in
    1. Actions
    2. Show actions in designer
    3. Show actions in
    1. Tray
    2. Show tray class in
    3. Show tray behaviour
    4. Show differences in

2008-10-09 21:54

rst2pdf: presentations

I have been thinking about using rst2pdf to create presentations. I finished exposing PDF transitions today, and that part works nicely.

Still needed:

  • Some sort of "page decoration" feature.
  • Handout support? I think this would work nicely with some sort of "conditional" directive. I need to think about it some more.

I intend to have that done for next friday, and release then.

2008-10-02 11:02

Programming and Life plans.

First a huge announcement: I will not release anything tomorrow. For the first time in 6 weeks, no friday release from me!

Now, let's see what I'm planning.

  1. I will be at LatinoWare 2008 speaking about PyQt. The usual free beer offer: if you mention this blog, I will buy you 1 (one) not very good beer. Being in Brazil, that's probably a Brahma.

  2. rst2pdf development is slowing down. The easy stuff is all done. There are some things I can do, though:

    • Expose transitions to the writer (good for presentations)
    • "Background" forms (again, for presentations)
    • A mini-language exposing the canvas, so there is a useful "raw" mode.
    • Using svglib instead of uniconvertor to handle SVG (but keep uniconvertor for other vector formats)
    • Redoing lists, which have a shaky code and bad layout
    • Fix half a dozen bugs
    • Make it work more like a unix app when in unix (respect environment vars, for example)

    However, I am taking a little time off from it, and going to try reviving other projects. Focusing in rst2pdf for two months did wonders for it. Let's see if it can be repeated!

  3. Try some more code golfing. I helped Nubis from PyAr reach the lowest-score of 74 in the grid challenge. This is really fun stuff.

  4. I need more money. We have spent lots in ... plumbing. Yup. Two years of savings spent on that. So, I need money. If you read this blog and want to make me happy, get me freelance work. It can be sysadmin stuff, it can be programming, it can be babysitting. I am good at all three things. Contact me. I'm easy to find, and I am cheap(ish).

  5. No, I am not starving. No, I am not in money problems. Yes, my company is doing very well, but it's an investment, not a cash cow (yet).

2008-10-01 16:57


I spent a few hours today round Code Golf and here's a neat thing I did.I think this is python's shortest possible factorial:

f=lambda x:x<2or x*f(x-1)

You may say it's not correct, because f(1) returns True, but int(True) is 1, so it's almost there ;-)

And here's a surprisingly readable (as long as you know pascal's triangle) and not too long answer to their choose challenge:

while c<k:a*=n-c;c+=1;a/=c
print a

2008-09-24 18:13

What may be in rst2pdf 0.9...

If I manage to make it work well: Math!

Here's how it looks:


It does not require TeX. It is not an image. It does require external software, and it does require you to write TeX syntax.

If you are a reportlab user: this is a platypus flowable.

As usual, it's not me that's doing the heavy lifting. I am just good at using other tools.

With a little luck, it should be usable this friday.

2008-09-16 20:58

uRSSus in a magazine DVD?

Of course I could be misunderstanding this, but it seems they included uRSSus 0.2.10 in a DVD for some reason :-)

The link and I will not make a "in soviet russia" joke.

2008-09-11 18:24

Using vector images in reportlab, improved

I just committed into trunk of rst2pdf a nicely working SVGImage flowable for reportlabs.

The code is self-contained in two files:

You can use them in your app if you want (I'd like to know, though). One of them is GPL/LGPL (it's basically copied from uniconvertor) the other is MIT-Licensed.

The output is astonishing: svg.pdf is only 32KB and completely resolution-independent. Graphics in your PDF That look good printed and on screen! And are not huge! Yay!

This will be the flagship new feature in tomorrow's rst2pdf 0.8.

Contents © 2000-2018 Roberto Alsina