Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about python (old posts, page 54)

Video: My lightning talk about Peter Norvig's spellchecker (in spanish)

Thanks to Nicolás Pace, I got a video of the Py­con Ar­genti­na 2009 light­ning talk­s.

So, af­ter fight­ing my ig­no­rance of video edit­ing, here is my own talk, about Pe­ter Norvig's spellcheck­er, spliced with the slides.

If you want a bet­ter qual­i­ty ver­sion of the slides, they are here

There is a prob­lem in that no mat­ter how I cut the orig­i­nal hour-­long video, re­gard­less of what tool I use, the sound gets out of sync, so I look kin­da odd. I will try to do an­oth­er ver­sion from the orig­i­nal video lat­er on.

So, here it is:

Edit­ed with kden­live: crashy but cool and easy

Dear Lazyweb, what's the pythonic cross-platform fc-match?

Here's what fc-­match does:

$ fc-match "Droid Sans"
DroidSans.ttf: "Droid Sans" "Regular"

Or even:

$ fc-match "Droid Sans" -v | grep file:
      file: "/usr/share/fonts/TTF/DroidSans.ttf"

So, how does one do that, go­ing from a font fam­i­ly name or font name to a font file, where there's no font­con­fig?

I found code for this in mat­plotlib's font_­man­ag­er mod­ule but it looks hard to un­tan­gle, and re­quir­ing mat­plotlib is a bit over the top.

If there's no por­ta­ble so­lu­tion, I would be hap­py enough with three stand­alone so­lu­tions in­stead, and prom­ise to pub­lish an ab­strac­tion lay­er over them ;-)

So, dear win­dows and mac python­istas, any point­er­s?

Bookrest: it was meant to be a stylesheet editor.

In my orig­i­nal post about it I was re­fer­ring to Bookrest as a stylesheet ed­i­tor for rst2pdf, be­cause that's what I want­ed, a way to test style changes and see what they did.

Of course, one thing lead to an­oth­er and it's start­ing to look more like a word pro­ces­sor than any­thing else, but ... well, how about a stylesheet ed­i­tor?

Sure, you can use the "Style" tab, and ed­it at will, but that's not ex­act­ly fun for ev­ery­one.

So, let's work on one. Here's the video of the cur­rent sta­tus:

Of course, this is about 1/20th of the stylesheet ed­i­tor, but at least the di­a­log is there, and most of the re­main­ing work is wiring di­alogs, which is quick us­ing de­sign­er.

It shall be called Bookrest, and it has an outline view.

Yes, the pro­gram known so far as "my rst2pdf ed­i­tor/pre­view­er ap­pli­ca­tion" is now called Bookrest.

What's a bookrest? It's a thing you put a book on.

Why Bookrest? I hope some­day peo­ple will have books open in bookrest. Plus, it ends with "rest", which is the pre­ferred ab­bre­vi­a­tion for re­Struc­tured Tex­t.

And what's the out­line view? It's a click­able tree with the out­line of the doc­u­men­t, of course.

As usu­al, let's go to the video:

The back­ground ren­der­ing was done us­ing python's awe­some mul­ti­pro­cess­ing mod­ule.

rst2pdf previewer: a new feature

I am in the mid­dle of that hon­ey­moon you get start­ing a new ap­p. Ev­ery new fea­ture seems tobe just 50 lines of code away, there is no lega­cy code (in fac­t, you are cre­at­ing that lega­cy code), and you learn new tricks all the time.

So, I did a new fea­ture to­day.

A day or two ago, my ed­i­tor start­ed show­ing a yel­low bar high­light­ing the cur­rent line.

But then I though... would­n't it be more use­ful to have a sim­i­lar bar fol­low­ing you in the PDF?

That way, when you are on a giv­en line, you can im­me­di­ate­ly see where you are in the out­put. Neat, right?

Here is a video show­ing it:

Sad­ly it's not per­fec­t, and prob­a­bly nev­er will be be­cause of do­cu­tils lim­i­ta­tion­s, but it's pret­ty nice!

Contents © 2000-2024 Roberto Alsina