示例#1
0
 def __init__(self, conn, suite):
     table = ujoin(suite, 'templates')
     TraitRelation.__init__(self, conn, suite, table, name='TraitTemplate')
     self.traitparent = TraitParent(conn, suite)
     self.template = Template()
     self.template_path = None
     self.textfiles = TextFileManager(self.conn)
     self._jtable = '%s as s join textfiles as t ' % table
     self._jtable += 'on s.templatefile = t.fileid' 
示例#2
0
 def tag_selection(self, trait, name):
     if not self.hasSelectedText():
         raise RuntimeError , 'we need selected text'
     template = Template()
     left, right = template.delimiters
     tagname = '_'.join([trait, name])
     tag = ''.join([left, tagname, right])
     pstart, istart, pend, iend = self.getSelection()
     self.removeSelectedText()
     self.insertAt(tag, pstart, istart)
示例#3
0
 def highlightParagraph(self, text, endStateOfLastPara):
     text = str(text)
     template = Template()
     template.set_template(text)
     for span in template.spans():
         font = self.textEdit().currentFont()
         font.setBold(True)
         color = QColor('blue')
         length = span[1] - span[0]
         self.setFormat(span[0], length, font, color)
     return 0