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

gtklib: add get_icon_image() function

Changeset 2d9dfb0f91c7

Parent f2dfb3e01ebb

by Yuki KODAMA

Changes to one file · Browse files at 2d9dfb0f91c7 Showing diff from parent f2dfb3e01ebb Diff from another changeset...

 
124
125
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
128
129
 
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@@ -124,6 +124,22 @@
  selection.select_iter(selected)   treeview.set_cursor(model.get_path(selected))   +def get_icon_image(name): + if name.startswith('gtk'): + img = gtk.image_new_from_stock(name, gtk.ICON_SIZE_MENU) + else: + img = gtk.Image() + path = paths.get_tortoise_icon(name) + if not path: + return img + try: + width, height = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU) + buf = gtk.gdk.pixbuf_new_from_file_at_size(path, width, height) + img.set_from_pixbuf(buf) + except: + pass + return img +  class MessageDialog(gtk.Dialog):   button_map = {   gtk.BUTTONS_NONE: None,