[Xword-commits] r125 - trunk

terrencegf at garage.maemo.org terrencegf at garage.maemo.org
Wed May 28 21:58:50 EEST 2008


Author: terrencegf
Date: 2008-05-28 21:58:50 +0300 (Wed, 28 May 2008)
New Revision: 125

Modified:
   trunk/xword
Log:
Added right-click popups for "Check Word" and "Solve Word" buttons on
onscreen keyboard.  (For non-hildon use.)


Modified: trunk/xword
===================================================================
--- trunk/xword	2008-05-28 03:29:05 UTC (rev 124)
+++ trunk/xword	2008-05-28 18:58:50 UTC (rev 125)
@@ -2145,12 +2145,11 @@
             if has_hildon:
                 if label == 'Escape':
                     button.tap_and_hold_setup(self.check_popup)
-                if label == 'F12':
+                elif label == 'F12':
                     button.tap_and_hold_setup(self.solve_popup)
 
-            #button.set_relief(gtk.RELIEF_NONE)
-            #button.set_focus_on_click(False)
-            button.connect('clicked',self.letterbar_event,label)
+            button.child.connect('button-release-event',
+                self.letterbar_event,label)
             table.attach(button, col, col+1, row, row+1)
 
             col += 1
@@ -2252,13 +2251,21 @@
                 self.clock_buttons[index].handler_unblock(
                     self.clock_buttons_handler_ids[index])
 
-    def letterbar_event(self, widget, event):
+    def letterbar_event(self, widget, event, label):
         keypress = gtk.gdk.Event(gtk.gdk.KEY_PRESS)
-        keypress.keyval = int(gtk.gdk.keyval_from_name(event))
-        if len(event) is 1 and event.isalpha():
+        keypress.keyval = int(gtk.gdk.keyval_from_name(label))
+        if len(label) is 1 and label.isalpha():
             self.puzzle_key_event('',keypress)
         else:
-            self.key_event('',keypress)
+            if event.button == 3 and (label == 'F12' or label == 'Escape'):
+                if (label == 'F12'):
+                   self.solve_popup.popup(None,None,None,
+                       event.button,event.time)
+                else:
+                   self.check_popup.popup(None,None,None,
+                       event.button,event.time)
+            else:
+                self.key_event('',keypress)
 
     def button_event(self, widget, event, puzzle):
         if event.type is gtk.gdk.BUTTON_PRESS:



More information about the Xword-commits mailing list