Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

gtklib: introduce SlimToolbar widget

If you need to put smaller button than gtk.Toolbar,
this toolbar will be good choice for you.

Changeset 11928da131c5

Parent 2d24479142bf

by Yuki KODAMA

Changes to one file · Browse files at 11928da131c5 Showing diff from parent 2d24479142bf Diff from another changeset...

 
461
462
463
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
465
466
 
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
@@ -461,6 +461,32 @@
  rest = pack(*(widgets[1:]), **kargs)   t.attach(rest, 1, 2, rows, rows + 1, FLAG, 0, xpad, ypad)   +class SlimToolbar(gtk.HBox): + """ + Slim Toolbar, allows to add the buttons of menu size. + """ + + def __init__(self, tooltips=None): + gtk.HBox.__init__(self) + self.tooltips = tooltips + + def append_stock(self, stock_id, tooltip=None): + icon = gtk.image_new_from_stock(stock_id, gtk.ICON_SIZE_MENU) + button = gtk.Button() + button.set_image(icon) + button.set_relief(gtk.RELIEF_NONE) + button.set_focus_on_click(False) + if self.tooltips and tooltip: + self.tooltips.set_tip(button, tooltip) + self.append_widget(button, padding=0) + return button + + def append_widget(self, widget, expand=False, padding=2): + self.pack_start(widget, expand, expand, padding) + + def append_space(self): + self.append_widget(gtk.Label(), expand=True, padding=0) +  def addspellcheck(textview, ui=None):   lang = None   if ui: