Older blog entries for lgs (starting at number 20)

12 Oct 2004 (updated 12 Oct 2004 at 10:02 UTC) »
Gazpacho patches

After releasing 0.3.1 last friday just before a small holidays here in Spain, I started to get a bunch of bug reports and patches which makes me *really* happy because: a) People stil have not forgot about Gazpacho and b) There is interest on it. More information on the gazpacho mailing list.

Plone customization

Our LUG is working on a project about a CMS for associations and non profit organizations here in Granada. We are not sure which system to choose but Plone2 is one of the candidates. I played a little bit with it and these are the changes/adaptations I made to it:

  • Skin: Changed colors, logo and portlet frames. Also put the 'You are at ....' bar in the same space as the user actions.
  • Added a Photo gallery plugin
  • Added Epoz as the textarea sustitute

I stil want to add more Products like a Wiki or a Forum system but it seems Plone2 can meet all our request. Next point will be performance (hugh!)

If you want to see my test place check it out at http://sexmachine.homelinux.net:8080/gcubo/

GMail Applet

Some weeks ago I got a gmail account and I realized that they don't have pop3/imap support so you need to log into the webmail to see if you have something new. I understand they want you to see the ads but that's too much for a email compulsive user as me.

So I hacked up a 50 lines gnome systray icon to alert me when you have mail:

#!/bin/env python

import pygtk pygtk.require('2.0') import gtk import gnome import eggtrayicon

import libgmail

ACCOUNT = 'your.name@gmail.com' PASSWORD = 'yourpassword' REFRESH_INTERVAL = 1000 * 60 * 5 # this is in milliseconds (5 minutes)

class GMailApplet(object): def __init__(self): gnome.program_init('gmail-applet', '0.0.1') self.applet_window = eggtrayicon.create_window('gmail-applet') self.applet_window.connect('destroy', gtk.main_quit)

self.event_box = gtk.EventBox() self.image_widget = gtk.Image() self.image_widget.set_from_file('gmail.png') self.event_box.add(self.image_widget)

self.image_widget.show() self.applet_window.add(self.event_box) self.applet_window.show_all()

self.account = libgmail.GmailAccount(ACCOUNT, PASSWORD) self.account.login() gtk.timeout_add(REFRESH_INTERVAL, self.refresh_handler) def run(self): gtk.main()

def refresh_handler(self): # handle gtk events while gtk.events_pending(): gtk.main_iteration(gtk.FALSE)

unreadMsgCount = self.account.getUnreadMsgCount()

if unreadMsgCount > 0: self.image_widget.set_from_file('gmail_notice.png') else: self.image_widget.set_from_file('gmail.png') return gtk.TRUE if __name__ == '__main__': g = GMailApplet() g.run()

You need libgmail and eggtrayicon.

There are some screenshots

System V init scripts

I got tired of editing my /etc/hosts by hand to adapt my network configuration depending on if I'm at home or at the office. So I decided to hack something on the initscripts:

  1. Edit /boot/grub/menu.lst and duplicate some entries adding a LOCATION={home|office} parameter:
    title Fedora Core (2.6.8-1.521) Office
            root (hd0,0)
            kernel /boot/vmlinuz-2.6.8-1.521 ro root=LABEL=/ rhgb quiet LOCATION=office
            initrd /boot/initrd-2.6.8-1.521.img

    title Fedora Core (2.6.8-1.521) Home root (hd0,0) kernel /boot/vmlinuz-2.6.8-1.521 ro root=LABEL=/ rhgb quiet LOCATION=home initrd /boot/initrd-2.6.8-1.521.img

  2. Write a System V script (actually copying an existing one and adapting) called location which copies the right /etc/hosts. Note the chkconfig lines at the beginning of the file:
    # chkconfig: 2345 90 10
    # description: little script to configure some stuff depending if the laptop \
    #              is at the office or at home

    # source function library . /etc/init.d/functions

    start () { echo $"$LOCATION" if [ -e /etc/hosts.$LOCATION ]; then cp /etc/hosts.$LOCATION /etc/hosts else echo $"localized hosts file not found" fi }

    stop () { echo "Have a good day" }

    case "$1" in start) start ;; stop) stop ;; restart|reload) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac

    exit 0

  3. Install the location script with chkconfig:
    [root@i8100] chkconfig location on

  4. Write /etc/hosts.home and /etc/home.office

That's all. Next time I reboot I will have my right network configuration just by selecting one grub menu item. :-)

Email mistery

Last weekend I was quite happy as I didn't receive almost any spam message and this is quite uncommon for me as I still haven't got the time to set up a spam message filter. Then I sent something to a mailing list and didn't get it (I'm suscribed to that mailing list). Then my cousing told me she had sent me something the day before. Then I started to feel I was loosing emails.

First step, don't panic. Next step, log in into the mail server and check some logs. It seemed that the mails were being accepted by the mailserver but never came to my inbox. I started to blame my new Evolution 2.0 since I just installed last weekend and so I enter in the #evolution irc channel.

I was pretty amazed on how fast these guys told me what the problem was: something in my ~/.procmailrc was wrong. First of all I'll describe the problem. It seemed that some of the mail I got (the one being lost) wast getting stored in a very strange file called & (yes, an ampersand) in the ~/Maildir/ folder. I open the .procmailrc and saw the offending line:

