Posts about python (old posts, page 10)

2007-04-05 14:37

Son of bartleblog XI: the highlight of the syntax

I had a few minutes waiting for yum to do its thing and added a couple of easy features:


The SilverCity-based code-block syntax highlighting directive was replaced with a version using Pygment which supports more languages and is (I think) nicer looking... and comes with several styles, as you can see above in the configuration dialog.

Other than that, I added support in the backend to:

  • Regenerate HTML from RST everywhere
  • Do the same only on items marked "dirty"
  • A model thingie that shows if there are posts or stories with RST errors
  • Some GUI love

I need to make the config dialog support more than one gadget at the same time, though ;-)

2007-04-04 11:01

Son of BartleBog X: Lots of small things are a big thing

  • I did the tag editor:

The "Guess Tags" button in the composer uses the "Magic words" defined for each tag to give you a starting set, which you can edit later. Still has a few implementation issues (thus the taglessness of this post) but it's almost there.

  • Using HTMLTidy I made all the HTML validate (as transitional, at least).
  • Using browsercam I made sure this page works on every decent browser (it looks bad on IE 4.0, and Netscape 6):

There is a nasty problem with IE and JavaScript, where if you have a <script> that does some specific things inside of a <div> it tends to give a weird "Operation aborted" dialog after showing part of the page, and then delete what you were seing. That is a known, confirmed bug, and has been there for three major versions already.

  • Added a feedBox widget that can display as a sidebar any feed that uses FeedBurner's BuzzBoost (see "Latest comments" on the sidebar).

I am now toying with using FeedBurner's API to (optionally) automatically publish all the RSS feeds BartleBlog generates there, thus making this kind of thing more transparent.

2007-04-03 19:06

Son of BartleBlog IX: Eating my own dog food

Even though it's not really ready, I am switching my blog to BartleBlog.

The idea is that I do blog. So I should be able to focus on what's needful for my own kind of blog. For example, right now, the idea of not being able to tag this post is driving me nuts.

2007-04-02 12:42

Son of bartleblog VIII: Some Qt love

Now that the backend is still iffy but generates a blog, I finally started showing some love to the UI.

Here's the brand new post editor:


The far-right two buttons should let you choose your flickr photo/openomy file respectively and add the link/thumbnail easily (the UI is not done yet).

The format to write is Restructured Text or HTML (non wysiwyg) but other things like Textile or wiki markup should be easy to add.

The main window uses a Qt model to create the tree with views (right now) by date, but with alternative organizations soon.

2007-03-30 08:41

Son of Bartlebog VII: the nuclear test site

A lot of new features going on, like openomy based file uploading and links that work like simple rst directives:

.. openomy:: my-file.ext

And you should get a link to the file, stored in the 1GB the openomy guys kindly provide.

Also, you can actually see how the test site looks at // (using the exact same data as this one).

I actually upload almost every change I do, so it breaks often ;-)

2007-03-29 18:43

Son of Bartleblog VI: The flickr directive

I added a Restructured Text directive that takes as argument the title of one of your (my) flickr pictures, like this:

.. flickr:: pa120071

And produces this:

Which is much nicer than my images have looked for a while.

It can still be improved, probably add a caption, link to image comments if available, etc.

The bad side is that if you don't have internet access the rendering fails.

2007-03-28 17:28

Son of bartleblog 5: Menus

Added a Yahoo! Ui menubar generator. It turns this:


Into this:


Or this if you are using links:


Or rather into this, which explains why it's necessary (consider this is a very simple menu!):

System Message: ERROR/3 (<string>, line 30)

Cannot find pygments lexer for language "HyperText"

.. code-block:: HyperText

    <script type="text/javascript">
    YAHOO.example.onMenuBarReady = function(p_oEvent)
        // Instantiate and render the menu bar

        var oMenuBar = new YAHOO.widget.MenuBar("None",
            {   autosubmenudisplay:true,


    // Initialize and render the menu bar when it is available in the DOM
    YAHOO.util.Event.onContentReady("None", YAHOO.example.onMenuBarReady);
            <div id="None" class="yuimenubar">
                <div class="bd">
                    <ul class="first-of-type">
                        <li class="yuimenubaritem first-of-type">a </li>
                        <li class="yuimenubaritem">b</li>
                        <li class="yuimenubaritem"> c
                            <div id="c" class="yuimenu">
                                <div class="bd">
                                        <li class="yuimenuitem"> 1</li>
                                        <li class="yuimenuitem"> 2
                                            <div id=" 2" class="yuimenu">
                                                <div class="bd">
                                                    <ul class="first-of-type">
                                        <li class="yuimenuitem">  x</li>
                                        <li class="yuimenuitem">  y</li>
                        <li class="yuimenubaritem">d</li>

Still some missing features, but a neat thingie already.

2007-03-27 12:49

Son of Bartleblog IV

Another morning, another feature: archive


Now I'm working on the image tool, importing PyDS's images and uploading to flickr, etc.

2007-03-26 18:28

Son of Bartleblog III

A couple more hours of hacking, and the templates are all new, and more functional then ever.


I am making heavy use of Yahoo's UI library, which makes lots of things much simpler:

  • Layout using Yahoo Grids

    I spent hours making the layout you see now, and the one with Grids works better and was done in minutes. Avoid reinventing the wheel works for webpages, too.

  • Calendar using Yahoo Calendar

    Isn't it neat? And it works, too. Since the linking is handled by javascript I may make it so it loads the posts for a month without reloading the page.

  • Styling using their reset.css stylesheet.

    That stylesheet removes all styling from your page. That way, if there's something there, you put it.

    I used that, added a slightly simplified stylesheet based on Firefox's default, Restructured Text's and Silvercity's, and all the customizing I needed to do to achieve a simple but functional layout were 30 lines of CSS, compared to the rather monstrous pyds.css my blog currently uses.

  • Modular thingies.

    I turned all Technorati/HaloScan/FeedBurner/Talkr thingies into macros that take as configuration your personal data (for example, HaloScan ID) and if necessary a post.

If the styling was a little more done and a few bugs were ironed, I may even start uploading the site using bartleblog instead of PyDS soon :-)

2007-03-25 12:53

Son of Bartlebog II

After a few more hours hacking, it's got the following working:

  • CherryTemplate templates that do about the same as the Cheetah templates in PyDS
  • Generates the whole site and it looks just the same
  • Advogato import (my blog should go all the way back to 2000 when I switch!)
  • PyDS import

The main missing things are:

  • Do a decent templating system (right now they are embedded in the code)
  • Do a decent config system (right now, global variables)
  • Do uploading (or just trust lftp)
  • Do post/story creation
  • Port the RSS template
  • Flickr integration
  • Integration with all those neat little gadgets: feedburner flares, HaloScan comments which are currently kinda grafted (only work for my account ;-)
  • Look into Yahoo UI toolkit for things like the calendar and menus.
  • Add the extra stuff to Restructured Text so it:
    • Fixes automatically links to posts/stories in the blog
    • Pretty-prints code using SilverCity
  • Lots of UI stuff

All in all, not really a huge amount of work, but I am taking it easy.

When KDE4 is out, a version with a full-fledget KHTML in it will be a whole lot nicer.

Contents © 2000-2019 Roberto Alsina