source: sasview/guiframe/load_thread.py @ 901142f

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 901142f was e59da79, checked in by Gervaise Alina <gervyh@…>, 15 years ago

remove usused print

  • Property mode set to 100644
File size: 1.5 KB
Line 
1
2import time
3import sys
4
5from data_util.calcthread import CalcThread
6from DataLoader.loader import Loader
7       
8
9class DataReader(CalcThread):
10    """
11            Load a data given a filename
12    """
13    def __init__(self, path, err_fct, msg_fct, parent=None,
14                 completefn=None,
15                 updatefn   = None,
16                 yieldtime  = 0.01,
17                 worktime   = 0.01
18                 ):
19        CalcThread.__init__(self, completefn,
20                 updatefn,
21                 yieldtime,
22                 worktime)
23        self.path = path
24        self.parent = parent
25        self.err_fct = err_fct
26        self.msg_fct = msg_fct
27        #Instantiate a loader
28        self.loader = Loader()
29        self.starttime = 0 
30       
31    def isquit(self):
32        """
33             @raise KeyboardInterrupt: when the thread is interrupted
34        """
35        try:
36            CalcThread.isquit(self)
37        except KeyboardInterrupt:
38            raise KeyboardInterrupt   
39       
40       
41    def compute(self):
42        """
43            read some data
44        """
45        self.starttime = time.time()
46        try:
47            output =  self.loader.load(self.path)
48            elapsed = time.time() - self.starttime
49            self.complete(output=output, parent=self.parent, path=self.path)
50        except RuntimeError:
51            self.err_fct()
52            self.msg_fct(parent=self.parent)
53            return
54        except:
55            self.msg_fct(parent=self.parent)
56           
57   
58     
Note: See TracBrowser for help on using the repository browser.