[accerciser] Fix for Bug 678517 - Macaroon script recorder is broken



commit f19e98af43069dc5943e2e9ff1d17f6bc6b3b7db
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jun 21 08:07:44 2012 -0400

    Fix for Bug 678517 - Macaroon script recorder is broken

 macaroon/macaroon/record/about.py          |    2 +-
 macaroon/macaroon/record/main.py           |    9 +++++----
 macaroon/macaroon/record/script_factory.py |   16 ++++++++--------
 3 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/macaroon/macaroon/record/about.py b/macaroon/macaroon/record/about.py
index d66830f..a5a3ece 100644
--- a/macaroon/macaroon/record/about.py
+++ b/macaroon/macaroon/record/about.py
@@ -11,7 +11,7 @@
 
 # Headers in this file shall remain intact.
 
-from gi.repository import Gtk
+from gi.repository import Gtk, GObject
 #from gnome import program_get, url_show
 
 _ = lambda x: x
diff --git a/macaroon/macaroon/record/main.py b/macaroon/macaroon/record/main.py
index 1a8cfdd..fb7b8dd 100644
--- a/macaroon/macaroon/record/main.py
+++ b/macaroon/macaroon/record/main.py
@@ -12,6 +12,7 @@
 # Headers in this file shall remain intact.
 
 from gi.repository import Gtk
+from gi.repository import Gdk
 from gi.repository import GObject
 from gi.repository import Pango
 from gi.repository import GtkSource
@@ -99,7 +100,7 @@ class Main:
   def _onPopup(self, status_icon, button, activate_time):
     menu = self.ui_manager.get_widget('/popup')
     menu.popup(None, None, Gtk.StatusIcon.position_menu,
-               button, activate_time, status_icon)
+               status_icon, button, activate_time)
  
   def _onQuit(self, action):
     pyatspi.Registry.stop()
@@ -450,11 +451,11 @@ class _FakeDeviceEvent(object):
       modifiers = 0
     else:
       id, modifiers = Gtk.accelerator_parse(key_combo)
-    keymap = Gdk.keymap_get_default()
-    map_entry = keymap.get_entries_for_keyval(65471)
+    keymap = Gdk.Keymap.get_default()
+    success, map_entry = keymap.get_entries_for_keyval(65471)
     self.type = type
     self.id = id
-    self.hw_code = map_entry[0][0]
+    self.hw_code = map_entry[0].keycode
     self.modifiers = int(modifiers)
     self.timestamp = 0
     self.event_string = Gdk.keyval_name(id)
diff --git a/macaroon/macaroon/record/script_factory.py b/macaroon/macaroon/record/script_factory.py
index 9e2ad1a..6b97bda 100644
--- a/macaroon/macaroon/record/script_factory.py
+++ b/macaroon/macaroon/record/script_factory.py
@@ -136,15 +136,15 @@ class Level2SequenceFactory(SequenceFactory):
           (event.event_string.startswith('ISO') and \
              event.event_string != 'ISO_Left_Tab'):
       return
-    if isinstance(event, pyatspi.event.DeviceEvent):
+    if isinstance(event, pyatspi.deviceevent.DeviceEvent):
       # If it's a fake one, then it is a global WM hotkey, no need for context.
       self._prependContext()
-    if event.modifiers in (0, Gdk.EventMask.SHIFT_MASK) and \
+    if event.modifiers in (0, Gdk.ModifierType.SHIFT_MASK) and \
           Gdk.keyval_to_unicode(event.id):
       self.typed_text += unichr(Gdk.keyval_to_unicode(event.id))
     else:
       if self.frame_name:
-        if isinstance(event, pyatspi.event.DeviceEvent):
+        if isinstance(event, pyatspi.deviceevent.DeviceEvent):
           self.commands_queue.put_nowait(
             'sequence.append(WaitForWindowActivate("%s", None))\n' % \
               self.frame_name.replace('"','\"'))
@@ -162,7 +162,7 @@ class Level2SequenceFactory(SequenceFactory):
         self.typed_text = ''
       self.commands_queue.put_nowait(
         'sequence.append(KeyComboAction("%s"))\n' % \
-          Gtk.accelerator_name(event.id, event.modifiers))
+          Gtk.accelerator_name(event.id, Gdk.ModifierType(event.modifiers)))
 
   def focusCommand(self, event):
     self.last_focused = (event.source.name, 
@@ -264,7 +264,7 @@ class DogtailFactory(ScriptFactory):
     if event.id in self.MODIFIERS or \
           event.event_string.startswith('ISO'):
       return
-    if event.modifiers in (0, Gdk.EventMask.SHIFT_MASK) and \
+    if event.modifiers in (0, Gdk.ModifierType.SHIFT_MASK) and \
           Gdk.keyval_to_unicode(event.id):
       self.typed_text += unichr(Gdk.keyval_to_unicode(event.id))
     else:
@@ -282,7 +282,7 @@ class DogtailFactory(ScriptFactory):
         self.typed_text = ''
       self.commands_queue.put_nowait('keyCombo("%s")\n' % \
                                        Gtk.accelerator_name(event.id,
-                                                            event.modifiers))
+                                                            Gdk.ModifierType(event.modifiers)))
 
 
 class NativeFactory(DogtailFactory):
@@ -317,7 +317,7 @@ class LDTPFactory(DogtailFactory):
     if event.id in self.MODIFIERS or \
           event.event_string.startswith('ISO'):
       return
-    if event.modifiers in (0, Gdk.EventMask.SHIFT_MASK) and \
+    if event.modifiers in (0, Gdk.ModifierType.SHIFT_MASK) and \
           Gdk.keyval_to_unicode(event.id):
       self.typed_text += unichr(Gdk.keyval_to_unicode(event.id))
     else:
@@ -331,4 +331,4 @@ class LDTPFactory(DogtailFactory):
         self.typed_text = ''
       self.commands_queue.put_nowait('generatekeyevent("%s")\n' % \
                                        Gtk.accelerator_name(event.id,
-                                                            event.modifiers))
+                                                            Gdk.ModifierType(event.modifiers)))



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