Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Today's two hours of hacking

  • Done with the main blog con­­fig di­a­log.

  • Fixed a dozen bugs

  • Gen­er­ate the blog in a rea­­son­able place

  • Fixed a lot of UI bugs (tab or­der­s, sizes)

Still lots and lots of things to be done, tho.

Making your QTextBrowser show remote images

It's re­mark­ably easy to turn your QTextBrows­er in­to a lim­it­ed web browser, at least good enough to show im­ages from the we­b.

Here's all the code:

from PyQt4 import QtCore,QtGui
import urllib, os, md5

class PBrowser(QtGui.QTextBrowser):
    def loadResource(self, type, name):
        url=unicode(name.toString())
        ret=QtCore.QVariant()
        if url.startswith('http://'):
            dn=os.path.expanduser('~/.bartleblog/cache/')
            if not os.path.isdir(dn):
                os.mkdir(dn)
            m=md5.new()
            m.update(url)
            fn=os.path.join(dn,m.hexdigest())
            if not os.path.isfile(fn):
                urllib.urlretrieve(url, fn)
            ret=QtGui.QTextBrowser.loadResource(self, type, QtCore.QUrl(fn))
        else:
            ret=QtGui.QTextBrowser.loadResource(self, type, name)
        return ret

And here's bartle­blog tak­ing ad­van­tage of it:

bartleblog10.png

It even has a prim­i­tive cache and ev­ery­thing ;-)

PHP is for Lucre (II)

I prob­a­bly should have charged more.

Things I learned in this pro­jec­t:

  • If they tell you the de­sign is im­­por­­tan­t, it does­n't mat­ter that said de­sign in­­­cludes:

    • Fixed pix­el-height text in­­­puts (so when you re­­­size fonts you can't see what you write)

    • Mis­­­aligned fields and la­­­bels

    So, I need­ed to use Smar­­ty to gen­er­ate the ex­act same HT­M­L, work­ing just as bad as the orig­i­­nal. And it is thrice the work of do­ing it right.

  • If de­­ploy­­ment is on Win­­dows, re­­gard­­less of hav­ing the same ver­­sion of PH­P, you are go­ing to get in trou­ble one way or an­oth­er.

    In or­der to do it quick & cheap & good, I used PEAR mod­­ules ex­ten­­sive­­ly. And now I have to make sure all of them are in the serv­er... where there is no re­­mote ad­min so­lu­­tion us­able. So I have to be on­site to de­­ploy. I can't even re­mem­ber the last time I had to do such a thing :-(

So, I was cheap­er than the oth­er pro­pos­al­s, and maybe I was a bit too cheap. Live and learn :-)

Neat KDE style: Domino

To­day I was fid­dling with my desk­top and de­cid­ed to check what KDE styles were avail­able in Arch Lin­ux.

Then I test­ed Domi­no.

It's very, very, very nice.

domino.png domino2.png

I have no idea how good it is per­for­mance-­wise (my note­book is pret­ty brawny) but hey, I am a bor­ing guy, and I'm wowed.

Giving BartleBlog the push it needs

I found a cou­ple of hours to hack, and de­cid­ed to spend them on Bartle­Blog.

Here's what got done:

  • UI for blog pre­f­er­ences (still need to do maybe ten of these lit­­tle mod­­ules).

  • Search for files in rea­­son­able places (in­stead of us­ing the DB in the cur­rent fold­er, for ex­am­­ple).

  • Start­ed work on a first-use wiz­­ard

  • Start­ed work­ing on a orig­i­­nal and sim­­ple help sys­tem (re­­source files, yay! ;-).

  • Im­­ple­­men­t­ed (lame­­ly) post­ing of "s­­to­ries" which are stat­ic pages that are not part of the blog's flow.

I in­tend to spend a cou­ple of hours on it ev­ery day for the next ten days or so. Af­ter that, who knows, maybe a re­lease will be rea­son­able.


Contents © 2000-2022 Roberto Alsina