File: loading.py

package info (click to toggle)
abinit 9.10.4-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 518,712 kB
  • sloc: xml: 877,568; f90: 577,240; python: 80,760; perl: 7,019; ansic: 4,585; sh: 1,925; javascript: 601; fortran: 557; cpp: 454; objc: 323; makefile: 77; csh: 42; pascal: 31
file content (72 lines) | stat: -rwxr-xr-x 1,786 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Abinit Post Process Application
author: Martin Alexandre
last edited: May 2013
"""

import os, sys, time
import string, math, re

try:
    from PyQt4 import Qt,QtGui,QtCore
except:
    pass


class loading(QtGui.QWidget):

#-----------------------------#
#-------CONSTRUCTOR-----------#
#-----------------------------#

    def __init__(self, parent = None, message = "please wait"):
            self.message = message
            self.initUI(parent)           
            self.raise_()
            
    def initUI(self, parent):

	#-----------------Creation of the windows----------------------------#
        QtGui.QWidget.__init__(self, parent)
        self.setWindowTitle('Please wait')
        self.setFixedSize(160, 60)
        self.center()

        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.lblload = QtGui.QLabel(self.message)
        
        self.progressbar = QtGui.QProgressBar(self)
        self.progressbar.setMinimum(0)
        self.progressbar.setMaximum(0)
        self.progressbar.setFixedSize(140,20)

        self.layout.addWidget(self.lblload    , 1, 0, 1, 1, QtCore.Qt.AlignCenter)
        self.layout.addWidget(self.progressbar, 2, 0, 1, 1, QtCore.Qt.AlignCenter)
        
        self.show()

    def cancel(self):
        self.thread.stop()
        return

    def update(self,pmessage):
        self.lblload.setText(pmessage)
        self.raise_()

    def center(self):
        screen = QtGui.QDesktopWidget().screenGeometry()
        size =  self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)

    def __del__(self):
        pass;
 

    def closeEvent(self, event):
        self.raise_()
        event.ignore()