Exemplo n.º 1
0
    def get_xml(self):
        """ Get the XML representation as `ElementTree` object.

        :return: XML `ElementTree` of this object and all its subelements

        """
        self.attribs['d'] = to_unicode(strlist(self.commands, ' '))
        return super(Path, self).get_xml()
Exemplo n.º 2
0
    def get_xml(self):
        """ Get the XML representation as `ElementTree` object.

        :return: XML `ElementTree` of this object and all its subelements

        """
        self.attribs['d'] = to_unicode(strlist(self.commands, ' '))
        return super(Path, self).get_xml()
Exemplo n.º 3
0
    def value_to_string(self, value):
        """
        Converts *value* into a <string> includes a value check, depending
        on :attr:`self.debug` and :attr:`self.profile`.

        """
        if isinstance(value, (int, float)):
            if self.debug:
                self.validator.check_svg_type(value, 'number')
            if isinstance(value, float) and self.profile == 'tiny':
                value = round(value, 4)
        return to_unicode(value)
Exemplo n.º 4
0
    def value_to_string(self, value):
        """
        Converts *value* into a <string> includes a value check, depending
        on :attr:`self.debug` and :attr:`self.profile`.

        """
        if isinstance(value, (int, float)):
            if self.debug:
                self.validator.check_svg_type(value, 'number')
            if isinstance(value, float) and self.profile == 'tiny':
                value = round(value, 4)
        return to_unicode(value)
Exemplo n.º 5
0
 def get_xml(self):
     xml = super(TSpan, self).get_xml()
     xml.text = to_unicode(self.text)
     return xml
Exemplo n.º 6
0
 def get_xml(self):
     self.update_id() # if href is an object - 'id' - attribute may be changed!
     xml = super(TextPath, self).get_xml()
     xml.text = to_unicode(self.text)
     return xml
Exemplo n.º 7
0
 def __init__(self, text):
     self.xml = etree.Element(self.elementname)
     self.xml.text = to_unicode(text)
Exemplo n.º 8
0
 def test_non_us_ascii_chars(self):
     txt = TSpan('öäü')
     self.assertEqual(txt.tostring(), to_unicode('<tspan>öäü</tspan>'))
Exemplo n.º 9
0
 def test_float_to_unicode(self):
     self.assertEqual(u'10.1', to_unicode(10.1))
Exemplo n.º 10
0
 def test_int_to_unicode(self):
     self.assertEqual(u'10', to_unicode(10))
Exemplo n.º 11
0
 def test_unicode_to_unicode(self):
     self.assertEqual(u'süß', to_unicode(u'süß'))
Exemplo n.º 12
0
 def __init__(self, text):
     self.xml = etree.Element(self.elementname)
     self.xml.text = to_unicode(text)
Exemplo n.º 13
0
 def test_non_us_ascii_chars(self):
     txt = TSpan('öäü')
     self.assertEqual(txt.tostring(), to_unicode('<tspan>öäü</tspan>'))
Exemplo n.º 14
0
 def test_float_to_unicode(self):
     self.assertEqual(u'10.1', to_unicode(10.1))
Exemplo n.º 15
0
 def test_int_to_unicode(self):
     self.assertEqual(u'10', to_unicode(10))
Exemplo n.º 16
0
 def test_unicode_to_unicode(self):
     self.assertEqual(u'süß', to_unicode(u'süß'))