Debian Codegraph @

cclib/progress/qt4progress.py

raw
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (c) 2017, the cclib development team
4 #
5 # This file is part of cclib (http://cclib.github.io) and is distributed under
6 # the terms of the BSD 3-Clause License.
7
8 from PyQt4 import QtGui, QtCore
9
10
11 class Qt4Progress(QtGui.QProgressDialog):
12
13 def __init__(self, title, parent=None):
14
15 QtGui.QProgressDialog.__init__(self, parent)
16
17 self.nstep = 0
18 self.text = None
19 self.oldprogress = 0
20 self.progress = 0
21 self.calls = 0
22 self.loop=QtCore.QEventLoop(self)
23 self.setWindowTitle(title)
24
25 def initialize(self, nstep, text=None):
26
27 self.nstep = nstep
28 self.text = text
29 self.setRange(0,nstep)
30 if text:
31 self.setLabelText(text)
32 self.setValue(1)
33 #sys.stdout.write("\n")
34
35 def update(self, step, text=None):
36
37 if text:
38 self.setLabelText(text)
39 self.setValue(step)
40 self.loop.processEvents(QtCore.QEventLoop.ExcludeUserInputEvents)
41