Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

gtklib: support both stock items & bundled icons for SlimToolbar

Changeset 457a4fb24b03

Parent 8961982c295d

by Yuki KODAMA

Changes to one file · Browse files at 457a4fb24b03 Showing diff from parent 8961982c295d Diff from another changeset...

 
600
601
602
603
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604
605
606
 
600
601
602
 
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
@@ -600,7 +600,22 @@
  ### public methods ###     def append_button(self, icon, tooltip=None, toggle=False, group=None): - img = gtk.image_new_from_stock(icon, gtk.ICON_SIZE_MENU) + """ + icon: stock id or file name bundled in TortoiseHg. + """ + if icon.startswith('gtk'): + img = gtk.image_new_from_stock(icon, gtk.ICON_SIZE_MENU) + else: + img = gtk.Image() + filepath = paths.get_tortoise_icon(icon) + if filepath: + try: + size = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size( + filepath, *size) + img.set_from_pixbuf(pixbuf) + except: + pass   if toggle:   button = gtk.ToggleButton()   else: