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 cbe6dbe was
bb03739,
checked in by Gervaise Alina <gervyh@…>, 16 years ago
|
unit test added.still working on it
|
-
Property mode set to
100644
|
File size:
1001 bytes
|
Line | |
---|
1 | from register import ExtensionRegistry |
---|
2 | |
---|
3 | #import tiff_reader |
---|
4 | class Loader: |
---|
5 | def __init__(self): |
---|
6 | """ init method""" |
---|
7 | self.reg=ExtensionRegistry() |
---|
8 | |
---|
9 | def setFormat(self,ext,reader): |
---|
10 | """ |
---|
11 | Load the available reader with file extensions |
---|
12 | @param ext:file extension |
---|
13 | @param reader: instance of a reader |
---|
14 | """ |
---|
15 | #self.reg[ext]=reader |
---|
16 | self.reg.__setitem__(ext, reader) |
---|
17 | def getReader(self,ext): |
---|
18 | return self.reg.__getitem__( ext) |
---|
19 | |
---|
20 | |
---|
21 | def loadData(self,path,format=None): |
---|
22 | """ Read a file and save values""" |
---|
23 | self.reg.lookup(path) |
---|
24 | try: |
---|
25 | return self.reg.load(path,format) |
---|
26 | except ValueError,msg: |
---|
27 | print msg |
---|
28 | def getActiveReader(self,path): |
---|
29 | return self.reg.getAcTReader(path) |
---|
30 | def getextension(self,name=False,ext=True): |
---|
31 | """ return list of readers""" |
---|
32 | return self.reg.formats(name,ext) |
---|
Note: See
TracBrowser
for help on using the repository browser.