Thursday, January 7, 2010

Tonight's Photobomb Feature: Ink Properties

Tonight I added ink width and ink color. This means that you can kinda sorta do a lolz with photobomb.

I was a bit bummed to find that there is an Ink Color Button, but there doesn't seem to be a similar control for a toolbar. So I just made a button that pops up the color dialog.
It would be sweet if there was a popup menu connected to a toolbar, so you could kind of pull down and set your color instead of popping the dialog. Perhaps there is a related quidget in the future. Speaking of quidgets, I similarly used a popup to get the integer value from the user for the ink width. It was nice to be able to just pop up the prompt with a one liner and move on. So Quidgets ftw!

I used goocanvases to show the current color and line width on the buttons:
     path_str = "M 5 20 L 25 20" 
self.__ink_width = 5
ink_button_gc = goocanvas.Canvas()
bttn_root = ink_button_gc.get_root_item()
self.__ink_width_path = goocanvas.Path(data=path_str,
parent=bttn_root, line_width=self.__ink_width,

It seems to work, but every time the code makes the change, I get a gtk warning:
bin/photobomb:304: Warning: invalid cast from `GooCanvas' to `GtkMisc'
bin/photobomb:304: GtkWarning: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed

I suppose I'll need to either:
  1. log a bug and hope this gets fixed in gtk
  2. figure out if the bug is in my code and fix it there
  3. use a more tradition gtk way of doing this kind of thing


  1. Nice article, thanks for the information. It's very complete information. I will bookmark for next reference
    jaring futsal | jaring golf | jaring pengaman proyek |
    jaring pengaman bangunan | jaring pengaman gedung