Пример #1
0
 def __init(self):
     # Get the schema
     schema = self.config_definition
     
     # Generate the model from the schema
     model_factory = model.Model.__model_from_definition__(schema)
     
     # Create an instance so we can use it here
     self.__options = model_factory()
     
     # Load the configurations from the file
     conf_file = '%s.conf' % self.NAME
     path = os.path.join(self.boss.pida_home, 'conf', conf_file)
     persistency.load_model_from_ini(path, self.__options)
     
     # Observe the file for changes
     self.__options_observer = persistency.IniFileObserver()
     self.__options_observer.add_model(self.__options)
     
     # Add callbacks to self
     self.__options_callbacks = model.CallbackObserver(self)
     self.__options_callbacks.set_model(self.__options)
     
     # Add a mapper for syntatic sugar
     self.options = OptionsMapper(self.opts)
Пример #2
0
 def __init(self):
     print self.NAME
     self.__options = model.Model.__model_from_definition__(
         self.config_definition)()
     path = os.path.join(self.boss.pida_home, 'conf', '%s.conf' % self.NAME)
     persistency.load_model_from_ini(path, self.__options)
     self.__options.__model_ini_filename__
     self.__options_observer = persistency.IniFileObserver()
     self.__options_callbacks = model.CallbackObserver(self)
     self.__options_callbacks.set_model(self.__options)
     self.__options_observer.add_model(self.__options)
Пример #3
0
 def __read_history(self):
     f = open(self.__history_file, 'r')
     hist = set()
     for filename in f:
         filename = filename.strip()
         if os.path.exists(filename):
             hist.add(filename)
     f.close()
     for filename in hist:
         p = project.Project()
         persistency.load_model_from_ini(filename, p)
         p.__model_ini_filename__ = filename
         self.proj_group.add_model(p)
     self.__write_history()
Пример #4
0
 def __read_history(self):
     f = open(self.__history_file, 'r')
     hist = set()
     for filename in f:
         filename = filename.strip()
         if os.path.exists(filename):
             hist.add(filename)
     f.close()
     for filename in hist:
         p = project.Project()
         persistency.load_model_from_ini(filename, p)
         p.__model_ini_filename__ = filename
         self.proj_group.add_model(p)
     self.__write_history()
Пример #5
0
 def cmd_add_project(self, project_file):
     p = project.Project()
     m = persistency.load_model_from_ini(project_file, p)
     m.__model_ini_filename__ = project_file
     self.proj_group.add_model(m)
     self.__write_history()
Пример #6
0
 def cmd_add_project(self, project_file):
     p = project.Project()
     m = persistency.load_model_from_ini(project_file, p)
     m.__model_ini_filename__ = project_file
     self.proj_group.add_model(m)
     self.__write_history()