Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable thread: remove extra buttons from ui.promptchoice() dialog (closes #159)

This dialog should only have buttons for the choices provided

Changeset 621e50e4d252

Parent 45edabd12add

by Steve Borho

Changes to one file · Browse files at 621e50e4d252 Showing diff from parent 45edabd12add Diff from another changeset...

 
221
222
223
224
225
226
 
227
228
229
230
231
232
233
 
 
 
234
235
236
237
 
238
239
240
 
241
242
243
 
221
222
223
 
 
 
224
225
226
 
227
228
229
 
230
231
232
233
234
235
 
236
237
 
 
238
239
240
241
@@ -221,23 +221,21 @@
  prompt = hglib.tounicode(prompt)   if choices:   dlg = QMessageBox(QMessageBox.Question, - _('TortoiseHg Prompt'), prompt, - QMessageBox.Yes | QMessageBox.Cancel, self.parent()) - dlg.setDefaultButton(QMessageBox.Cancel) + _('TortoiseHg Prompt'), prompt, parent=self.parent())   dlg.setWindowFlags(Qt.Sheet)   dlg.setWindowModality(Qt.WindowModal) - rmap = {}   for index, choice in enumerate(choices):   button = dlg.addButton(hglib.tounicode(choice),   QMessageBox.ActionRole) - rmap[id(button)] = index + button.response = index + if index == default: + dlg.setDefaultButton(button)   dlg.exec_()   button = dlg.clickedButton()   if button is 0: - result = default + self.responseq.put(None)   else: - result = rmap[id(button)] - self.responseq.put(result) + self.responseq.put(button.response)   else:   mode = password and QLineEdit.Password \   or QLineEdit.Normal