Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about python (old posts, page 9)

Not a calculator

I have been play­ing with this code and it's been lots of fun.

I've hacked it in­to a func­tion­al spread­sheet in (ac­cord­ing to er­ic3) 508 lines of non-­doc code, of which 244 are gen­er­at­ed by pyuic.

Here's my code so far (re­quires PyQt). Give it a look, I think it's kin­da nice.

The on­ly hard part I wrote (at least hard for me) was the cell de­pen­den­cy and re­cal­cu­la­tion sup­port.

There's a test file you can use, too.

It is triv­ial to add func­tions you can use in the cell­s, just lookup python docs for eval() and check en­gine.py.

To use it, unpack it, and from the directory it creates run python ssheet.py

I don't plan to make it a re­al spread­sheet, but it should be fun to hack on :-)

On speaking and slides

As I men­tioned be­fore, I was at the 3rd CafeL­UG event on fri­day and sat­ur­day.

It was a pret­ty large even­t, rough­ly 1300 pople, 63 con­fer­ences.

I had two of my own, and here's how they wen­t:

Fri­day: The PyQt/PyKDE one. Au­di­ence: about 50 sit­ting, 15 stand­ing. I had no time what­so­ev­er to pre­pare this. But I was luky enough to have some­one (thanks Cris­tian!) lend me a note­book, and so I spent the pre­vi­ous con­fer­ence (pf/OpenB­S­D) work­ing on mine :-)

I kept it on a low lev­el, noth­ing too com­pli­cat­ed, since I on­ly had 60 min­utes, but the au­di­ence seems to have liked it. Or at least they found my at­tempts at ex­pla­na­tion fun­ny.

Any­way, noone was dis­gust­ed enough to tell me to my face, and I had a gen­er­al feel­ing of it hav­ing been good.

I was able to show a quick do-noth­ing app in 20 lines of code, and show sig­nals and slot­s, and re­al­ly re­al­ly push the idea of in­ter­pret­ed lan­guages as bet­ter for hob­by pro­gram­ming (which I think is the right path). Not too many ques­tions right then, but about a dozen kids at­tacked me with ques­tions on the hall af­ter leav­ing.

Sat­ur­day: My gener­ic KDE-­for-be­gin­ners speech. Au­di­ence: 100 sit­ting, 10 stand­ing. I was a bit too heavy on the philo­soph­i­cal, but it went down nice­ly. Sev­er­al of the guys from fri­day's PyQt ses­sion were there, so more ev­i­dence it did­n't suck too bad­ly.

It was fun, peo­ple were sur­prised by Og­g-rip­ping from Kon­queror as usu­al, some fun, sev­er­al ques­tion­s.

All in al­l, a nice cou­ple of ses­sion­s, and I think I did well, which en­cour­ages me to do it more of­ten. Who knows :-)

Some KDE-related hacking

Since port­ing HTML dis­play en­gines from one place to an­oth­er is all the rage these days, I did a lit­tle hack­ing on one of the old­est forms of the art:

KDE's kde­nox mod­ule con­tains kon­q-em­bed, which is, among oth­er things, a port of KHTML to al­most-pure-Qt (I think).

So, I am hack­ing to make that re­al­ly-pure-Qt.

So, it's ba­si­cal­ly port­ing KHTML from KDE to Qt.

Why? Be­cause I want a de­cent HTML wid­get for PyQt that does­n't re­quire kdelib­s. So peo­ple us­ing PyQt/Win32 can use it, for in­stance.

I don't know if it will work (hack­ing C++ code is al­most painful to me nowa­days).

Now, this is news to me.

Tavia seems to be an­oth­er KDE web brows­er.

I say nice.

Semi-re­lat­ed:

Be­cause of a ques­tion on the PyKDE list, ask­ing for a more com­plete HTML wid­get us­ing Qt (not kdelib­s) I am look­ing at kde­nox, which is sup­posed to be a Qt-on­ly (QT/E) kon­qy. Per­haps rip­ping off the khtml piece of it won't be too hard, and then it can be sip-wrapped.

Prob­a­bly noth­ing will hap­pen with it, but I am look­ing ;-)

On other news today...

Python code re­al­ly does­n't look good on plan­etkde, so fol­low the link to my page to see it right if you are there ;-)


Contents © 2000-2024 Roberto Alsina