Package mcbase :: Package widgets :: Module mcprogressdialog
[hide private]
[frames] | no frames]

Source Code for Module mcbase.widgets.mcprogressdialog

 1  # -*- coding: utf-8 -*- 
 2   
 3  ########################################################################## 
 4  # mcprogressdialog.py 
 5  # 
 6  # A dialog for displaying progress 
 7  # 
 8  # (C) 2009 Likya Software Ltd. 
 9  ############################################################################ 
10   
11  from PyQt4.Qt import * 
12  from twisted.internet import defer 
13   
14  from mcpushbutton import MCPushButton 
15  from mclineedit import MCLineEdit 
16   
17   
18 -class MCProgressDialog(QProgressDialog):
19 ''' 20 Progress dialog class for MOCOP project. 21 '''
22 - def __init__(self, *prm):
23 ''' 24 Creates an instance of MCProgressDialog 25 ''' 26 QProgressDialog.__init__(self, *prm) 27 self._cantBeCancelled = False 28 self.setWindowModality(Qt.WindowModal) 29 self.setMinimumDuration(1000)
30
31 - def setCantBeCancelled(self, state=True):
32 self._cantBeCancelled = state 33 # If the dialog can not be cancelled then remove the cancel 34 # button 35 if state: 36 self.setCancelButton(None)
37
38 - def cantBeCancelled(self):
39 return self._cantBeCancelled
40
41 - def closeEvent(self, event):
42 ''' 43 Overriden close event method. Ignores close event 44 request if the dialog is in ignoreCancels() mode. 45 ''' 46 if self.cantBeCancelled(): 47 event.ignore() 48 else: 49 event.accept()
50