コード例 #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
ファイル: base.py プロジェクト: jooni22/ms_infotainment
    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
ファイル: base.py プロジェクト: jooni22/ms_infotainment
 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
ファイル: test_utils.py プロジェクト: clbarnes/svgwrite
 def test_float_to_unicode(self):
     self.assertEqual(u'10.1', to_unicode(10.1))
コード例 #15
0
ファイル: test_utils.py プロジェクト: clbarnes/svgwrite
 def test_int_to_unicode(self):
     self.assertEqual(u'10', to_unicode(10))
コード例 #16
0
ファイル: test_utils.py プロジェクト: clbarnes/svgwrite
 def test_unicode_to_unicode(self):
     self.assertEqual(u'süß', to_unicode(u'süß'))