From 1de77dd8c37e4b00901f92187a5486145893382f Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Tue, 21 Feb 2012 23:22:02 -0800 Subject: [PATCH] widgets.text: Allow changing the hint text dynamically This makes it so that the hint text can be changed at runtime. Signed-off-by: David Aguilar --- cola/widgets/text.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cola/widgets/text.py b/cola/widgets/text.py index 0062d16a..3f4845c2 100644 --- a/cola/widgets/text.py +++ b/cola/widgets/text.py @@ -43,6 +43,12 @@ class HintedTextWidgetMixin(object): def reset_cursor(self): pass + def set_hint(self, hint): + is_hint = self.is_hint() + self._hint = hint + if is_hint: + self.enable_hint(True) + def hint(self): return self._hint @@ -95,6 +101,7 @@ class HintedTextEdit(QtGui.QTextEdit, HintedTextWidgetMixin): def set_value(self, value): self.setPlainText(value) + self.refresh_palette() def emit_position(self): cursor = self.textCursor() @@ -120,6 +127,7 @@ class HintedLineEdit(QtGui.QLineEdit, HintedTextWidgetMixin): def set_value(self, value): self.setText(value) + self.refresh_palette() def as_unicode(self): return unicode(self.text()) -- 2.11.4.GIT