Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

qtlib: use Yes/No buttons for QuestionMsgBox

It returns bool value instead of return code of button.

Changeset a995ba14f694

Parent 62d1f14bdba1

by Yuki KODAMA

Changes to 2 files · Browse files at a995ba14f694 Showing diff from parent 62d1f14bdba1 Diff from another changeset...

 
299
300
301
302
303
304
305
306
 
 
 
 
307
308
309
310
311
312
313
314
 
 
 
 
315
316
317
 
299
300
301
 
 
 
 
 
302
303
304
305
306
307
308
 
 
 
 
 
309
310
311
312
313
314
315
@@ -299,19 +299,17 @@
  _('The destination "%s" already exists as a file!' % dest))   return False   elif os.listdir(dest): - r = qtlib.QuestionMsgBox(_('Confirm overwrite'), - _('The directory "%s" is not empty!\n\n' - 'Do you want to overwrite it?' % dest), - buttons=QMessageBox.Yes|QMessageBox.No) - if r != QMessageBox.Yes: + if not qtlib.QuestionMsgBox(_('Confirm overwrite'), + _('The directory "%s" is not empty!\n\n' + 'Do you want to overwrite it?') % dest, + parent=self):   return False   else:   if os.path.isfile(dest): - r = qtlib.QuestionMsgBox(_('Confirm overwrite'), - _('The file "%s" already exists!\n\n' - 'Do you want to overwrite it?' % dest), - buttons=QMessageBox.Yes|QMessageBox.No) - if r != QMessageBox.Yes: + if not qtlib.QuestionMsgBox(_('Confirm overwrite'), + _('The file "%s" already exists!\n\n' + 'Do you want to overwrite it?') % dest, + parent=self):   return False   else:   r = qtlib.WarningMsgBox(_('Duplicate name'),
 
205
206
207
208
 
 
 
209
210
211
 
205
206
207
 
208
209
210
211
212
213
@@ -205,7 +205,9 @@
  return CommonMsgBox(QtGui.QMessageBox.Critical, *args, **kargs)    def QuestionMsgBox(*args, **kargs): - return CommonMsgBox(QtGui.QMessageBox.Question, *args, **kargs) + btn = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No + res = CommonMsgBox(QtGui.QMessageBox.Question, buttons=btn, *args, **kargs) + return res == QtGui.QMessageBox.Yes    class CustomPrompt(QtGui.QMessageBox):   def __init__(self, title, message, parent, choices, default=None,