/usr/share/pyshared/PyMca/PyMcaPlugins/CalculationThread.py is in pymca 4.5.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | import sys
import time
try:
from PyMca import PyMcaQt as qt
except ImportError:
import PyMcaQt as qt
class CalculationThread(qt.QThread):
def __init__(self, parent=None, calculation_method=None):
qt.QThread.__init__(self, parent)
self.calculation_method = calculation_method
def run(self):
try:
self.result = self.calculation_method()
except:
self.result = ("Exception",) + sys.exc_info()
def waitingMessageDialog(thread, message=None, parent=None):
try:
if message is None:
message = "Please wait. Calculation going on."
msg = qt.QDialog(parent)#, qt.Qt.FramelessWindowHint)
msg.setModal(1)
msg.setWindowTitle("Please Wait")
layout = qt.QHBoxLayout(msg)
layout.setMargin(0)
layout.setSpacing(0)
l1 = qt.QLabel(msg)
l1.setFixedWidth(l1.fontMetrics().width('##'))
l2 = qt.QLabel(msg)
l2.setText("%s" % message)
l3 = qt.QLabel(msg)
l3.setFixedWidth(l3.fontMetrics().width('##'))
layout.addWidget(l1)
layout.addWidget(l2)
layout.addWidget(l3)
msg.show()
qt.qApp.processEvents()
t0 = time.time()
i = 0
ticks = ['-','\\', "|", "/","-","\\",'|','/']
while (thread.isRunning()):
i = (i+1) % 8
l1.setText(ticks[i])
l3.setText(" "+ticks[i])
qt.qApp.processEvents()
time.sleep(2)
finally:
msg.close()
|