Beispiel #1
0
    def _save(self, file_name):
        '''
        Save settings into the given file
        @param file_name: path of file. Format is XML. 
        @param ide_ui: wxPython ctrl of ide
        @param param_obj: object holding parameters
        '''

        self._file_name = file_name

        ide_ui = self._ide_ui  #@UnusedVariable
        param_obj = self._param_obj  #@UnusedVariable

        etree = ElementTree(file=file_name)
        root_element = etree.getroot()

        attrib_finder = XmlAttribFinder(root_element)

        for xml_attrib_name, rel_obj_str in self._param_list:
            # In eval we need ide_ui and param_obj
            param = ParameterAccess(eval(rel_obj_str))
            attrib, attrib_key = attrib_finder.get_obj(xml_attrib_name)
            attrib[attrib_key] = param.get_related_object_value()

        # Write XML-File
        etree.write(file_name)

        self._changed = False
Beispiel #2
0
    def test_find(self):
        '''Test get_val methode with project template'''
        af_obj = XmlAttribFinder(self._root_el_prj_file)

        header_path = af_obj.get_val('gccXmlSettings.headerPath')
        self.assertEqual(header_path, "")

        inc_path_list = af_obj.get_val('gccXmlSettings.includePathList')
        self.assertEqual(eval(inc_path_list), [])

        inc_path_list_obj = af_obj.get_obj('gccXmlSettings.includePathList')

        self.assertTrue(inc_path_list_obj[1], [])

        self.assertRaises(AttribNotFound, af_obj.get_val,
                          ('gccXmlSettings.xxx'))
    def test_find(self):
        '''Test get_val methode with project template'''
        af_obj = XmlAttribFinder(self._root_el_prj_file)
        
        header_path = af_obj.get_val('gccXmlSettings.headerPath')
        self.assertEqual(header_path, "")
        
        inc_path_list = af_obj.get_val('gccXmlSettings.includePathList')
        self.assertEqual(eval(inc_path_list), [])
        
        inc_path_list_obj = af_obj.get_obj('gccXmlSettings.includePathList')

        self.assertTrue(inc_path_list_obj[1], [])
        
        self.assertRaises(AttribNotFound, af_obj.get_val, 
                          ('gccXmlSettings.xxx'))
Beispiel #4
0
    def _load(self, file_name):  #@UnusedVariable
        '''
        Load settings from given file
        @param file_name: path of file. Format is XML.
        @param ide_ui: wxPython ctrl of ide 
        @param param_obj: object holding parameters
        '''
        self._file_name = file_name

        ide_ui = self._ide_ui  #@UnusedVariable
        param_obj = self._param_obj  #@UnusedVariable

        root_element = ElementTree(file=file_name).getroot()
        attrib_finder = XmlAttribFinder(root_element)

        # Loop through our parameter list
        for xml_attrib_name, rel_obj_str in self._param_list:
            # In eval we need ide_ui and param_obj
            # print "XML:%s obj_str:%s" % (xml_attrib_name, rel_obj_str)
            param = ParameterAccess(eval(rel_obj_str))
            attrib_val = attrib_finder.get_val(xml_attrib_name)
            param.update_related_object(attrib_val)
    def _load(self, file_name):#@UnusedVariable
        '''
        Load settings from given file
        @param file_name: path of file. Format is XML.
        @param ide_ui: wxPython ctrl of ide 
        @param param_obj: object holding parameters
        '''
        self._file_name = file_name

        ide_ui = self._ide_ui #@UnusedVariable
        param_obj = self._param_obj #@UnusedVariable

        root_element = ElementTree(file=file_name).getroot()
        attrib_finder = XmlAttribFinder(root_element)
        
        # Loop through our parameter list
        for xml_attrib_name, rel_obj_str in self._param_list:
            # In eval we need ide_ui and param_obj
            # print "XML:%s obj_str:%s" % (xml_attrib_name, rel_obj_str)
            param = ParameterAccess(eval(rel_obj_str))
            attrib_val = attrib_finder.get_val(xml_attrib_name)
            param.update_related_object(attrib_val)
    def _save(self, file_name):
        '''
        Save settings into the given file
        @param file_name: path of file. Format is XML. 
        @param ide_ui: wxPython ctrl of ide
        @param param_obj: object holding parameters
        '''
        
        self._file_name = file_name

        ide_ui = self._ide_ui #@UnusedVariable
        param_obj = self._param_obj #@UnusedVariable
                
        etree = ElementTree(file=file_name)
        root_element = etree.getroot()
        
        attrib_finder = XmlAttribFinder(root_element)
        
        for xml_attrib_name, rel_obj_str in self._param_list:
            # In eval we need ide_ui and param_obj
            param = ParameterAccess(eval(rel_obj_str))
            attrib, attrib_key = attrib_finder.get_obj(xml_attrib_name)
            attrib[attrib_key] = param.get_related_object_value()
            
        # Write XML-File
        etree.write(file_name)
        
        self._changed = False