* ^(From|Cc|to).*desktop-devel-list@gnome.org

Obviously the & should be replaced by :0: . Everything has a logic explanation after all.

Python circular module dependencies

Or the Python Holy Grial, as I like to call it. You have a file called a.py and then a file called b.py and you need something in a.py from b.py and viceversa. Isn't it quite common? Well, with Python this is a gotcha, one of the very few I have managed to find after a few years programming in this language.

Decent gcubogotchi

This weekend I did some icons for my friends just to include them on Evolution contacts and I also made a decent one for myself

There is also another version of the whole body

/gnome stuff

Finally I realized that the easiest way to get the last piece of bit of every program I usually need is to install them all in a alternate prefix, like /gnome. And forget about your distro packages and dependencies. Yes, we all know apt and yum are great but then you go back to use jhbuild or garnome to get the last gnome build. What if you want other programs (e.g. Gaim) integrated with it?

After quite a while without posting I come back again thanks to the preasure somebody is doing these days.

Let's start with something simple: small hack to display a rotated pango text. I just copied the idea from pygtk mailing list but I didn't want to wait until I have my widgets realized to draw the rotated label.

So here you have the code and a small demonstration of the concept.

Thanks to jamesh for his nice explanation about colors, visuals, depth, and all those internal X concepts we all love.

Después de casi un mes sin escribir nada por aqui vuelvo a hacerlo y esta vez en mi idioma natural.

Y la razón es que entre el montón de spam que me llega todos los días al buzón de correo ayer me llegó un mensaje muy especial. Es sobre una persona que ha leido mi traducción del tutorial de Pygtk y me ha mandado correcciones y sugerencias.

Pero no sólo eso, también acaba su correo con este párrafo:

Tu traduccion esta siendo usada en el Seminario de
Programacion Multiplataforma del GrupoLInux
de la Universidad Distrital (Bogota, Colombia)

Gracias por este gran trabajo con el cual hemos podido aprender acerca pygtk en nuestra lengua materna, documento que al ser libre nos ha permitido un facil acceso a esta tecnologia, sin ningun precio, y que ademas ayuda a un pais con graves problemas como Colombia a que salga de su atraso en las cuestiones de la informatica.

Cosas como están son las que te dan ánimos para seguir trabajando día a día.

14 Apr 2004 (updated 14 Apr 2004 at 16:37 UTC) »

Well, yesterday was a really good day indeed. Federico and Jonathan are interested in GtkGrid and this is more than I could dream about.

Federico even told me that they are considering it for being in GTK+ 2.6:

<federico> estoy platicando con jrb acerca de gtkgrid :)
<federico> hay planes para ponerlo en gtk+ 2.6 si esta listo para esas fechas
<federico> entonces si tienes preguntas, no dudes en consultarme

Then I asked what need to be done for this milestone. They kindly answered me so now I have these short time goals:

  • Write a desing document explaining what the Grid is and what it is not.
  • Complete the API for the Grid
  • Write some documentation for the API itself and some sort tutorial with examples.
  • Ask gnome-db guys to make a branch and let me put my hands on Mergeant to see how good the Grid is in a real project

As you can see there is a *lot* of work to do so any help is more than appreciated.

In the meantime Jonathan is helping me to get a combo renderer working in the TreeView (and I'm copying ideas to make it work on the Grid) and we are close to get it. :-)

Compilation headaches

After some days working in other stuff I came back to work with GtkGrid. I even got a patch from Todd Fisher for displaying the row number in the sidebar!

So today was the compilation win32 day. I got some problems building pygtk in win32 for Python 2.3 but after some googling I discovered how to fix it. More info here. So no Visual Studio C was needed, thanks heaven.

After that and some changes to my lgsbuild.py script because I updated all the versions of our software dependencies I run into another problem with pygtk.

I got some undefined references when compiling pygtk and I asked to the pygtk list about this issue. I should have googled this time too as kiko showed to me :)

In the meanwhile Johan et al are working harder and harder and we are having releases very fast. So I guess my compilation nightmares have just started .... :)

At least we have new versions of GtkGrid and pyGrid (python bindings), this time for Python 2.3. CHeck them out here !!.

Today was a gtkgrid full time day and I did some fancy stuff. This is a list of current improvements:

  • There is a header window now with a button in every column. The label of the button is the title of the column.
  • Columns have variable width to acomodate their model contents and also the title text.
  • We also have a sidebar with a small right arrow pointing to the current row. This would be a good place to check for right click buttons to pop up a menu for adding and removing rows.
  • I fixed an anoying bug with the CellRendererSpin. When the user clicked too fast on the spin arrows the focus came back to the grid. All I needed to do was to check if the button event window field was the correct one.
  • Thanks to Owen now I know how to draw with the color I want. I used this knowledge to draw a blue rectangle on the current cell.

Wanna see al this changes together? Well, here you have an screenshot

But not everything are good news. The scroll is broken now after so many changes. I'll need to understand better how the gdk_window_move and gdk_window_scroll works.

11 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!