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

Source Code for Module mcbase.widgets.mcdialog

  1  # -*- coding: utf-8 -*- 
  2   
  3  ########################################################################## 
  4  # mcdialog.py 
  5  # 
  6  # Non blocking dialog widget 
  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  imageInformation_data = \ 
 18      "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \ 
 19      "\x49\x48\x44\x52\x00\x00\x00\x20\x00\x00\x00\x20" \ 
 20      "\x08\x06\x00\x00\x00\x73\x7a\x7a\xf4\x00\x00\x06" \ 
 21      "\xd5\x49\x44\x41\x54\x58\x85\x8d\x96\x7f\x88\x5c" \ 
 22      "\x57\x15\xc7\x3f\xbb\xbc\xc0\x79\x30\xc2\x7b\xb0" \ 
 23      "\x91\x7d\xb0\x81\x0c\xa6\xe0\x08\x81\xcc\x36\x85" \ 
 24      "\xee\x60\xd1\xc6\xe6\x8f\xa4\x88\x26\x69\x95\x5a" \ 
 25      "\xf4\x0f\x57\x05\x69\xb0\x62\xac\x36\x34\x7f\x49" \ 
 26      "\xfc\x51\x62\x40\x1a\x53\x10\x9a\x06\x6c\x52\x85" \ 
 27      "\x60\x8c\x68\x56\xa1\xb2\x29\x54\x36\x7f\x44\xb3" \ 
 28      "\x7f\x98\xee\x14\x5a\x98\x42\x82\xef\xd1\x0c\xfb" \ 
 29      "\x2e\xc9\x63\xef\xc1\x7d\xf0\xfc\xe3\xde\x99\x79" \ 
 30      "\x9b\xd9\xd8\x5c\x78\x73\xe6\x72\xef\x3d\xe7\x7b" \ 
 31      "\xcf\xf9\x9e\x73\xcf\x44\x55\x55\x3c\xe8\x58\xe9" \ 
 32      "\xa6\xbf\x58\xb8\xd2\x7d\xea\xea\x8d\xee\xa7\xba" \ 
 33      "\x37\x73\x00\xc4\xaf\x35\x9b\x09\x73\xbb\x9a\x1c" \ 
 34      "\x7a\xbc\x7d\xaa\x39\x13\x7f\x8f\x2d\x7e\x61\x1d" \ 
 35      "\x28\x81\x70\x73\x9d\x13\x1f\x07\x20\xbf\x9d\xff" \ 
 36      "\xec\xe4\xd9\xc5\xa3\x8b\x37\x32\x08\x22\x5a\x3b" \ 
 37      "\x22\x66\x1f\x6a\x12\x45\x21\x51\x43\xd0\x12\x54" \ 
 38      "\x95\x34\xcd\xb9\x7a\x23\xa5\x77\x2b\x23\x12\xe8" \ 
 39      "\xec\x8a\x38\xf2\xf5\xfd\x07\xe2\x38\xbc\xc4\x3a" \ 
 40      "\x0c\x01\x3d\x30\x80\x75\x38\xff\x97\xa5\xea\xe4" \ 
 41      "\xef\x96\x49\xa6\xa7\x39\xb8\xb7\xc3\xfe\xcf\x26" \ 
 42      "\x24\xf1\xff\xc5\xcb\x4a\xcf\xf2\xe6\x95\x1e\x0b" \ 
 43      "\x7f\xbf\x4a\x24\x70\xe4\x99\xf6\xcb\x4f\x7e\x7e" \ 
 44      "\xf6\xc5\xfb\x01\xa0\xaa\xaa\xb1\x6f\xf5\xa3\xb5" \ 
 45      "\x6f\xcc\x3d\x7d\xa2\x6a\x7d\xf9\xb5\xea\xdc\xe2" \ 
 46      "\x7f\xaa\xb5\xb5\x6a\xf8\xad\xae\xae\x55\xab\x77" \ 
 47      "\xbc\x5c\xad\xcf\xab\x6a\xed\x8e\xdb\x53\xfd\xb7" \ 
 48      "\xaa\x56\xef\x54\xd5\x4b\xbf\x79\xb7\x8a\x9e\x38" \ 
 49      "\x51\x7d\xf3\xe8\xb9\x6a\xed\xce\xda\xa6\xb6\xc6" \ 
 50      "\x3c\x70\x7d\xb9\x77\xf8\x5b\x3f\x5f\x38\xd5\xde" \ 
 51      "\xd5\x66\xfe\x40\x8b\xd6\x4c\x8c\x16\x16\x00\xc5" \ 
 52      "\xc5\x5c\x4b\x88\x1a\x21\x8a\x85\x32\x44\xd5\x22" \ 
 53      "\x41\x6d\x1d\x90\xc0\xeb\xfb\x40\x79\xe1\xd4\x02" \ 
 54      "\xad\x29\xe5\xd7\x47\x0f\x1e\x48\x92\xf8\xd2\x7d" \ 
 55      "\x43\x90\xdf\xb6\x4f\x7d\xe1\xf9\xd7\x5f\x6c\xed" \ 
 56      "\x68\x3d\xfc\xd2\xb7\xe7\x08\x4b\xc8\x4b\x1d\x29" \ 
 57      "\xf5\xfb\x92\xa9\x98\xd8\x87\xc2\x5a\xc8\x32\x4b" \ 
 58      "\xae\x3a\x0e\x02\x08\x05\x56\x32\x38\x7c\xe2\x22" \ 
 59      "\xb3\x33\x70\xee\xa7\x5f\x9b\x08\xc3\x70\x13\x00" \ 
 60      "\xeb\xb0\x67\xfe\x97\x55\xb2\x7d\x96\xe7\x9e\x69" \ 
 61      "\x3b\xe6\x96\x1b\xd5\x69\xa9\xb4\x66\x22\x92\x64" \ 
 62      "\x23\xa5\xad\x85\xe5\xf7\x52\x3f\xab\x9b\x77\x52" \ 
 63      "\x04\xba\x19\x1c\x7b\x65\x81\x67\x1f\x13\x8e\xff" \ 
 64      "\xe0\xd0\xc4\xe0\x6c\x30\xf8\x73\xe6\xc2\x52\x95" \ 
 65      "\x69\xc2\xfc\x63\x4d\xd4\x28\x76\x68\xdc\xd4\x94" \ 
 66      "\x0d\x7e\x37\x8e\x30\x84\xbc\xd8\x7c\x3f\x18\x28" \ 
 67      "\x84\xa4\x01\xf3\x07\xda\x9c\x3c\xbb\x40\x73\xdb" \ 
 68      "\x52\x35\xff\x74\x67\x02\x60\x12\x20\x4d\xf3\x7d" \ 
 69      "\x67\xfe\xd6\x5d\x3a\xf8\x44\x9b\x28\x10\x52\xa3" \ 
 70      "\x18\x05\xa3\x8a\xaa\x78\x09\xa6\x50\xd2\xfe\x38" \ 
 71      "\x84\xde\x4d\x4b\x66\xec\xf8\xfe\xc1\xbc\x50\x72" \ 
 72      "\xa3\x34\x93\x90\x4e\xbb\xc3\xc5\xb7\xba\x58\xeb" \ 
 73      "\x78\x35\x09\x70\xfa\x8d\xc5\x05\x53\xd2\x69\x6e" \ 
 74      "\x0b\xf9\xd0\xe4\xde\x98\x45\x0b\xc8\x0a\x37\xcf" \ 
 75      "\x8a\x1c\x2d\x9d\xab\x2f\x5f\x4d\xc9\xef\x5a\xec" \ 
 76      "\x3a\x5c\xef\xe6\x2c\xbc\xd3\x23\x57\x46\xfb\x06" \ 
 77      "\xb2\x18\x9d\x33\x6a\x51\x85\xb9\xdd\x11\xbd\x42" \ 
 78      "\x58\x78\x7b\x79\x7e\xc8\x81\x3d\xdf\x39\x53\x25" \ 
 79      "\xdb\xdb\xb4\x1f\x12\x57\xb9\xea\x63\x8b\xe3\x07" \ 
 80      "\x5b\x42\x58\xb7\xb0\x25\x44\xd7\x2d\xf1\x96\x10" \ 
 81      "\x8b\x45\xad\x8f\x7c\x38\x5a\x1f\x4a\x2c\x21\x21" \ 
 82      "\xb9\xb5\xa4\x7d\x25\xeb\x1b\x72\x85\xac\x9f\xd3" \ 
 83      "\x6c\x98\x7f\x5d\x7e\x75\x7e\x77\xb0\xf2\x7e\xba" \ 
 84      "\xcf\x20\xcc\x4e\x09\x26\xf7\xee\x0d\xc4\x11\x30" \ 
 85      "\x10\x28\x9c\xd4\x22\x77\xc4\xc4\xcd\x0d\x39\x12" \ 
 86      "\xb8\xbc\x90\x00\xcc\xdd\xdc\xc5\x5e\x73\x7f\x2e" \ 
 87      "\xf7\xc6\x32\x7a\x99\xf5\x1c\x01\x2d\x95\xb8\x11" \ 
 88      "\xb1\x92\xea\xc3\x00\xc1\xf2\x8d\x74\x01\xaf\x28" \ 
 89      "\x2f\x20\x0c\xc0\xa2\x4e\xaa\x12\x06\x82\x55\x25" \ 
 90      "\x89\x84\xce\xce\x04\x11\x41\x50\xa4\x21\x84\x81" \ 
 91      "\xaf\x07\x6a\x39\xf9\xc7\x1e\xb6\x54\x42\x1c\x87" \ 
 92      "\x7a\x99\x21\x2d\x2c\x61\x09\x16\x08\x45\xb0\x25" \ 
 93      "\xc4\x81\x38\xea\x87\x11\x97\xdf\xba\x7e\x29\x58" \ 
 94      "\xbc\xd6\x45\x82\x88\xd4\x18\xc7\x59\x05\x09\x04" \ 
 95      "\x83\x22\x08\x66\xc0\xea\x42\x89\x1a\xc2\xec\xf6" \ 
 96      "\xd0\xbb\xb7\x36\x24\x24\x35\x19\xa6\x10\x52\x63" \ 
 97      "\x50\x05\x5b\x5a\x42\x9f\x63\x2e\x18\xfe\x72\x1e" \ 
 98      "\xa4\x8a\x90\x15\x30\x69\x0a\x97\x30\xaa\x82\x16" \ 
 99      "\xae\xca\x65\x75\x36\x97\x82\xaa\x92\xf5\xe1\x87" \ 
