Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about pyqt (old posts, page 9)

I am posting very little because I am writing a lot.

I am just not writ­ing here. I am writ­ing a book in­stead.

What book am I writ­ing? A book about python pro­gram­ming, of course! It's called "Python No Muerde" (Python Does­n't Bite) and it's in span­ish.

Now, I am the first to ad­min: I am not a great pro­gram­mer. And I am not a great writ­er. But I have lots of things to say. If I can or­ga­nize them cor­rect­ly, they even make sense some­times!

So, I am giv­ing this write-­long-stuff thing a try.

Of course since I am an open source nerd, I can't do things the usu­al way, there­fore, the book is un­der Cre­ative Com­mon­s. And be­cause I am a pro­gram­mer, I hacked to­geth­er a (if I may say so my­self) de­cent struc­ture to han­dle book-writ­ing.

  1. I write in re­struc­­tured text

  2. I use rst2pdf to cre­ate PDFs both of in­­di­vid­u­al chap­ters and the whole thing.

  3. I use rest2web to cre­ate a we­b­site

  4. I use mer­cu­ri­al (at google­­code) to han­­dle re­vi­­sion con­trol and his­­to­ry.

  5. I use make to con­trol re­build­ing of chap­ters when code changes, or im­ages get up­­­dat­ed, etc.

Of course it's more com­pli­cat­ed than that, the PDFs are in the site, the site is up­load­ed via rsync, the up­loads and re­builds are trig­gered by hg push, and so on.

In any case, I may post a few times about how this whole thing work­s, here is the out­put of the ma­chin­ery:

http://no­muerde.net­man­ager­s.­com.ar

Hacked on kuatia for a couple of hours...

As men­tioned pre­vi­ous­ly, I am hack­ing a bit on a proof-of-­con­cept word pro­ces­sor. Right now, it's host­ed on google­code and called ku­a­tia.

Now, it is far from be­ing use­ful for any­thing, but... it can do nest­ed item­ized and bul­let­ed list­s.

Here's a scree­nie of the ed­i­tor and the PDF out­put it pro­duces via re­Struc­tured Text:

editando2

Per­son­al­ly I think that's not too bad.

Marave 0.7 released

I just up­load­ed ver­sion 0.7 of Mar­ave, my fullscreen text ed­i­tor to http://­mar­ave.­google­code.­com

Mar­ave is a "re­lax­ing" text ed­i­tor in­spired by ommwriter, Dark­Room and many oth­er­s. It com­bines a spar­tan fullscreen UI with a van­ish­ing UI, which gets out of the way of your tex­t.

It sup­ports syn­tax high­light­ing, inine spellcheck­ing, back­ground mu­sic, au­di­ble key­board feed­back, themes, is ex­ten­si­ble via plu­g­in­s, and much more.

Here's a screen­shot:

marave18

There are no ma­jor new fea­tures in 0.7, but there are im­por­tant in­ter­nal changes and some ma­jor bugs fixed:

  • Fixed bug that broke open­ing files if you had no spellcheck­­er

  • Im­­ple­­men­t­ed ba­sic RTL lan­guage sup­­port

  • Sev­er­al oth­­er mi­nor fix­es

  • Refac­­tored the ed­i­­tor com­po­­nent so it can be reused

A teaser for an idea

I have been think­ing on what I re­al­ly re­al­ly want in a word pro­ces­sor. And then what would it take to cre­ate such a thing.

A few min­utes of play­ing have led me the way of this teas­er (video here if you can't see it):

Could some­thing come out of it? Who knows.

Editor: a better QTextEdit

Writ­ing an ed­i­tor is rein­vent­ing the wheel. I know that. I tell my­self Mar­ave is a fine wheel, with dis­tinct fea­tures, and I think that is true, but, if you are rein­vent­ing the wheel, there's no need to rein­vent the axle and the spoke, too.

So, I refac­tored the stuff that I think a text ed­i­tor must pro­vide in­to a nice li­brary, so the next time some­one must in­vent a wheel, he can use Mar­ave's neat spokes and axles:

So, in­tro­duc­ing Ed­i­tor, the most-ob­vi­ous­ly named class ev­er! It's a text edit­ing wid­get for PyQt with ex­tra fea­tures, which you can use as a drop-in re­place­ment for a QTextE­d­it or QPlain­TextE­d­it.

Right now, it lives in­side Mar­ave's SVN but it may even move out some­day.

Here are its fea­tures:

  • Syn­­tax high­­­light­ing

    And I don't mean "in the­o­ry", like QTex­tE­d­it and com­­pa­ny do! Ed­i­­tor can high­­­light a bunch of lan­guages, be­­cause it us­es GNU source high­­­light via Loren­­zo Bet­­tini's Source High­­­light Qt.

  • Spell check­­ing

    If you have PyEn­chant in­­stalled and the right dic­­tio­­nar­ies, it will do on­­line spellcheck­­ing.

  • Search and Search+Re­­place wid­gets

    The Ed­i­­tor class can give you nice wid­gets for search or search and re­­place al­ready hooked with the ed­i­­tor wid­get, so you can add them to your ap­p's UI eas­i­­ly.

  • new/open/save/saveas meth­od­s:

    Don't im­­ple­­ment open­ing/sav­ing, etc your­­self! That's al­ways the same code!

Hope­ful­ly this will be help­ful for some­one else :-)


Contents © 2000-2024 Roberto Alsina