Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.3, 0.4rc1, and 0.4rc2

hggtk/datamine: improve look-and-feel of tab close buttons

Changeset 34a1ecb30590

Parent c2ab059f1f93

by TK Soh

Changes to one file · Browse files at 34a1ecb30590 Showing diff from parent c2ab059f1f93 Diff from another changeset...

Change 1 of 6 Show Entire File hggtk/​datamine.py Stacked
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
146
147
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
150
151
 
221
222
223
224
225
226
 
227
228
229
230
231
 
277
278
279
280
281
282
 
283
284
285
286
287
 
415
416
417
418
419
420
 
421
422
423
424
425
 
512
513
514
515
516
517
 
518
519
520
521
522
 
19
20
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
23
24
 
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
 
221
222
223
 
 
 
224
225
 
226
227
228
 
274
275
276
 
 
 
277
278
 
279
280
281
 
409
410
411
 
 
 
412
413
 
414
415
416
 
503
504
505
 
 
 
506
507
 
508
509
510
@@ -19,21 +19,6 @@
 from vis.treeview import TreeView  import gtklib   -# simple XPM image for close button on notebook tabs -close_xpm = [ - "8 7 2 1", - "X c #000000", - " c #ffffff", - "XX XX", - " XX XX ", - " XXXX ", - " XX ", - " XXXX ", - " XX XX ", - "XX XX", - ] -close_pixbuf = gtk.gdk.pixbuf_new_from_xpm_data(close_xpm) -  class DataMineDialog(GDialog):   COL_REVID = 0   COL_TEXT = 1 @@ -146,6 +131,21 @@
  def _search_clicked(self, button, data):   self.add_search_page()   + def create_tab_close_button(self): + button = gtk.Button() + iconBox = gtk.HBox(False, 0) + image = gtk.Image() + image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU) + gtk.Button.set_relief(button, gtk.RELIEF_NONE) + settings = gtk.Widget.get_settings(button) + (w,h) = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_MENU) + gtk.Widget.set_size_request(button, w + 4, h + 4) + image.show() + iconBox.pack_start(image, True, False, 0) + button.add(iconBox) + iconBox.show() + return button +   def add_search_page(self):   frame = gtk.Frame()   frame.set_border_width(10) @@ -221,11 +221,8 @@
    hbox = gtk.HBox()   lbl = gtk.Label('Search %d' % self.newpagecount) - image = gtk.Image() - image.set_from_pixbuf(close_pixbuf) - close = gtk.Button() + close = self.create_tab_close_button()   close.connect('clicked', self.close_page, frame) - close.set_image(image)   hbox.pack_start(lbl, True, True, 2)   hbox.pack_start(close, False, False)   hbox.show_all() @@ -277,11 +274,8 @@
    hbox = gtk.HBox()   lbl = gtk.Label('Search "%s"' % re.split()[0]) - image = gtk.Image() - image.set_from_pixbuf(close_pixbuf) - close = gtk.Button() + close = self.create_tab_close_button()   close.connect('clicked', self.close_page, frame) - close.set_image(image)   hbox.pack_start(lbl, True, True, 2)   hbox.pack_start(close, False, False)   hbox.show_all() @@ -415,11 +409,8 @@
    hbox = gtk.HBox()   lbl = gtk.Label(os.path.basename(path) + '@' + revid) - image = gtk.Image() - image.set_from_pixbuf(close_pixbuf) - close = gtk.Button() + close = self.create_tab_close_button()   close.connect('clicked', self.close_page, frame) - close.set_image(image)   hbox.pack_start(lbl, True, True, 2)   hbox.pack_start(close, False, False)   hbox.show_all() @@ -512,11 +503,8 @@
    hbox = gtk.HBox()   lbl = gtk.Label(os.path.basename(path) + '@' + str(rev)) - image = gtk.Image() - image.set_from_pixbuf(close_pixbuf) - close = gtk.Button() + close = self.create_tab_close_button()   close.connect('clicked', self.close_page, frame) - close.set_image(image)   hbox.pack_start(lbl, True, True, 2)   hbox.pack_start(close, False, False)   hbox.show_all()