100      "\x67\x97\x39\x7e\xa1\x87\x27\xf0\x70\xd8\x12\xd2" \ 
101      "\x3e\xac\x64\x8a\x96\xde\xa8\x84\xce\x74\x10\x42" \ 
102      "\x00\x61\xe0\x40\x87\x81\x40\x09\x12\xc4\xe4\x77" \ 
103      "\xf5\x4b\x93\xb9\x2a\x0a\xe4\x85\x23\x48\x5e\x28" \ 
104      "\xd6\xcb\xbc\x2e\xd5\xc5\xf0\xe2\x3f\x7b\x2c\x7f" \ 
105      "\x98\x8f\xa5\x62\x56\x8c\x6e\xcc\x06\x69\x1d\x08" \ 
106      "\x2f\x2d\x40\xe0\xca\xb8\xaa\x32\x19\x8b\x0c\x53" \ 
107      "\x68\x70\x63\x27\xa9\x49\x86\x92\x52\x86\xb7\xdc" \ 
108      "\x10\x05\x7f\x43\x19\xc4\x78\x40\x50\xf1\x35\x7b" \ 
109      "\xe8\x81\x70\x38\x97\x00\x02\x69\x80\x16\x60\xbc" \ 
110      "\x52\x2d\x15\x02\xd0\x5a\xf9\x25\x70\x61\x20\x10" \ 
111      "\x5f\x21\xc7\x87\x62\x21\x88\x5d\xfd\xab\x65\xd1" \ 
112      "\xe0\x3c\x5e\x2f\xa5\xf3\x8c\x96\x96\x38\x4e\x98" \ 
113      "\x6c\xef\x48\x20\x50\x90\x41\x4a\xd5\x64\x50\x9b" \ 
114      "\x4b\xe4\x91\xcb\x98\x71\x80\xc8\xc7\x5a\xe4\x9e" \ 
115      "\xf3\xe2\xca\x72\x3d\x65\xad\xb8\x62\x3d\xdd\x10" \ 
116      "\x26\x3b\x3b\xa7\xbf\x1f\x05\x60\xbd\xdb\xd4\xe7" \ 
117      "\xf9\xe0\x49\x1d\x3d\xad\x4e\x49\x58\x03\x35\x1e" \ 
118      "\x86\x91\xb1\xfa\x73\x74\xaf\x5e\x02\x01\xcd\x48" \ 
119      "\xa6\xc2\x97\x27\xdb\x3b\x9a\x4b\x4d\x71\x79\x3a" \ 
120      "\xe6\x01\x20\x12\x41\x02\x71\xf9\x1f\xb8\xf9\xa6" \ 
121      "\xc6\x85\xe1\xfa\x70\x5f\xb0\x89\x47\xbd\x47\x5a" \ 
122      "\x22\x34\x67\xa2\x1b\x93\x61\x1c\x5e\x6b\x45\x42" \ 
123      "\xde\x4f\x91\xc6\xe0\xe6\x35\xb7\x05\x5e\xb9\x37" \ 
124      "\xe2\x08\xb6\x29\x86\xe1\xfa\x48\x0a\x04\x8a\x88" \ 
125      "\xa0\xfe\x8c\x0a\x84\x6a\xd9\xff\x68\x42\xbc\x35" \ 
126      "\x3e\x37\x09\xf0\xec\xde\xcf\xcc\x26\xa5\x41\xa2" \ 
127      "\xda\x4d\x1b\xee\x1d\x8f\xc5\xb9\xbd\x2e\x37\x1b" \ 
128      "\x9b\xed\xdb\xe0\x11\xef\xc5\x68\x2a\x62\x5a\x94" \ 
129      "\xf9\x03\x73\x87\x01\x26\xad\xb5\x74\xe6\x9a\xcb" \ 
130      "\x07\x77\x25\xa0\x86\xa8\x31\x6a\xa7\xc2\x7b\x3d" \ 
131      "\x31\x9c\x6f\x34\xee\x4a\x32\x08\x03\xc2\xba\x7d" \ 
132      "\xe1\xc0\xfd\xb8\xec\x8a\x1a\x82\xf9\xa0\xcb\x91" \ 
133      "\xbd\xad\x77\xe3\x38\x3c\x0d\xb5\x8e\x28\x4d\xf3" \ 
134      "\xf9\x43\x3f\xbe\xf8\x5a\xb2\x7b\x0e\x55\x7c\xb5" \ 
135      "\x1a\x81\x91\x20\x24\x89\x60\xcf\xce\x69\xf6\xb4" \ 
136      "\xc7\x9b\xfc\xf4\x36\x9c\xff\x47\x4a\x37\x55\xd4" \ 
137      "\x3f\x91\x3a\xe8\xaa\x34\x45\x24\x44\xc9\x91\x5b" \ 
138      "\x19\xe7\x5f\x7d\x6e\xd8\x11\x39\x00\xbe\x6f\x5f" \ 
139      "\x5a\xee\x3d\x7f\xec\x8d\xeb\xbf\x6a\x7e\x7a\x16" \ 
140      "\xe3\x1b\x51\xf1\xc6\x09\x2c\xf3\x8f\x37\x69\x4e" \ 
141      "\xb9\xa2\x65\x71\x35\x7d\x20\x09\x14\x5b\xc0\xe9" \ 
142      "\xbf\x76\x51\xa2\x51\x3f\x64\x0c\xd3\x51\x04\x28" \ 
143      "\xa6\x6f\xf8\xc3\x4f\xf6\x4c\xd4\x81\x8f\x75\xc5" \ 
144      "\xe7\xff\x7c\xbd\x7a\xf3\x4a\x8f\xd6\xee\x0e\xd6" \ 
145      "\x77\x36\x60\x89\x25\xc4\x96\x40\x69\x47\x4f\x75" \ 
146      "\xbd\xb8\xf8\xa2\x25\x01\x9e\x85\xa1\xaf\x98\x6e" \ 
147      "\xbf\xf6\x0d\xe7\xef\x31\x3e\x0e\xc0\x7b\x62\xf1" \ 
148      "\x6a\xef\xf7\xc7\xce\x2e\x7d\xb5\xf3\x68\x87\xe9" \ 
149      "\xad\x42\x96\xbb\xf7\x21\x1e\xf0\x6f\xc0\x05\x64" \ 
150      "\x58\x31\xa9\x57\x4c\x80\x00\xa6\xb7\x46\x74\xbb" \ 
151      "\x5d\x8c\xd1\xb1\x9b\xdf\xd7\x03\x58\xf7\x94\x76" \ 
152      "\xdf\xcb\xe6\x2f\xbe\xd3\xfb\x6e\xb7\xcf\xc3\x73" \ 
153      "\x8f\xb4\x48\xa6\x22\x8c\x51\x6c\xe9\xcb\xb5\x1f" \ 
154      "\xf5\xf6\x13\x20\xf6\xd9\x93\xf6\x95\xe5\x7f\x77" \ 
155      "\x69\x35\x2c\xc7\x7f\xf4\xe4\xa6\xc6\x37\x07\x70" \ 
156      "\xcf\x38\xfd\xdb\xc5\x6a\xe5\x16\xc4\x53\x11\x49" \ 
157      "\x1c\x23\x0d\x21\x6a\x44\x68\xcd\x03\xe2\xdd\xaf" \ 
158      "\xaa\xe4\x85\x62\x6e\xe7\xa4\xfd\x94\xfd\x8f\x24" \ 
159      "\x1c\xda\x37\x7b\x5f\xe3\x0f\x04\x00\x20\xbd\x99" \ 
160      "\xbe\xd2\xbb\x95\x7f\x71\xe1\x5a\xb6\x3d\xed\x5b" \ 
161      "\x8c\xc2\x74\x14\x13\x37\x5c\x4c\x52\x63\xd0\x82" \ 
162      "\x8f\x08\x2c\xed\x1d\xf1\x27\x3b\x3b\x23\x5a\x33" \ 
163      "\xf1\x57\xe2\x24\xb9\xf0\x71\xba\x1f\x08\xc0\x60" \ 
164      "\xe4\xb7\xf3\xcf\x19\x63\x3e\x91\x17\xbc\x6e\x0a" \ 
165      "\xbb\x95\xd2\x67\x83\x08\x91\x84\x7f\x4a\xa6\xe4" \ 
166      "\xfd\x64\x5b\xf2\xc2\x03\x2b\x04\xfe\x07\x43\x0c" \ 
167      "\xf9\x2d\x24\xc0\xf3\xfc\x00\x00\x00\x00\x49\x45" \ 
168      "\x4e\x44\xae\x42\x60\x82" 
169   
170  imageWarning_data = \ 
171      "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \ 
172      "\x49\x48\x44\x52\x00\x00\x00\x20\x00\x00\x00\x20" \ 
173      "\x08\x06\x00\x00\x00\x73\x7a\x7a\xf4\x00\x00\x04" \ 
174      "\xff\x49\x44\x41\x54\x58\x85\xd5\x97\x5f\x6c\x54" \ 
175      "\x45\x14\xc6\x7f\xdb\x9d\xa5\x33\xd2\xd5\x3b\x76" \ 
176      "\x9b\xec\x6a\x1b\x7a\x2b\x60\x57\x50\x53\x82\x4a" \ 
177      "\x11\x84\x25\x62\x68\xb3\x04\x8a\x10\x23\x48\x22" \ 
178      "\xf0\x06\x0f\x4d\x8c\x0f\x4a\x31\x8a\x26\xbe\x69" \ 
179      "\x89\x0f\x3e\x18\x0d\x89\x31\xc4\x28\x21\x91\xa8" \ 
180      "\x18\x8d\x68\xd2\x44\xa2\xa6\xa0\xe2\xca\x83\x02" \ 
181      "\x55\x49\xdb\x40\xf5\xae\x72\x93\x1d\xe8\xd8\xfa" \ 
182      "\x70\xef\xb2\xdb\xa5\xa5\x7f\xd0\x18\x27\x99\x9c" \ 
183      "\x9d\x7b\x67\xce\xf9\xbe\x6f\xce\x9c\xbb\x13\x19" \ 
184      "\x1d\x1d\xe5\x7f\xd9\x7a\xb3\xb8\xbd\x6b\x68\x02" \ 
185      "\xaa\x80\xc8\x4c\xfd\x54\xcd\x64\x51\x2e\xcb\x5e" \ 
186      "\x2d\x38\x23\x05\xa7\x7b\xb3\xbc\x08\xc8\x99\xfa" \ 
187      "\x8a\x4e\x77\x41\x6f\x16\x57\x08\x0e\xc5\xd3\xa0" \ 
188      "\x6f\x05\x33\xc8\x32\x3d\x8b\x0f\x7a\xce\x33\x04" \ 
189      "\xfc\x35\x5d\x7f\xd3\x46\xad\x05\xfb\x55\x0c\x52" \ 
190      "\x6d\xa0\x57\x83\x8a\xc3\x86\x7a\x5e\x01\xe2\xcc" \ 
191      "\x80\xd0\xb4\x00\xe4\xb2\x74\x14\x2c\x2b\x92\x6b" \ 
192      "\x00\x01\x48\x70\x56\x82\x94\x2c\x7e\x7d\x09\x1b" \ 
193      "\x01\xc5\x34\xf3\x61\xba\x0a\x74\xeb\x06\x50\xad" \ 
194      "\x2d\xd0\x9a\x83\x7b\x7a\xd1\xcb\x5b\x50\x75\xd0" \ 
195      "\x9a\x60\x0f\x70\x23\x10\xfb\x57\x00\xe4\xb2\xec" \ 
196      "\x45\x30\xc7\xc9\x00\x8d\x5d\x80\x06\x52\x50\xdf" \ 
197      "\x85\xdb\x06\x40\xea\xd3\x07\xd9\x0d\xdc\x30\x1d" \ 
198      "\xbf\x53\xda\xb3\x30\xf1\xf6\xeb\x3b\x91\x7a\xdd" \ 
199      "\x66\xa8\xdd\x51\x7a\x59\xdd\x00\x72\x00\x31\x78" \ 
200      "\x12\x86\x68\xd6\xb3\xf8\xb8\xe7\x3c\x17\x98\x62" \ 
201      "\x42\x4e\x09\x40\xe7\x7c\xf6\x51\xcd\x7d\x4d\x8f" \ 
202      "\x3a\xd0\xbc\x8f\xe3\xc7\x07\x39\xf4\x5e\x0f\x27" \ 
203      "\x4f\x9c\xc5\x5c\xb6\x34\x34\x2f\x45\x45\x0f\xe0" \ 
204      "\x7f\x6f\xab\x75\x15\xb5\x6f\x9e\xe1\x23\xe0\x12" \ 
205      "\x30\x69\x95\x9b\x14\x40\x6e\x3d\x19\x46\xe8\x76" \ 
206      "\x33\x92\x58\xa6\x93\x02\x0f\xf0\xc9\x91\x13\x08" \ 
207      "\x21\x00\x18\xea\xcf\xa3\x6b\x1b\xd0\x4d\x29\xf8" \ 
208      "\xfd\x33\x54\x3f\xcd\xf3\x1c\xbe\xfb\xf0\x1c\x3f" \ 
209      "\x01\x76\x32\xff\x93\xef\x95\xa5\x5b\xd5\x81\x6a" \ 
210      "\x4b\x42\xdd\x66\xf2\xbe\x07\x02\x8c\x35\x00\x18" \ 
211      "\x0c\x5e\x3e\x0f\xba\x1d\xdd\x96\x86\x38\xb4\x26" \ 
212      "\x78\x86\x20\x21\xc5\x75\x01\xc8\x65\xd9\xa6\x04" \ 
213      "\x77\x27\xd7\x02\xf5\x7b\x00\x70\x64\xc0\x4b\x0a" \ 
214      "\x89\xb1\x06\x89\x44\x27\x00\x24\x24\xb7\xe3\x76" \ 
215      "\x48\x24\xdc\x7e\x70\x25\x8f\x13\x1c\xcb\x6b\xc6" \ 
216      "\x98\xf0\x65\x2e\x8b\x83\xe0\x65\x5c\x50\x4b\x32" \ 
217      "\xa0\xd2\x80\x41\xe9\x80\x97\x31\x06\x2c\x78\xc6" \ 
218      "\xc3\xad\x77\x80\x3c\xc4\x97\xc2\xe2\x34\x7a\x1e" \ 
219      "\xa4\x6b\x78\x7a\x43\x3d\x0d\x4c\x72\x2c\x27\x46" \ 
220      "\x27\x78\x0e\x8b\xe3\x6e\x75\x20\xb1\x25\x60\x48" \ 
221      "\x20\xbb\xeb\x4a\xb0\x50\x30\x05\x52\x09\x0d\x31" \ 
222      "\x13\x2e\x32\x90\xdc\x45\x6a\xab\x44\x09\xe2\xbb" \ 
223      "\x9a\x79\x0a\x98\xcd\x35\x72\x6d\x5c\x00\xbd\x59" \ 
224      "\x5c\x2c\x9d\xa9\x0c\xd0\xb8\x0a\x62\x6e\xc0\x10" \ 
225      "\x03\xe4\x49\x26\x25\x9e\xef\x81\x85\x54\x2a\x0c" \ 
226      "\x8c\x07\x14\x20\xe6\x40\x63\x2b\x72\x39\x24\x6b" \ 
227      "\x78\x6c\x67\x33\x0b\x81\x6a\x26\xa8\x90\xe3\x02" \ 
228      "\x90\xb0\x5f\xc5\x41\x77\x38\xa0\xdb\x03\xc7\x65" \ 
229      "\xdd\xad\x07\x2c\xe4\xfd\x3c\xe9\xb9\x32\x0c\x6e" \ 
230      "\x4a\x20\xf5\x2a\x52\x1d\x0e\x28\xd8\x31\x97\x97" \ 
231      "\x80\x9a\x89\x54\xb8\x0a\x40\x2e\x4b\x07\x82\x15" \ 
232      "\xce\x26\x20\xd9\x1e\xc0\x21\x3f\xa6\x2b\x6d\x90" \ 
233      "\x35\x06\x63\x0c\x29\xd7\x94\x05\xcf\x03\x03\x80" \ 
234      "\x86\x44\x0b\xee\x26\x90\xb0\xf8\xad\x65\x13\x7f" \ 
235      "\x27\xae\x56\x40\xd0\xad\x1a\x40\xaf\x4c\x82\x6a" \ 
236      "\x19\xcb\xac\xcc\xba\x2e\x24\x93\x85\x70\x3c\x10" \ 
237      "\xaa\xe0\x95\xc6\xf1\x45\xa8\x65\x0e\xda\x85\xb4" \ 
238      "\x33\xf1\x77\x62\x8c\x2c\xb9\x2c\x7b\x19\x61\xdd" \ 
239      "\xfc\x9d\x40\xe3\x43\x10\xad\x03\xfc\xd0\xe9\x58" \ 
240      "\xeb\x36\x59\xee\x5a\xa0\x50\xb3\x8b\xcf\x8b\xe0" \ 
241      "\xbc\xd2\xbc\x59\x20\x6a\xcf\xe1\x1f\x23\xde\x9e" \ 
242      "\x44\x1e\xe8\xa3\x07\xb8\x4c\x59\x85\xbc\x02\xe0" \ 
243      "\xcc\x7a\x1c\x3b\xc2\xdb\xa9\x0c\x52\xb5\x35\x86" \ 
244      "\xec\x7d\x82\x92\x6e\x2a\xba\x47\x2c\x16\x41\xcd" \ 
245      "\xbe\x38\xa1\x42\x60\x20\x1a\x23\x96\xb8\x88\xed" \ 
246      "\xf7\x91\x43\x34\xf7\xf9\x1c\xfc\xf1\x4f\xfe\xa0" \ 
247      "\xac\x42\x5e\xd9\x82\x82\x65\x9f\x8a\x73\x93\xee" \ 
248      "\x00\xe2\x77\x00\x83\x94\xf6\xd4\x0b\x6d\xd0\x8f" \ 
249      "\x1e\x19\x64\xd5\xea\x2f\x58\xda\x7a\x82\x37\x5e" \ 
250      "\x3b\x15\xce\x1b\x6f\xbe\x07\x42\x93\xda\x04\x28" \ 
251      "\xe2\x5d\x0b\x79\x81\x8a\x63\x19\x0d\xa5\xcf\x28" \ 
252      "\x41\xb7\xb3\x16\xd4\xfd\x49\x88\x3a\x04\xf9\x52" \ 
253      "\x64\xec\x53\xae\xc0\x96\xed\xbf\xe2\xe7\x2d\xbe" \ 
254      "\xf1\x39\xf6\x95\xcf\x86\x0e\x4b\x3c\x4e\x38\xcf" \ 
255      "\x8e\xb5\x51\xa0\xc6\xa7\xc6\x5a\xcc\x0f\x34\x2f" \ 
256      "\xba\x99\x6f\x0f\x9f\xe3\x74\x51\x85\xa0\x56\x0b" \ 
257      "\x9e\x45\x83\x5e\x2b\x21\x56\x9e\xf5\xe3\x37\x63" \ 
258      "\x0c\x5e\xbe\x10\xfc\xb6\xc5\x22\x54\xa8\x9c\x55" \ 
259      "\xb2\x31\x89\x6a\x33\xa8\xcf\x21\x6d\x79\x02\x38" \ 
260      "\x4a\x90\x0b\xc3\xd1\xdc\x7a\xb6\x61\xe9\x6c\x78" \ 
261      "\x12\x62\xb7\xd5\x50\x3a\x76\x96\xab\xf7\x3e\xe8" \ 
262      "\x09\xed\x73\xf8\x88\xc5\x5e\xb6\x6c\x79\x04\x1e" \ 
263      "\xde\x68\xca\x98\x57\x2a\x21\x82\x75\x4a\x20\x13" \ 
264      "\x96\xc8\x97\xdc\xb2\x3c\xc1\x6f\xef\xfc\xc2\x37" \ 
265      "\xc0\x70\x24\x97\xa5\x4f\xb7\x30\x27\xf5\x3c\x80" \ 
266      "\x13\x3a\x28\x96\x5d\x59\xc1\x48\x56\xd8\x4a\xc6" \ 
267      "\x93\x3f\x3f\xbb\x1b\x0a\x27\x19\x58\xf0\x3e\xf7" \ 
268      "\x02\xe7\x85\x12\xcc\x41\x02\xa7\xc2\xc9\x42\x52" \ 
269      "\xb0\x06\x25\x00\x6b\x40\x40\xc1\x52\x31\x2e\xbe" \ 
270      "\xa7\x6c\x1c\xae\x0b\x37\x23\xb0\x06\x85\x1c\x63" \ 
271      "\xa5\x03\x05\x48\x11\xfc\x8b\xce\x0b\xcf\xf0\xaa" \ 
272      "\xfc\x9a\x9d\xde\xb1\x20\x48\x81\x7c\x98\x07\x54" \ 
273      "\x38\x2b\xd9\x62\x53\x40\x61\xb8\xc8\x30\x7f\x25" \ 
274      "\xc8\x18\x25\x42\xd0\x25\x0b\x67\x0d\xef\x12\x9c" \ 
275      "\xc0\xaa\x08\x20\xbb\x16\xd2\x92\x92\xa4\x3d\x8b" \ 
276      "\x90\x10\x19\x4f\xec\x7f\xca\x9e\xca\xd3\x7f\xa0" \ 
277      "\x8f\x9f\x09\xce\xea\x85\x48\x88\xa4\x3a\x24\x14" \ 
278      "\xe3\x3a\xee\x79\x53\x6c\xa3\xc0\x30\x81\x98\x97" \ 
279      "\x8a\xc1\x22\x61\x9f\xd1\xfd\x6e\x06\x6d\x24\x04" \ 
280      "\x32\x1a\xf9\xaf\xaf\xe7\x7f\x03\x83\xcc\xdd\xa1" \ 
281      "\x8c\x44\x90\x57\x00\x00\x00\x00\x49\x45\x4e\x44" \ 
282      "\xae\x42\x60\x82" 
283   
284  imageCritical_data = \ 
285      "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d" \ 
286      "\x49\x48\x44\x52\x00\x00\x00\x20\x00\x00\x00\x20" \ 
287      "\x08\x06\x00\x00\x00\x73\x7a\x7a\xf4\x00\x00\x04" \ 
288      "\xed\x49\x44\x41\x54\x58\x85\xc5\x97\x4d\x68\x54" \ 
289      "\x57\x14\xc7\x7f\x29\x6f\x71\x1f\x44\x78\x03\x59" \ 
290      "\x64\xc0\xc2\x3c\xb0\xe0\x04\x85\x24\x58\x30\x52" \ 
291      "\x49\x4d\xe9\xa6\x55\x88\xd5\x2e\xd4\xb4\x9a\xda" \ 
292      "\x9d\x41\x52\x4d\x5c\xd8\x76\xd5\xd6\x45\x35\x24" \ 
293      "\xf4\x63\xd3\xc6\xea\xc8\xa4\x5d\x68\x8d\x94\x68" \ 
294      "\x37\x55\xeb\xa2\xcd\xa6\xc9\x04\x4b\x1c\x17\xc1" \ 
295      "\x09\x54\xfa\x06\x1c\x9c\x07\x0d\x7d\x77\xf1\xe0" \ 
296      "\x76\x71\xef\x9b\x79\x13\x67\x92\xd1\x2e\x3c\x70" \ 
297      "\x73\xf2\xee\x3d\x73\xcf\xff\x9c\x7b\xce\xb9\xe7" \ 
298      "\xb6\x28\xa5\x78\x9e\x64\x01\xb4\xb4\xb4\x34\x25" \ 
299      "\x3c\x07\xfd\x12\x3a\x05\xf4\x4a\x70\x80\x4e\xb3" \ 
300      "\xb4\x20\xc1\x07\xee\x00\x0b\xaf\xc1\xb5\x66\xf6" \ 
301      "\x53\x4a\xd1\xa2\x94\x5a\x13\xc0\x22\x38\x12\x86" \ 
302      "\x81\xc3\x40\x2a\x9a\x17\x31\x19\x19\x1b\x86\x96" \ 
303      "\x81\x4c\x00\x13\xbb\x35\xb0\x67\x03\x30\x07\xfd" \ 
304      "\xc0\x05\xb4\xb5\x24\x01\xb1\xb1\x9d\xc4\xae\x37" \ 
305      "\x60\x63\x12\x2c\x01\xa1\xd4\x7e\x2c\x95\x29\xcf" \ 
306      "\xce\xe2\x2d\xe4\xf0\x81\xb2\xde\xc2\x07\x06\x77" \ 
307      "\x37\xf0\x88\x52\xca\xfc\xa9\x6f\xf9\xf8\x1c\xa8" \ 
308      "\x45\x50\x7f\x83\x52\x07\x0e\x2a\xf5\xd3\x8c\x52" \ 
309      "\x8f\xff\x55\xea\xf1\xe3\xc6\xfc\xee\xa2\x52\xa3" \ 
310      "\x27\xd5\x03\xc7\x51\x33\x10\x8d\xf1\xa7\xf2\xc0" \ 
311      "\x22\x5c\x90\x70\x44\x00\xee\xe6\x34\xf6\xc7\x9f" \ 
312      "\x40\x4f\x37\xda\xf1\xb2\x39\xee\x7b\x04\xa7\x46" \ 
313      "\x98\xfd\xe5\x36\x81\x9e\xbd\xb8\x1f\x06\xd7\x05" \ 
314      "\xb0\x08\xe3\x12\x86\x13\x40\xfb\x2b\xbb\xb0\xcf" \ 
315      "\x7c\x0a\xad\xe2\xe9\x94\xc7\xf9\x0f\xdf\xf3\xfb" \ 
316      "\xd9\x31\xca\xfa\x6b\x62\x3f\x7c\xd0\x10\x80\x39" \ 
317      "\xf3\x69\x01\xb8\xdb\x7b\xb0\xcf\x9c\xab\x6e\xd6" \ 
318      "\x2a\x60\x45\x36\xa7\xd4\x71\xc0\xf7\xab\xdf\x3f" \ 
319      "\xdf\xe2\xfa\xd9\xcf\xa2\x40\xdd\x3b\x60\x62\xa2" \ 
320      "\x06\x80\x89\xf6\x82\x00\xc7\x6d\x6b\xc7\x1e\x3b" \ 
321      "\x07\x1b\x8c\xe5\xa9\x24\x74\x75\xc3\x5f\x1e\xfc" \ 
322      "\x31\xbf\xb6\xf2\xed\x7d\x90\x4c\x40\xee\x1e\x2c" \ 
323      "\xe7\x2b\xf3\xc1\x17\x5f\x73\xe3\xd7\xdb\x00\xbe" \ 
324      "\x04\x77\x00\x7c\xa5\x14\x2f\x44\xee\x30\xa9\xe6" \ 
325      "\x24\x00\x7b\xf0\x28\x48\x09\x65\x1f\xda\x12\x5a" \ 
326      "\x39\xc0\x8b\x49\xd8\xd2\xa1\xe7\x1f\x15\x9f\xe4" \ 
327      "\x9d\xdd\x5a\x39\x40\x57\x07\xb4\x25\x2b\xeb\xf6" \ 
328      "\xde\x7d\xa4\x85\xc0\xd4\x8f\xe1\x48\x6f\x05\x00" \ 
329      "\x3a\xcf\x49\x6e\x4a\x43\x9b\xa3\xdd\x6d\x09\xd8" \ 
330      "\xb9\x83\x1a\x7a\xc9\x85\x9e\x1e\xbd\x5e\x2a\x57" \ 
331      "\xf9\xce\x3e\x70\xdd\x5a\xd9\x9d\x3b\x40\x08\xbd" \ 
332      "\x1e\x42\xc7\x9e\xb7\x74\x3e\x1b\x5d\x60\x2a\xa1" \ 
333      "\xa9\x70\x29\x17\x60\x4b\xda\x9c\x9f\x0f\x25\x0f" \ 
334      "\x72\xf3\x55\x0f\x44\x94\xee\xd0\x1e\xba\x7c\x55" \ 
335      "\xcb\x1d\x38\x08\xe9\x55\xca\x41\x1f\xc3\x42\x0e" \ 
336      "\x1e\x7a\x90\xcf\x43\xc9\x23\xa9\x7f\x91\x9a\xd4" \ 
337      "\xf1\x76\xcd\x32\xa2\x9d\x02\x10\x96\x80\x64\x3b" \ 
338      "\xf8\xe5\xea\x26\xdf\x9e\x87\x77\x30\x69\x18\xa3" \ 
339      "\xae\x6e\x08\xcd\xff\x5b\x3b\x9e\x54\x3e\x7d\x1d" \ 
340      "\x4e\x8f\xc2\xfd\x3c\x01\x60\x03\x01\xe0\x02\x39" \ 
341      "\xa3\x33\x0e\xa0\x57\x02\x89\x36\x07\x4a\xc5\x58" \ 
342      "\x85\x33\xfc\xcb\x31\x90\x47\x61\x57\x5f\xad\x92" \ 
343      "\x97\x57\x81\x8a\xe8\xd2\x14\xc1\xe1\x81\x9a\xa9" \ 
344      "\xc0\xf0\x58\x42\xf7\x82\x39\x02\x93\x38\xfa\xbc" \ 
345      "\xfe\x91\x10\x96\xc1\xb2\xab\x65\x36\x2c\xc3\xe7" \ 
346      "\x63\xda\xe2\xd7\x57\x81\x68\xa0\x3c\xb2\xb8\x1e" \ 
347      "\x77\x80\xa2\x29\xef\x95\x23\x90\xa0\x15\x16\x3d" \ 
348      "\xa3\xd4\xaf\xad\xf5\xa1\x0f\xa7\x3f\x02\xf9\x21" \ 
349      "\xec\x79\x73\x5d\xcb\x23\x8b\x1b\x71\x69\x6e\xd2" \ 
350      "\x08\x80\xbe\xdd\x56\x24\x08\x09\x61\x60\x3c\x10" \ 
351      "\x79\x22\xf6\xbd\x0e\xad\x65\x79\xc4\xa3\xaa\x11" \ 
352      "\x07\xb0\x20\xa1\x13\x29\x75\xe4\x03\xd5\x5b\x34" \ 
353      "\xc6\xbf\x99\x6c\x6c\x3d\xc0\xbb\x87\x20\x04\xfb" \ 
354      "\xe8\xc0\x9a\x20\x4c\x0c\x2c\x54\x00\xc8\x48\x8b" \ 
355      "\x94\xfa\x9c\xe3\x01\x18\xf1\x4c\x16\xde\xde\xb7" \ 
356      "\xae\x07\x78\xef\x10\x58\x60\x9b\xa3\xb0\x63\x9e" \ 
357      "\x89\x78\x31\x66\x59\x54\x88\xee\x48\x83\x8e\xd0" \ 
358      "\xb4\x15\x71\x9e\xc9\x6a\xeb\x56\xd3\xa5\x29\xf8" \ 
359      "\xee\x7c\x7d\x4f\x9c\xcf\xd6\xc5\xe7\x69\x83\x09" \ 
360      "\x74\xf7\xa4\x2f\x84\x9b\xd0\x7f\x13\xd4\x03\xd0" \ 
361      "\x2d\x42\x7c\x64\xb2\xaa\x2e\x65\xb2\x4f\x27\x63" \ 
362      "\xc6\x1c\xa8\xaf\xf4\xe8\xaf\x69\x48\x66\xa0\xf0" \ 
363      "\x1b\x28\x65\x09\xa5\x84\x50\xca\x42\xa9\x6d\x3d" \ 
364      "\xf5\x37\x9e\xba\xa2\xd7\x85\xa8\xca\x37\x02\xb1" \ 
365      "\xad\xab\xba\x9f\x10\x6a\x52\x2b\x2f\x44\xc6\x57" \ 
366      "\xee\x02\x1b\x32\x65\xc0\x13\xe8\x7a\xe0\xb4\xc3" \ 
367      "\x52\x1e\x8e\x8f\xd4\xfa\xf0\xf2\x8f\x70\xec\x7d" \ 
368      "\xbd\x2e\x84\xae\x20\x42\xc0\xc9\x11\xbd\x16\xa7" \ 
369      "\xe3\xc7\x60\xd9\xab\xec\x77\xaf\xea\xfe\x4c\x24" \ 
370      "\x52\x01\x10\xc0\x04\xe0\xcf\xaf\x48\xfd\x03\x01" \ 
371      "\xb4\x3a\x30\x3d\x05\xa7\x0c\x88\xe9\xeb\x70\x62" \ 
372      "\x48\xcf\x47\xeb\x71\x7e\x22\x06\xe2\xc4\x08\x4c" \ 
373      "\xdf\xa8\xac\x07\x16\xcc\x86\x92\x40\x07\xdf\x44" \ 
374      "\xa4\xb7\xa6\x21\x99\x31\x0d\x89\x2d\x04\x7d\xa9" \ 
375      "\x55\x97\xcb\xd6\x34\xfc\x99\xaf\x1b\x58\x4f\xd0" \ 
376      "\xe6\x34\xdc\x8f\xc9\x86\x30\xf5\xb0\x80\x27\x25" \ 
377      "\x36\xec\x1d\xaa\xd7\x90\x44\x74\x05\xc6\x05\x0c" \ 
378      "\x27\x1d\x87\xee\x94\x6b\x12\xf5\x19\xdb\x31\x74" \ 
379      "\x0a\xdf\x7a\x58\x60\xbe\xe4\x03\x4c\x8c\xae\xd5" \ 
380      "\x92\xc5\x40\x5c\x00\x8e\x24\x5a\x05\x7d\x5b\xba" \ 
381      "\xf4\x91\x3c\x03\x05\x2b\x92\xab\xf7\xf3\x78\x2b" \ 
382      "\x3e\x36\x5c\x1c\x6a\xa6\x29\x8d\x28\x6b\x3c\x81" \ 
383      "\x05\xdd\x9b\xd2\xb8\x91\x37\x42\x9a\xe2\xf3\x4b" \ 
384      "\x05\x72\x4b\x05\xca\xba\x9e\xd4\x58\xde\x14\x00" \ 
385      "\x03\xa2\x5f\xe8\x16\xdd\x71\x5a\x1d\xdc\x8d\x49" \ 
386      "\xdc\x94\x8b\xbd\xc1\xa9\xab\xb4\xfc\xc8\xa3\x50" \ 
387      "\xf4\xc9\x2d\xe5\x91\x52\x07\x9c\x0d\x83\x43\x6b" \ 
388      "\x3c\x4c\xd6\x7d\x9a\x65\x4d\x0f\x27\x63\x4f\x33" \ 
389      "\x21\x04\x4e\xab\x00\x4b\x20\x43\x10\x16\x2c\x97" \ 
390      "\x8a\x10\x56\x6a\xfe\xb2\x49\xb5\x89\xd1\xff\xf3" \ 
391      "\x34\x5b\x4d\x93\xf0\x2a\x7a\xf4\xa2\xbb\xe8\xce" \ 
392      "\xd8\xc5\x52\x79\x9c\x36\xb2\xb8\x21\x80\xe7\x49" \ 
393      "\xff\x01\x29\xbb\x14\x7a\xb6\x7d\x01\xb0\x00\x00" \ 
394      "\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82" 
395 396 397 -class MCDialog(QDialog):
398 ''' 399 Base dialog class for MOCOP project. 400 '''
401 - def __init__(self, parent=None, _prms=None, modal=True, ignoreEsc=False):
402 403 QDialog.__init__(self, parent) 404 self.setObjectName('mcdialog') 405 if _prms is None: 406 _prms = {'_mod': 'NORMAL'} 407 408 self._prms = _prms 409 self.ignoreEsc = ignoreEsc 410 self._widget = None 411 412 self.dlgMainLayout = QVBoxLayout(self) 413 self.dlgMainLayout.setObjectName('dlgMainLayout') 414 415 if self._prms['_mod'] == 'NORMAL': 416 mainLayout = QHBoxLayout(None) 417 mainLayout.setObjectName('mainLayout') 418 419 self.pxmIcon = QLabel(self) 420 self.pxmIcon.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)) 421 self.pxmIcon.setScaledContents(0) 422 mainLayout.addWidget(self.pxmIcon) 423 424 self.lblMain = QLabel(self) 425 self.lblMain.setWordWrap(True) 426 self.lblMain.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)) 427 self.lblMain.setTextFormat(Qt.RichText) 428 self.lblMain.setScaledContents(1) 429 mainLayout.addWidget(self.lblMain) 430 self.dlgMainLayout.addLayout(mainLayout) 431 432 buttonLayout = QHBoxLayout(None) 433 buttonLayout.setObjectName('buttonLayout') 434 spacer4 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) 435 buttonLayout.addItem(spacer4) 436 self.dlgMainLayout.addLayout(buttonLayout) 437 438 if self._prms['_mod'] == 'NORMAL': 439 self.iconInformation = QPixmap() 440 self.iconInformation.loadFromData(imageInformation_data, 'PNG') 441 self.iconWarning = QPixmap() 442 self.iconWarning.loadFromData(imageWarning_data, 'PNG') 443 self.iconCritical = QPixmap() 444 self.iconCritical.loadFromData(imageCritical_data, 'PNG') 445 self.pxmIcon.setPixmap(self.iconWarning) 446 447 self.setMinimumSize(400, 200) 448 self.isBlocking = True
449
450 - def setWarningIcon(self):
451 452 self.pxmIcon.setPixmap(self.iconWarning)
453
454 - def setErrorIcon(self):
455 456 self.pxmIcon.setPixmap(self.iconCritical)
457
458 - def setInformationIcon(self):
459 460 self.pxmIcon.setPixmap(self.iconInformation)
461
462 - def showDialog(self, caption='Dialog', msg='Message', btn1=None, btn2=None, btn3=None, inp=None, focusBtn1=False, noFocus=False, oninput=''):
463 # Default values for parameters 464 if btn1 is None: 465 btn1 = tr('&OK') 466 467 # Sanitize input parameters for encoding 468 caption = tr(caption) 469 msg = tr(msg) 470 btn1 = tr(btn1) 471 btn2 = tr(btn2) 472 btn3 = tr(btn3) 473 474 self.setWindowTitle(caption) 475 self.lblMain.setText(msg) 476 477 self.btn_1 = MCPushButton(self) 478 self.btn_1.setObjectName('btn_1') 479 if noFocus: 480 self.btn_1.setFocusPolicy(Qt.NoFocus) 481 self.findChild(QHBoxLayout, 'buttonLayout').addWidget(self.btn_1) 482 self.btn_1.setText(btn1) 483 484 if self.isBlocking: 485 self.connect(self.btn_1, SIGNAL('clicked()'), self.accept) 486 487 if btn2: 488 self.btn_2 = MCPushButton(self) 489 self.btn_2.setObjectName('btn_2') 490 self.btn_2.setText(btn2) 491 self.findChild(QHBoxLayout, 'buttonLayout').addWidget(self.btn_2) 492 if self.isBlocking: 493 self.connect(self.btn_2, SIGNAL('clicked()'), self.reject) 494 if noFocus: 495 self.btn_2.setFocusPolicy(Qt.NoFocus) 496 else: 497 self.btn_2.setFocus() 498 499 if btn3: 500 self.btn_3 = MCPushButton(self) 501 self.btn_3.setObjectName('btn_3') 502 self.btn_3.setText(btn3) 503 self.findChild(QHBoxLayout, 'buttonLayout').addWidget(self.btn_3) 504 if self.isBlocking: 505 self.connect(self.btn_3, SIGNAL('clicked()'), self.btn3_clicked) 506 if noFocus: 507 self.btn_3.setFocusPolicy(Qt.NoFocus) 508 else: 509 self.btn_3.setFocus() 510 511 if focusBtn1: 512 self.btn_1.setFocus() 513 514 if inp: 515 # An input widget is requested 516 self.inp = MCLineEdit(self) 517 self.inp.setObjectName('inp') 518 self.findChild(QVBoxLayout, 'dlgMainLayout').insertWidget(1, self.inp) 519 if self.isBlocking: 520 self.connect(self.inp, SIGNAL('enterPressed()'), self.inp_enterPressed) 521 522 self.inp.setFocus() 523 524 if self.isBlocking: 525 526 retval = self.exec_() 527 528 if retval and hasattr(self, 'inp'): 529 retval = self.inp.get() 530 531 return retval
532
533 - def btn3_clicked(self):
534 535 self.done(-1)
536
537 - def reject(self):
538 ''' 539 Overriden reject method. 540 ''' 541 if not self.ignoreEsc: 542 QDialog.reject(self) 543 self._deferer_.callback(0)
544
545 - def closeEvent(self, event):
546 547 if self.ignoreEsc: 548 event.ignore() 549 else: 550 QDialog.closeEvent(self, event)
551 552 @staticmethod
553 - def deleteDialogOnSuccess(result, dialog):
554 dialog.setParent(None) 555 return result
556 557 @staticmethod
558 - def deleteDialogOnFailure(failure, dialog):
559 dialog.setParent(None) 560 raise failure
561 562 @staticmethod
563 - def showMessage(parent, *args, **kwargs):
564 ''' 565 Displays the desired dialog box as modal. 566 567 @param autoClose: If True, automatically closes the dialog 568 after 10 seconds. 569 ''' 570 w = MCDialog(parent) 571 572 deferer = defer.Deferred() 573 deferer.addCallback(MCDialog.deleteDialogOnSuccess, w) 574 deferer.addErrback(MCDialog.deleteDialogOnFailure, w) 575 w._deferer_ = deferer 576 577 if kwargs.has_key('informationIcon'): 578 w.setInformationIcon() 579 del kwargs['informationIcon'] 580 581 if kwargs.has_key('warningIcon'): 582 w.setWarningIcon() 583 del kwargs['warningIcon'] 584 585 if kwargs.has_key('errorIcon'): 586 w.setErrorIcon() 587 del kwargs['errorIcon'] 588 589 # Automatically closing dialog? 590 autoClose = False 591 if kwargs.has_key('autoClose'): 592 if kwargs['autoClose']: 593 autoClose = True 594 del kwargs['autoClose'] 595 596 w.isBlocking = False 597 w.showDialog(*args, **kwargs) 598 w.connect(w.btn_1, SIGNAL('clicked()'), w.btn1_clicked) 599 600 if autoClose: 601 w.closeTimer = QTimer(w) 602 w.connect(w.closeTimer, SIGNAL('timeout()'), w.autoCloseControl) 603 w.orgBtn1Text = unicode(w.btn_1.text()) 604 w.counter = 10 605 w.autoCloseControl() 606 607 if hasattr(w, 'btn_2'): 608 w.connect(w.btn_2, SIGNAL('clicked()'), w.btn2_clicked) 609 if hasattr(w, 'btn_3'): 610 w.connect(w.btn_3, SIGNAL('clicked()'), w.btn3_clicked) 611 if hasattr(w, 'inp'): 612 w.connect(w.inp, SIGNAL('enterPressed()'), w.inp_enterPressed) 613 614 w.setModal(True) 615 w.show() 616 617 return deferer
618
619 - def autoCloseControl(self):
620 ''' 621 If dialog is in autoClose mode, this methods does the periodic 622 controls. 623 ''' 624 if self.counter >= 0: 625 # We have time remaining, restart timer. 626 self.closeTimer.start(1000) 627 else: 628 # Time is up, simulate button click and return 629 self.btn1_clicked() 630 return 631 self.btn_1.setText(" %s [%d] " % (self.orgBtn1Text, self.counter)) 632 self.counter -= 1
633
634 - def btn1_clicked(self):
635 ''' 636 Method to be called when button 1 is pressed. 637 ''' 638 if hasattr(self, 'inp'): 639 self._deferer_.callback(self.inp.get()) 640 641 else: 642 self._deferer_.callback(1)
643
644 - def btn2_clicked(self):
645 ''' 646 Method to be called when button 2 is pressed. 647 ''' 648 self._deferer_.callback(0)
649
650 - def btn3_clicked(self):
651 ''' 652 Method to be called when button 3 is pressed. 653 ''' 654 self._deferer_.callback(-1)
655
656 - def inp_enterPressed(self):
657 ''' 658 Method to be called when dialog has an input (line edit) 659 widget. Fires the deferer with the input's content 660 ''' 661 self._deferer_.callback(self.inp.get())
662