def save(cls, port):
        """
        This method save the port in user space.

        Returns:

            * **Types** (:class:`boolean<boolean>`)
        """
        from harpia.system import System
        port.source = "xml"
        parser = XMLParser()
        parser.addTag('HarpiaPort')

        parser.setTagAttr('HarpiaPort','type', port.type)
        parser.setTagAttr('HarpiaPort','language', port.language)
        parser.setTagAttr('HarpiaPort','label', port.label)
        parser.setTagAttr('HarpiaPort','color', port.color)
        parser.setTagAttr('HarpiaPort','multiple', port.multiple)
        parser.setTagAttr('HarpiaPort','source', port.source)
        parser.appendToTag('HarpiaPort','code').string = str(port.code)

        count = 0
        for code in port.input_codes:
            parser.appendToTag('HarpiaPort', 'input_code' + \
                        str(count)).string = str(port.input_codes[count])
            parser.appendToTag('HarpiaPort', 'output_code' + \
                        str(count)).string = str(port.output_codes[count])
            count = count + 1


        try:
            data_dir = System.get_user_dir() + "/extensions/"
            data_dir = data_dir + port.language + "/ports/"
            if not os.path.isdir(data_dir):
                try:
                    os.makedirs(data_dir)
                except:
                    pass
            file_name = data_dir + port.type + ".xml"
            port_file = file(os.path.expanduser(file_name), 'w')
            port_file.write(parser.prettify())
            port_file.close()
        except IOError as e:
            return False
        return True
    def save(cls, code_template):
        """
        This method save the code_template in user space.

        Returns:

            * **Types** (:class:`boolean<boolean>`)
        """
        from harpia.system import System
        code_template.source = "xml"
        parser = XMLParser()
        parser.addTag('HarpiaCodeTemplate')
        parser.setTagAttr('HarpiaCodeTemplate','name', code_template.name)
        parser.setTagAttr('HarpiaCodeTemplate','type', code_template.type)
        parser.setTagAttr('HarpiaCodeTemplate','description', code_template.description)
        parser.setTagAttr('HarpiaCodeTemplate','language', code_template.language)
        parser.setTagAttr('HarpiaCodeTemplate','extension', code_template.extension)
        parser.setTagAttr('HarpiaCodeTemplate','source', code_template.source)
        parser.appendToTag('HarpiaCodeTemplate','command').string = str(code_template.command)
        parser.appendToTag('HarpiaCodeTemplate','code').string = str(code_template.code)

        try:
            data_dir = System.get_user_dir() + "/extensions/"
            data_dir = data_dir + code_template.language + "/"
            if not os.path.isdir(data_dir):
                try:
                    os.makedirs(data_dir)
                except:
                    pass
            file_name = data_dir + code_template.type + ".xml"
            code_template_file = file(os.path.expanduser(file_name), 'w')
            code_template_file.write(parser.prettify())
            code_template_file.close()
        except IOError as e:
            return False
        return True
    def save(cls, prefs):
        """
        This method save the diagram.

        Returns:

            * **Types** (:class:`boolean<boolean>`)
        """
        parser = XMLParser()
        parser.addTag('HarpiaProperties')
        parser.setTagAttr('HarpiaProperties','default_directory',
                prefs.default_directory)
        parser.setTagAttr('HarpiaProperties','default_filename',
                prefs.default_filename)
        parser.setTagAttr('HarpiaProperties','grid', prefs.grid)
        parser.setTagAttr('HarpiaProperties','width', prefs.width)
        parser.setTagAttr('HarpiaProperties','height', prefs.height)
        parser.setTagAttr('HarpiaProperties','hpaned_work_area',
                prefs.hpaned_work_area)
        parser.setTagAttr('HarpiaProperties','vpaned_bottom',
                prefs.vpaned_bottom)
        parser.setTagAttr('HarpiaProperties','vpaned_left',
                prefs.vpaned_left)

        parser.appendToTag('HarpiaProperties', 'recent_files')
        for key in prefs.recent_files:
            parser.appendToTag('recent_files', 'name', value=key)

        try:
            from harpia.system import System
            file_name = System.get_user_dir() + "/" + prefs.conf_file_path
            confFile = file(os.path.expanduser(file_name), 'w')
            confFile.write(parser.prettify())
            confFile.close()
        except IOError as e:
            return False
        return True