Add help button for showing help message for input method.
authorPeng Huang <shawn.p.huang@gmail.com>
Wed, 3 Jun 2009 08:08:29 +0000 (16:08 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Thu, 4 Jun 2009 02:06:13 +0000 (10:06 +0800)
setup/enginetreeview.py
setup/main.py
setup/setup.glade

index 4ee403d..8c7d5b0 100644 (file)
@@ -128,7 +128,7 @@ class EngineTreeView(gtk.TreeView):
         iter = self.get_selected_iter()
         if iter == None:
             return None
-        row = self.__model.get(iter)
+        row = self.__model.get(iter, 0)
         return row[0]
 
     def prepend_engine(self, engine):
index 8aea11b..19ba4fa 100644 (file)
@@ -187,6 +187,22 @@ class Setup(object):
         button = self.__xml.get_widget("button_engine_down")
         button.connect("clicked", lambda *args:self.__treeview.move_down_engine())
 
+        button = self.__xml.get_widget("button_engine_help")
+        button.connect("clicked", self.__button_engine_help_cb)
+
+    def __button_engine_help_cb(self, button):
+        engine = self.__treeview.get_select_engine()
+        message = "Please select an input method!"
+        title = "Help"
+        if engine:
+            title = engine.get_longname()
+            message = engine.get_description()
+
+        dlg = gtk.MessageDialog(buttons=gtk.BUTTONS_CLOSE, message_format=message)
+        dlg.set_title(title)
+        dlg.run()
+        dlg.destroy()
+
     def __treeview_changed_cb(self, treeview):
         engines = self.__treeview.get_engines()
         engine_names = map(lambda e: e.name, engines)
index aab7988..633f335 100644 (file)
@@ -482,6 +482,20 @@ Always</property>
                                     <property name="position">3</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <widget class="GtkButton" id="button_engine_help">
+                                    <property name="label" translatable="yes">gtk-help</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="use_stock">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">4</property>
+                                  </packing>
+                                </child>
                               </widget>
                             </child>
                           </widget>