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

qtlib: add utility functions for message box

Changeset e79d8efcad31

Parent 4798bc49dac4

by Yuki KODAMA

Changes to one file · Browse files at e79d8efcad31 Showing diff from parent 4798bc49dac4 Diff from another changeset...

 
99
100
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
103
104
 
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@@ -99,6 +99,28 @@
  msg = msg.replace('\n', '<br />')   return '<font style="%s">%s</font>' % (style, msg)   +def CommonMsgBox(icon, title, main, text='', buttons=QtGui.QMessageBox.Close, + parent=None): + msg = QtGui.QMessageBox(parent) + msg.setIcon(icon) + msg.setWindowTitle(title) + msg.setStandardButtons(buttons) + msg.setText('<b>%s</b>' % main) + info = '' + for line in text.split('\n'): + info += '<nobr>%s</nobr><br />' % line + msg.setInformativeText(info) + return msg.exec_() + +def InfoMsgBox(*args, **kargs): + return CommonMsgBox(QtGui.QMessageBox.Information, *args, **kargs) + +def WarningMsgBox(*args, **kargs): + return CommonMsgBox(QtGui.QMessageBox.Warning, *args, **kargs) + +def ErrorMsgBox(*args, **kargs): + return CommonMsgBox(QtGui.QMessageBox.Critical, *args, **kargs) +  class CustomPrompt(QtGui.QMessageBox):   def __init__(self, title, message, parent, choices, default=None,   esc=None, files=None):