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,
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:
- log a bug and hope this gets fixed in gtk
- figure out if the bug is in my code and fix it there
- use a more tradition gtk way of doing this kind of thing