Example #1
0
 def __format(self):
     root = XMLGroup('medit-session')
     for d in self.__docs:
         root.add_child(XMLItem('doc', d))
     if self.__active is not None:
         root.add_child(XMLItem('active', str(self.__active)))
     if self.__file_selector_dir is not None:
         root.add_child(XMLItem('file-selector', self.__file_selector_dir))
     return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n' + \
             root.get_string()
Example #2
0
 def __format(self):
     root = XMLGroup('medit-session')
     for d in self.__docs:
         root.add_child(XMLItem('doc', d))
     if self.__active is not None:
         root.add_child(XMLItem('active', str(self.__active)))
     if self.__file_selector_dir is not None:
         root.add_child(XMLItem('file-selector', self.__file_selector_dir))
     return '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n' + \
             root.get_string()
Example #3
0
 def save(self):
     if not self.is_default():
         value = self.get_value()
         items = [
             XMLItem('working_dir', value[0]),
             XMLItem('cmd', value[1])
         ]
         return [XMLGroup(self.get_id(), items)]
     else:
         return []
Example #4
0
    def save(self):
        children = []
        attrs = getattr(type(self), '__items__')

        for setting in self:
            children += setting.save()

        if not children:
            return []

        return [XMLGroup(self.get_id(), children)]
Example #5
0
        def save(self):
            nodes = []
            for key in self:
                if self.__xml_elm_name is not None:
                    nodes += _save_instance(self.__xml_elm_name, self.__xml_attr_name, key, self[key])
                else:
                    nodes += _save_instance(None, None, key, self[key])
            if nodes:
		nodes.sort(self.cmp_nodes)
                return [XMLGroup(self.get_id(), nodes, sort=False)]
            else:
                return []
Example #6
0
 def get_xml(self):
     xml = Group.save(self)
     if xml:
         xml = xml[0]
     else:
         xml = XMLGroup('medit-project')
     xml.set_attr('name', self.name)
     xml.set_attr('type', self.type)
     xml.set_attr('version', self.version)
     return xml