def write(self, outfile, tabs): from xml.sax.saxutils import escape, quoteattr write = outfile.write write(' ' * tabs + '<columns>\n') tab_s = ' ' * (tabs+1) import widget_properties value = self.get_value() # this is a list for i in range(len(value)): val = value[i] # this is another list _label = escape(widget_properties._encode(val[0])) _size = escape(widget_properties._encode(val[1])) write('%s<column size=%s>%s</column>\n' % (tab_s, quoteattr(_size), _label )) write(' ' * tabs + '</columns>\n')
def write_prop(outfile, tabs): from xml.sax.saxutils import escape, quoteattr fwrite = outfile.write fwrite(' ' * tabs + '<fields>\n') tabs += 1 import widget_properties for label, width in self.fields: fwrite(' ' * tabs + '<field width=%s>%s</field>\n' % (quoteattr(width), escape(widget_properties._encode(label)))) tabs -= 1 fwrite(' ' * tabs + '</fields>\n')
def write(self, outfile, tabs): from xml.sax.saxutils import escape write = outfile.write write(' ' * tabs + '<choices>\n') tab_s = ' ' * (tabs + 1) for val in self.get_value(): v = widget_properties._encode(val[0]) try: checked = int(val[1]) except (IndexError, ValueError): checked = None if checked is None: write('%s<choice>%s</choice>\n' % (tab_s, escape(v))) else: write('%s<choice checked="%d">%s</choice>\n' % \ (tab_s, checked, escape(v))) write(' ' * tabs + '</choices>\n')
def write(self, outfile, tabs): from xml.sax.saxutils import escape write = outfile.write write(' ' * tabs + '<choices>\n') tab_s = ' ' * (tabs+1) for val in self.get_value(): v = widget_properties._encode(val[0]) try: checked = int(val[1]) except (IndexError, ValueError): checked = None if checked is None: write('%s<choice>%s</choice>\n' % (tab_s, escape(v))) else: write('%s<choice checked="%d">%s</choice>\n' % \ (tab_s, checked, escape(v))) write(' ' * tabs + '</choices>\n')
def write(self, outfile, tabs): from xml.sax.saxutils import escape, quoteattr write = outfile.write write(' ' * tabs + '<tabs>\n') tab_s = ' ' * (tabs+1) import widget_properties value = self.get_value() for i in range(len(value)): val = value[i] v = escape(widget_properties._encode(val[0])) window = None try: t = self.owner.tabs[i] if t[0] == val[0]: window = t[1] except: pass if window: write('%s<tab window=%s>' % (tab_s, quoteattr(window.name))) write(v) write('</tab>\n') write(' ' * tabs + '</tabs>\n')
def write(self, outfile, tabs): from xml.sax.saxutils import escape, quoteattr write = outfile.write write(' ' * tabs + '<tabs>\n') tab_s = ' ' * (tabs + 1) import widget_properties value = self.get_value() for i in range(len(value)): val = value[i] v = escape(widget_properties._encode(val[0])) window = None try: t = self.owner.tabs[i] if t[0] == val[0]: window = t[1] except: pass if window: write('%s<tab window=%s>' % (tab_s, quoteattr(window.name))) write(v) write('</tab>\n') write(' ' * tabs + '</tabs>\n')