This repository has been archived by the owner on Jul 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
task_changepointcount.py
46 lines (38 loc) · 1.64 KB
/
task_changepointcount.py
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
from PyQt4 import QtCore, QtGui
from data import Data
from task import Task
class ChangePointCountTask(Task):
def __init__(self, pointCount, mainWindow, parent = None):
"""
"""
super(ChangePointCountTask, self).__init__(mainWindow, parent)
self.pointCount = pointCount
# Set the maxPoints _now_, otherwise two threads are started.
self.mainWindow.data.maxPoints = self.pointCount
def run(self):
"""
The code in this method is run in another thread.
"""
# Save fulllightvoltage pointer and fit absorbance pointer
# time, to be recovered after loading.
fullLightVoltageTimes = self.mainWindow.data.fullLightVoltageTimes()
fitTimes = self.mainWindow.data.fitTimes()
self.messageAdded.emit("Copying {0} points from loaded data...".format(self.mainWindow.data.maxPoints))
self.mainWindow.data.copyFromOriginalData()
# Recover fulllightvoltage pointer and fit absorbance pointer times
self.mainWindow.data.setFullLightVoltageTimes(fullLightVoltageTimes, False)
self.mainWindow.data.setFitTimes(fitTimes, False)
self.messageAdded.emit("Computing values...")
self.mainWindow.data.recalculateValues()
def postRun(self):
"""
The code in this method is run in GUI thread.
"""
self.mainWindow.scene.updateFromData()
def postTerminated(self):
"""
The code in this method is run in GUI thread.
"""
self.mainWindow.data.clear()
self.mainWindow.setLoadedFilePath("")
self.mainWindow.settings.onDataLoaded(self.mainWindow.data)