Пример #1
0
 def open(self, s):
     """ Loads the contents of the model from s """
     try:
         self.reset()
         data = eval(s)
         # load config from mdl, make sure all settings are included (i.e.
         # support older mdls).
         if 'config' in data:
             cfg = {}
             cfg.update(preferencesModel.DEFAULTS)
             cfg.update(data['config'])
             data['config'] = cfg
         data['mWeights'] = [GeoDaSpace_W_Obj.from_path(
             w) for w in data['mWeights']]
         for w in data['mWeights']:
             w.w.transform = 'R'
         data['kWeights'] = [GeoDaSpace_W_Obj.from_path(
             w) for w in data['kWeights']]
         self.data = data
         if not os.path.exists(self.data['fname']):
             return False
         self.loadFieldNames()
         self.update()
         self.state = self.STATE_SAVED
         return True
     except:
         raise
Пример #2
0
 def open(self, s):
     """ Loads the contents of the model from s """
     try:
         self.reset()
         data = eval(s)
         # load config from mdl, make sure all settings are included (i.e.
         # support older mdls).
         if 'config' in data:
             cfg = {}
             cfg.update(preferencesModel.DEFAULTS)
             cfg.update(data['config'])
             data['config'] = cfg
         data['mWeights'] = [
             GeoDaSpace_W_Obj.from_path(w) for w in data['mWeights']
         ]
         for w in data['mWeights']:
             w.w.transform = 'R'
         data['kWeights'] = [
             GeoDaSpace_W_Obj.from_path(w) for w in data['kWeights']
         ]
         self.data = data
         if not os.path.exists(self.data['fname']):
             return False
         self.loadFieldNames()
         self.update()
         self.state = self.STATE_SAVED
         return True
     except:
         raise
Пример #3
0
 def addKWeightsFile(self, path=None, obj=None):
     if obj:
         obj = GeoDaSpace_W_Obj(obj)
         if obj not in self.data['kWeights']:
             self.data['kWeights'].append(obj)
             self.update()
     elif path:
         obj = GeoDaSpace_W_Obj.from_path(path)
         if obj not in self.data['kWeights']:
             self.data['kWeights'].append(obj)
             self.update()
     else:
         pass
Пример #4
0
 def addMWeightsFile(self, path=None, obj=None):
     if obj:
         obj = GeoDaSpace_W_Obj(obj)
         obj.w.transform = 'r'
         if obj not in self.data['mWeights']:
             self.data['mWeights'].append(obj)
             self.update()
     elif path:
         obj = GeoDaSpace_W_Obj.from_path(path)
         obj.w.transform = 'r'
         if obj not in self.data['mWeights']:
             self.data['mWeights'].append(obj)
             self.update()
     else:
         pass
Пример #5
0
 def addKWeightsFile(self, path=None, obj=None):
     if obj:
         obj = GeoDaSpace_W_Obj(obj)
         if obj not in self.data['kWeights']:
             self.data['kWeights'].append(obj)
             self.update()
     elif path:
         obj = GeoDaSpace_W_Obj.from_path(path)
         if obj not in self.data['kWeights']:
             self.data['kWeights'].append(obj)
             self.update()
     else:
         pass
Пример #6
0
 def addMWeightsFile(self, path=None, obj=None):
     if obj:
         obj = GeoDaSpace_W_Obj(obj)
         obj.w.transform = 'r'
         if obj not in self.data['mWeights']:
             self.data['mWeights'].append(obj)
             self.update()
     elif path:
         obj = GeoDaSpace_W_Obj.from_path(path)
         obj.w.transform = 'r'
         if obj not in self.data['mWeights']:
             self.data['mWeights'].append(obj)
             self.update()
     else:
         pass