Esempio n. 1
0
 def get_static_text(self, otext, positions):
     st = self.rendered_text_cache.get(otext)
     if st is None:
         text = (otext or '').ljust(self.max_text_length + 1, ' ')
         text = make_highlighted_text('color: magenta', text, positions)
         desc = self.descriptions.get(otext)
         if desc:
             text += ' ' + desc
         st = self.rendered_text_cache[otext] = QStaticText(text)
         st.setTextOption(self.text_option)
         st.setTextFormat(Qt.RichText)
         st.prepare(font=self.parent().font())
     return st
Esempio n. 2
0
 def get_static_text(self, otext, positions):
     st = self.rendered_text_cache.get(otext)
     if st is None:
         text = (otext or '').ljust(self.max_text_length + 1, '\xa0')
         text = make_highlighted_text('color: magenta', text, positions)
         desc = self.descriptions.get(otext)
         if desc:
             text += ' - <i>%s</i>' % prepare_string_for_xml(desc)
         color = self.palette().color(QPalette.ColorRole.Text).name()
         text = '<span style="color: %s">%s</span>' % (color, text)
         st = self.rendered_text_cache[otext] = QStaticText(text)
         st.setTextOption(self.text_option)
         st.setTextFormat(Qt.TextFormat.RichText)
         st.prepare(font=self.parent().font())
     return st
Esempio n. 3
0
 def get_static_text(self, otext, positions):
     st = self.rendered_text_cache.get(otext)
     if st is None:
         text = (otext or '').ljust(self.max_text_length + 1, '\xa0')
         text = make_highlighted_text('color: magenta', text, positions)
         desc = self.descriptions.get(otext)
         if desc:
             text += ' - <i>%s</i>' % prepare_string_for_xml(desc)
         color = self.palette().color(QPalette.Text).name()
         text = '<span style="color: %s">%s</span>' % (color, text)
         st = self.rendered_text_cache[otext] = QStaticText(text)
         st.setTextOption(self.text_option)
         st.setTextFormat(Qt.RichText)
         st.prepare(font=self.parent().font())
     return st