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

histdetails: use standard buttons

Changeset 22fa91441ef3

Parent 9dcecf4c8975

by Adrian Buehlmann

Changes to 2 files · Browse files at 22fa91441ef3 Showing diff from parent 9dcecf4c8975 Diff from another changeset...

 
15
16
17
18
19
20
 
 
21
22
23
 
25
26
27
28
29
30
31
 
 
 
 
 
32
33
34
 
95
96
97
 
 
 
 
 
 
 
 
 
98
99
 
100
101
102
 
130
131
132
133
 
134
135
136
 
15
16
17
 
18
 
19
20
21
22
23
 
25
26
27
 
 
 
 
28
29
30
31
32
33
34
35
 
96
97
98
99
100
101
102
103
104
105
106
107
108
 
109
110
111
112
 
140
141
142
 
143
144
145
146
@@ -15,9 +15,9 @@
 class LogDetailsDialog(gtk.Dialog):     def __init__(self, model, apply_func): - buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)   super(LogDetailsDialog, self).__init__( - flags=gtk.DIALOG_MODAL, buttons=buttons) + flags=gtk.DIALOG_MODAL) + self.connect('response', self.dialog_response)     self.apply_func = apply_func   self.dirty = False @@ -25,10 +25,11 @@
  gtklib.set_tortoise_icon(self, 'general.ico')   gtklib.set_tortoise_keys(self)   - self._btn_apply = gtk.Button(_('Apply')) - self._btn_apply.set_sensitive(False) - self._btn_apply.connect('clicked', self._btn_apply_clicked) - self.action_area.pack_end(self._btn_apply) + # add dialog buttons + self.okbtn = self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK) + self.applybtn = self.add_button(gtk.STOCK_APPLY, gtk.RESPONSE_APPLY) + self.cancelbtn = self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CLOSE) + self.set_default_response(gtk.RESPONSE_OK)     self.set_title(_('Log Details'))   @@ -95,8 +96,17 @@
    self.show_all()   + def dialog_response(self, dialog, response_id): + if response_id == gtk.RESPONSE_OK: + self.apply() + self.destroy() + elif response_id == gtk.RESPONSE_APPLY: + self.apply() + else: + self.destroy() +   def update_buttons(self): - self._btn_apply.set_sensitive(self.dirty) + self.applybtn.set_sensitive(self.dirty)     model, seliter = self.tv.get_selection().get_selected()   @@ -130,7 +140,7 @@
  self.dirty = True   self.update_buttons()   - def _btn_apply_clicked(self, button, data=None): + def apply(self):   self.apply_func()   self.dirty = False   self.update_buttons()
 
235
236
237
238
239
240
241
242
243
 
269
270
271
272
273
274
275
 
235
236
237
 
 
 
238
239
240
 
266
267
268
 
269
270
271
@@ -235,9 +235,6 @@
    def show_details_dialog(self):   - def close(dialog, response_id): - dialog.destroy() -   columns = {}   columns['graph'] = (self.graphcol, _('Graph'), 'graphcol', 'graph')   @@ -269,7 +266,6 @@
  self.details_model = model     dlg = histdetails.LogDetailsDialog(model, self.apply_details) - dlg.connect('response', close)   dlg.show()     def apply_details(self):