[turbine] Add tooltip messages to the status bar on focus



commit e79ce9ddad40f7ef7848073feea247b4093b69ea
Author: Thomas Wood <thomas pepper localdomain>
Date:   Fri Nov 27 14:40:20 2009 +0000

    Add tooltip messages to the status bar on focus

 src/turbine/__init__.py |   12 ++++++++++++
 src/turbine/turbine.xml |   12 ++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/turbine/__init__.py b/src/turbine/__init__.py
index afbec6f..36a6809 100755
--- a/src/turbine/__init__.py
+++ b/src/turbine/__init__.py
@@ -322,6 +322,11 @@ def clear_ui (button, ui):
         ui.get_object (key).set_text ("")
     model = ui.get_object ('interfaces-model').clear ()
 
+def entry_focus_in_cb (entry, event, ui):
+    ui.get_object ("statusbar").push (0, entry.get_tooltip_text ())
+
+def entry_focus_out_cb (entry, event, ui):
+    ui.get_object ("statusbar").pop (0)
 
 def main(argv = sys.argv, stdout=sys.stdout, stderr=sys.stderr):
     ui = gtk.Builder()
@@ -341,6 +346,13 @@ def main(argv = sys.argv, stdout=sys.stdout, stderr=sys.stderr):
     button = ui.get_object ('about-button')
     button.connect ('clicked', about_button_clicked_cb, ui)
 
+    # enable hint text in the status bar
+    string_keys = ("class_camel", "class_lower", "package_upper",
+                   "object_upper", "parent", "parent_camel");
+    for key in string_keys:
+        ui.get_object (key).connect ("focus-in-event", entry_focus_in_cb, ui)
+        ui.get_object (key).connect ("focus-out-event", entry_focus_out_cb, ui)
+
     ui.get_object ('class_camel').connect ('changed', guess_class_params, ui)
     ui.get_object ('parent_camel').connect ('changed', guess_parent_params, ui)
 
diff --git a/src/turbine/turbine.xml b/src/turbine/turbine.xml
index dee9bc4..58a62d6 100644
--- a/src/turbine/turbine.xml
+++ b/src/turbine/turbine.xml
@@ -99,7 +99,7 @@
                           <object class="GtkEntry" id="class_camel">
                             <property name="can_focus">True</property>
                             <property name="has_focus">True</property>
-                            <property name="tooltip_text" translatable="yes">CamelCase</property>
+                            <property name="tooltip_text" translatable="yes">Class name in CamelCase</property>
                             <property name="invisible_char">&#x25CF;</property>
                           </object>
                           <packing>
@@ -156,7 +156,7 @@
                         <child>
                           <object class="GtkEntry" id="object_upper">
                             <property name="can_focus">True</property>
-                            <property name="tooltip_text" translatable="yes">UPPER_CASE</property>
+                            <property name="tooltip_text" translatable="yes">Object name in UPPER_CASE</property>
                             <property name="invisible_char">&#x25CF;</property>
                           </object>
                           <packing>
@@ -169,7 +169,7 @@
                         <child>
                           <object class="GtkEntry" id="package_upper">
                             <property name="can_focus">True</property>
-                            <property name="tooltip_text" translatable="yes">UPPER_CASE</property>
+                            <property name="tooltip_text" translatable="yes">Package name in UPPER_CASE</property>
                             <property name="invisible_char">&#x25CF;</property>
                           </object>
                           <packing>
@@ -182,7 +182,7 @@
                         <child>
                           <object class="GtkEntry" id="class_lower">
                             <property name="can_focus">True</property>
-                            <property name="tooltip_text" translatable="yes">lower_case</property>
+                            <property name="tooltip_text" translatable="yes">Class name in lower_case</property>
                             <property name="invisible_char">&#x25CF;</property>
                           </object>
                           <packing>
@@ -240,7 +240,7 @@
                         <child>
                           <object class="GtkEntry" id="parent_camel">
                             <property name="can_focus">True</property>
-                            <property name="tooltip_text" translatable="yes">CamelCase</property>
+                            <property name="tooltip_text" translatable="yes">Parent class name in CamelCase</property>
                             <property name="invisible_char">&#x25CF;</property>
                           </object>
                           <packing>
@@ -261,7 +261,7 @@
                         <child>
                           <object class="GtkEntry" id="parent">
                             <property name="can_focus">True</property>
-                            <property name="tooltip_text" translatable="yes">TYPE_NAME</property>
+                            <property name="tooltip_text" translatable="yes">Parent TYPE_NAME</property>
                             <property name="invisible_char">&#x25CF;</property>
                           </object>
                           <packing>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]