Changeset 73b1c72 in sasview for DataLoader
- Timestamp:
- Jul 3, 2008 10:32:59 AM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 14226f4
- Parents:
- 87bff18
- Location:
- DataLoader
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/loader.py
r87bff18 r73b1c72 9 9 import logging 10 10 import os.path 11 12 11 13 def _findReaders(dir): 12 14 # List of plugin objects … … 86 88 self.readers = {} 87 89 self.reading=None 90 self.dir='plugins' 91 self.__setitem__() 88 92 89 93 def set_pluginDir (self,path): 94 """ specify the name of folder containing pluging""" 95 if not os.path.isdir(path): 96 os.mkdir(path) 97 self.dir=path 90 98 def __setitem__(self, ext=None, reader=None): 91 99 if reader==None: 92 100 plugReader=None 93 if os.path.isdir( 'plugins'):94 plugReader=_findReaders( 'plugins')# import all module in plugins95 elif os.path.isdir('../ plugins'):96 plugReader=_findReaders('../ plugins')101 if os.path.isdir(self.dir): 102 plugReader=_findReaders(self.dir)# import all module in plugins 103 elif os.path.isdir('../'+self.dir): 104 plugReader=_findReaders('../'+self.dir) 97 105 if plugReader !=None: 98 106 for preader in plugReader:# for each modules takes list of extensions … … 135 143 def lookup(self, path): 136 144 """ 137 Return the loader associated with the file type of path.145 Return the reader associated with the file type of path. 138 146 """ 139 147 file = os.path.basename(path) … … 148 156 149 157 def getAcTReader(self,path): 158 """ return Reader actually reading""" 150 159 return self.reading 151 160 … … 171 180 if __name__=="__main__": 172 181 l=Loader() 173 l.__setitem__()174 182 print "look up",l.lookup('angles_flat.png') 175 183 print l.__getitem__('.tiff') 184 print l.__getitem__('jpeg') 176 185 print l.__contains__('.tiff') 177 186 -
DataLoader/readers/tiff_reader.py
rbb03739 r73b1c72 43 43 type = [] 44 44 ## Extension 45 ext = ['tif', 'jpg', ' png', 'jpeg', 'tiff', 'gif', 'bmp']45 ext = ['tif', 'jpg', '.png', 'jpeg', '.tiff', 'gif', 'bmp'] 46 46 47 47 def read(self, filename=None): -
DataLoader/test/testLoad.py
r96510c8 r73b1c72 101 101 """ test loading with plugging""" 102 102 l=Loader() 103 l.__setitem__()104 103 self.assertEqual(l.__contains__('.tiff'),True) 105 104 self.assertEqual(l.__contains__('.png'),True)
Note: See TracChangeset
for help on using the changeset viewer.