[hamster-applet] monitor also the changed event in our hint magic
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] monitor also the changed event in our hint magic
- Date: Tue, 24 Nov 2009 10:44:45 +0000 (UTC)
commit 04b516838e34628953b0f56f6331ae5f319db308
Author: Toms Bauģis <toms baugis gmail com>
Date: Tue Nov 24 10:43:22 2009 +0000
monitor also the changed event in our hint magic
hamster/widgets/__init__.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/hamster/widgets/__init__.py b/hamster/widgets/__init__.py
index 656e1b8..94db333 100644
--- a/hamster/widgets/__init__.py
+++ b/hamster/widgets/__init__.py
@@ -62,17 +62,23 @@ def add_hint(entry, hint):
if self.real_get_text() == self.hint:
self.set_text("")
+
+ def _on_changed(self, widget):
+ if self.real_get_text() == "" and self.is_focus() == False:
+ self._set_hint(widget, None)
import types
instancemethod = types.MethodType
entry._set_hint = instancemethod(_set_hint, entry, gtk.Entry)
entry._set_normal = instancemethod(_set_normal, entry, gtk.Entry)
+ entry._on_changed = instancemethod(_on_changed, entry, gtk.Entry)
entry.real_get_text = entry.get_text
entry.get_text = instancemethod(override_get_text, entry, gtk.Entry)
entry.connect('focus-in-event', entry._set_normal)
entry.connect('focus-out-event', entry._set_hint)
+ entry.connect('changed', entry._on_changed)
entry._set_hint(entry, None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]