Пример #1
0
 def _to_xml(self, with_idx=False):
     """Return a xmlutils.Element('OrbsRestrictions')."""
     if with_idx:
         el = xmlutils.Element('OrbsRestrictions', {'_idx': self._idx_},
                               '\n\t', '\n')
     else:
         el = xmlutils.Element('OrbsRestrictions', {'_idx': None}, '\n\t',
                               '\n')
     el.append('name', {}, self._name, '\n\t')
     el.append('comment', {}, self._comment, '\n\t')
     el2 = xmlutils.Element('Planets', {}, '\n\t', '\n')
     for x, y in self.items():
         el2.append('Planet', {'name': x, 'value': y}, '', '\n\t\t')
     el.append(el2)
     return el
Пример #2
0
def xml_export_orbs_restrictions():
    """Return a xmlutils.Element('AllOrbsRestrictions')."""
    all = all_orbs_restrictions()
    el = xmlutils.Element('AllOrbsRestrictions', {}, '\n', '\n')
    for a in all:
        el.append(a._to_xml())
    return el
Пример #3
0
    def _to_xml(self, with_idx=False):
        """Return a xmlutils.Element('OrbsFilter').
		
		:type with_idx: bool
		:rtype: xmlutils.Element
		"""
        if with_idx:
            el = xmlutils.Element('OrbsFilter', {'_idx': self._idx_}, '\n\t',
                                  '\n')
        else:
            el = xmlutils.Element('OrbsFilter', {'_idx': None}, '\n\t', '\n')
        el.append('name', {}, self._name, '\n\t')
        el.append('comment', {}, self._comment, '\n\t')
        el2 = xmlutils.Element('Aspects', {}, '\n\t\t', '\n')
        for x, y in self.items():
            el2.append('Aspect', {'name': x, 'value': y}, '', '\n\t\t')
        el.append(el2)
        return el
Пример #4
0
    def _to_xml(self, with_idx=False):
        """Return aspects as xmlutils.Element('Aspect').
		
		:rtype: xmlutils.Element
		"""
        if with_idx:
            el = xmlutils.Element('Aspect', {'_idx': self._idx_}, '\n\t', '\n')
        else:
            el = xmlutils.Element('Aspect', {'_idx': None}, '\n\t', '\n')
        el.append('name', {}, self._name, '\n\t')
        el.append('angle', {}, self._angle, '\n\t')
        el.append('ranking', {}, self._ranking, '\n\t')
        el.append('bool_use', {}, self._bool_use, '\n\t')
        el.append('default_orb', {}, self._default_orb, '\n\t')
        el.append('color', {}, self._color, '\n\t')
        el.append('glyph', {}, self._glyph, '\n\t')
        el.append('comment', {}, self._comment, '\n')
        return el
Пример #5
0
def xml_export_orbs_filters():
    """Return a xmlutils.Element('OrbsFilters') with all orbs filters.
	
	:rtype: xmlutils.Element
	"""
    all = all_orbs_filters()
    el = xmlutils.Element('OrbsFilters', {}, '\n', '\n')
    for a in all:
        el.append(a._to_xml())
    return el
Пример #6
0
def xml_export_planets_filters():
    """Return a xmlutils.Element('PlanetsFilters') containing all planets filters.
	
	:rtype: xmlutils.Element
	"""
    all = all_planets_filters()
    el = xmlutils.Element('PlanetsFilters', {}, '\n', '\n')
    for a in all:
        el.append(a._to_xml())
    return el
Пример #7
0
def xml_export_aspects_restrictions():
    """Return a xmlutils.Element('AllAspectsRestrictions').
	
	:rtype: xmlutils.Element
	"""
    all = all_aspects_restrictions()
    el = xmlutils.Element('AllAspectsRestrictions', {}, '\n', '\n')
    for a in all:
        el.append(a._to_xml())
    return el
Пример #8
0
def xml_export_aspects(with_idx=False):
    """Return a xmlutils.Element('Aspects') containing all aspects.
	
	:type with_idx: bool
	:rtype: xmlutils.Element
	"""
    all = all_aspects()
    el = xmlutils.Element('Aspects', {}, '\n', '\n')
    for a in all:
        el.append(a._to_xml(with_idx=with_idx))
    return el
Пример #9
0
    def _to_xml(self):
        """Return chart as an xmlutils element.

        :rtype: xmlutils.Element
        """
        el = xmlutils.Element('ASTROLOGY', {'software': 'Oroboros'},
            text='\n', tail='\n')
        # comments
        cmt = xmlutils.comment(
            'Generated by Oroboros, %s UTC' % datetime.utcnow().replace(microsecond=0))
        cmt.tail = '\n'
        el.append(_etree_elem=cmt)
        cmt = xmlutils.comment('For user: %s %s' % (cfg.username, cfg.usermail))
        cmt.tail = '\n\t'
        el.append(_etree_elem=cmt)
        # data
        el.append('NAME', text=self.name, tail='\n\t')
        el.append('DATETIME',
            {'calendar': self._calendar if self._calendar != None else '',
                'utcoffset': self._utcoffset if self._utcoffset != None else '',
                'dst': self._dst if self._dst != None else ''},
            self.datetime,
            '\n\t')
        el.append('LOCATION',
            {'latitude': str(self._latitude),
                'longitude': str(self._longitude),
                'altitude': self._altitude},
            self._location,
            '\n\t')
        el.append('COUNTRY',
            {'zoneinfo': self._zoneinfo,
                'timezone': self._timezone.utc if self._timezone != None else ''},
            self._country,
            '\n\t')
        el.append('COMMENT', text=self._comment, tail='\n\t')
        el.append('KEYWORDS', self._keywords, tail='\n')
        return el