예제 #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
파일: path.py 프로젝트: MindPass/Code
    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
파일: base.py 프로젝트: dyao-vu/meta-core
    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
파일: test_utils.py 프로젝트: MindPass/Code
 def test_float_to_unicode(self):
     self.assertEqual(u'10.1', to_unicode(10.1))
예제 #10
0
파일: test_utils.py 프로젝트: MindPass/Code
 def test_int_to_unicode(self):
     self.assertEqual(u'10', to_unicode(10))
예제 #11
0
파일: test_utils.py 프로젝트: MindPass/Code
 def test_unicode_to_unicode(self):
     self.assertEqual(u'süß', to_unicode(u'süß'))
예제 #12
0
파일: base.py 프로젝트: dyao-vu/meta-core
 def __init__(self, text):
     self.xml = etree.Element(self.elementname)
     self.xml.text = to_unicode(text)
예제 #13
0
파일: test_text.py 프로젝트: MindPass/Code
 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üß'))