Пример #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()
Пример #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()
Пример #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)
Пример #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)
Пример #5
0
 def get_xml(self):
     xml = super(TSpan, self).get_xml()
     xml.text = to_unicode(self.text)
     return xml
Пример #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
Пример #7
0
 def __init__(self, text):
     self.xml = etree.Element(self.elementname)
     self.xml.text = to_unicode(text)
Пример #8
0
 def test_non_us_ascii_chars(self):
     txt = TSpan('öäü')
     self.assertEqual(txt.tostring(), to_unicode('<tspan>öäü</tspan>'))
Пример #9
0
 def test_float_to_unicode(self):
     self.assertEqual(u'10.1', to_unicode(10.1))
Пример #10
0
 def test_int_to_unicode(self):
     self.assertEqual(u'10', to_unicode(10))
Пример #11
0
 def test_unicode_to_unicode(self):
     self.assertEqual(u'süß', to_unicode(u'süß'))
Пример #12
0
 def __init__(self, text):
     self.xml = etree.Element(self.elementname)
     self.xml.text = to_unicode(text)
Пример #13
0
 def test_non_us_ascii_chars(self):
     txt = TSpan('öäü')
     self.assertEqual(txt.tostring(), to_unicode('<tspan>öäü</tspan>'))
Пример #14
0
 def test_float_to_unicode(self):
     self.assertEqual(u'10.1', to_unicode(10.1))
Пример #15
0
 def test_int_to_unicode(self):
     self.assertEqual(u'10', to_unicode(10))
Пример #16
0
 def test_unicode_to_unicode(self):
     self.assertEqual(u'süß', to_unicode(u'süß'))