Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about python (old posts, page 22)

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 ;-)

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.

What I am plotting...

...noth­ing.

Ok, here's what I have been do­ing:

  • Dad­dy work. Lots of it. Fun!

  • Ac­­tu­al work. Lots of it. Fun, but not so much!

  • Worked a lit­­tle more in RA-Flip. Play/Stop/­­Pause is done. The ed­it­ing mode and open­ing/sav­ing files is pret­­ty much done, so it will be ful­­ly func­­tion­al as soon as I can spend an af­ter­noon in it.

  • To­bo­­gan (My slideshow soft­­ware). It works nice­­ly. There are many rough spots and it needs a few fea­­tures:

    • Some way to ed­it the CSS for in­­­di­vid­u­al slides in a nice man­n­er. Like set­t­ing back­­­­­grounds and colours (and not much else)

    • A nice way to save the slideshow so it ends all in a sin­­­gle fold­er.

    • Many UI de­­­tails

    • Docs

    • A site

  • Bartle­Blog: it has worked well for me for a long while, since I have been post­ing this blog us­ing it. And re­al­­ly, it's a nice blog, is­n't it? ;-) But of course, there is stuff to be done:

    • Many UI de­­­tails

    • De­­­cent flickr and openo­my up­­­load­­­er­s/­­­man­agers

    • Some ex­­­tra gad­gets I have in mind

    • Docs

    • A site

And that's all I have in mind right now. Ex­cept maybe a graph­i­cal Be­funge in­ter­preter, but that's not re­al­ly im­por­tant ;-)

New project: Tobogan

As a re­sult of my play­ing with mootools and cre­at­ing pow­er­point-style slideshows on web­pages from re­struc­tured tex­t, I am pret­ty much de­cid­ed about turn­ing this in­to a stan­dalone, re­al ap­pli­ca­tion.

I am do­ing a PyQt4 fron­tend, and re­struc­tured text ad­dons to gen­er­ate the slides.

The na­tive file for­mat is re­struc­tured text it­self, and it sup­ports ba­sic tran­si­tions be­tween slides.

It still needs a ton of work, but here is a video show­ing how it looks af­ter a cou­ple of days hack­ing. You can see the cur­rent UI, a doc­u­men­t's source, and a demon­stra­tion us­ing fire­fox (on­ly be­cause Kon­qy does­n't sup­pose opac­i­ty, the rest of the tran­si­tions work even bet­ter on Kon­queror)

It's Og­g/The­o­ra and 3MB (thanks openo­my.­com!): the video


Contents © 2000-2020 Roberto Alsina