source: sasview/src/sas/qtgui/Utilities/GenericReader.py @ e7a0b2f

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since e7a0b2f was e7a0b2f, checked in by Adam Washington <adam.washington@…>, 6 years ago

Line Endings in QtGui?

  • Property mode set to 100755
File size: 1.2 KB
RevLine 
[e7a0b2f]1"""
2Thread handler used to load data
3"""
4import time
5from sas.sascalc.data_util.calcthread import CalcThread
6
7class GenReader(CalcThread):
8    """
9    Load a sld data given a filename
10    """
11    def __init__(self, path, loader,
12                 completefn=None,
13                 updatefn=None,
14                 yieldtime=0.01,
15                 worktime=0.01
16                 ):
17        CalcThread.__init__(self, completefn,
18                 updatefn,
19                 yieldtime,
20                 worktime)
21        self.path = path
22        #Instantiate a loader
23        self.loader = loader
24        self.starttime = 0
25
26    def isquit(self):
27        """
28        @raise KeyboardInterrupt: when the thread is interrupted
29        """
30        try:
31            CalcThread.isquit(self)
32        except KeyboardInterrupt:
33            raise KeyboardInterrupt
34
35
36    def compute(self):
37        """
38        Read some data
39        """
40        self.starttime = time.time()
41        try:
42            data = self.loader.read(self.path)
43            self.complete(data=data)
44        except:
45            # Thread was interrupted, just proceed and re-raise.
46            # Real code should not print, but this is an example...
47            raise
48
Note: See TracBrowser for help on using the repository browser.