[accerciser/macaroon-pygi] Fixing some methods due to gtk2-to-gtk3 migration



commit 456e35e662cd48392f9f8c5748c60da1a6667d3f
Author: Javier HernÃndez <jhernandez emergya es>
Date:   Wed Oct 5 17:57:45 2011 +0200

    Fixing some methods due to gtk2-to-gtk3 migration

 macaroon/macaroon/playback/utils.py |    3 ++-
 macaroon/macaroon/record/main.py    |   18 +++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/macaroon/macaroon/playback/utils.py b/macaroon/macaroon/playback/utils.py
index dbbb9e2..e5d92a1 100644
--- a/macaroon/macaroon/playback/utils.py
+++ b/macaroon/macaroon/playback/utils.py
@@ -18,7 +18,8 @@ keymap = Gdk.Keymap.get_default()
 
 def getKeyCodeFromVal(keyval):
   global keymap
-  success, entry = keymap.get_entries_for_keyval(keyval)
+  success, entries = keymap.get_entries_for_keyval(keyval)
+  entry = [(int(i.keycode), i.group, i.level) for i in entries]
   if not entry:
     raise TypeError("Invalid key name")
   else:
diff --git a/macaroon/macaroon/record/main.py b/macaroon/macaroon/record/main.py
index 6d83bca..8644620 100644
--- a/macaroon/macaroon/record/main.py
+++ b/macaroon/macaroon/record/main.py
@@ -39,7 +39,7 @@ class Main:
     status_icon = Gtk.StatusIcon.new_from_stock(Gtk.STOCK_MEDIA_RECORD)
     status_icon.connect('activate', self._onActivate)
     status_icon.connect('popup-menu', self._onPopup)
-    status_icon.set_tooltip(self.start_tooltip)
+    status_icon.set_tooltip_text(self.start_tooltip)
     self.ui_manager = self._newUIManager()
     self.script_buffer = ScriptBuffer(self.ui_manager)
     self.script_buffer.clearBuffer()
@@ -59,10 +59,10 @@ class Main:
     is_recording = self.script_buffer.get_property('recording')
     if is_recording:
       status_icon.set_from_stock(Gtk.STOCK_MEDIA_STOP)
-      status_icon.set_tooltip(self.stop_tooltip)
+      status_icon.set_tooltip_text(self.stop_tooltip)
     else:
       status_icon.set_from_stock(Gtk.STOCK_MEDIA_RECORD)
-      status_icon.set_tooltip(self.start_tooltip)
+      status_icon.set_tooltip_text(self.start_tooltip)
 
   def _onActivate(self, status_icon):
     is_recording = self.script_buffer.get_property('recording')
@@ -98,7 +98,7 @@ class Main:
 
   def _onPopup(self, status_icon, button, activate_time):
     menu = self.ui_manager.get_widget('/popup')
-    menu.popup(None, None, Gtk.status_icon_position_menu,
+    menu.popup(None, None, Gtk.status_icon_position_menu, 
                button, activate_time, status_icon)
     
   def _onQuit(self, action):
@@ -255,7 +255,7 @@ class MacroPreview(Gtk.Window):
 
 class ScriptBuffer(GtkSource.Buffer):
   __gproperties__ = {
-    'recording': (GObject.TYPE_BOOLEAN,
+    'recording': (GObject.TYPE_BOOLEAN, 
                   'Is recording', 
                   'True if script buffer is recording',
                   False, GObject.PARAM_READWRITE)}
@@ -263,10 +263,10 @@ class ScriptBuffer(GtkSource.Buffer):
                      'Level2' : script_factory.Level2SequenceFactory}
   def __init__(self, uimanager):
     GtkSource.Buffer.__init__(self)
-    lm = GtkSource.LanguagesManager()
-    lang = lm.get_language_from_mime_type('text/x-python')
+    lm = GtkSource.LanguageManager()
+    lang = lm.guess_language(None, 'text/x-python')
     self.set_language(lang)
-    self.set_highlight(True)
+    self.set_highlight_syntax(True)
     self.script_factory = self.factory_mapping['Level2'](True)
     self._recording = False
     self._uimanager = uimanager
@@ -278,7 +278,7 @@ class ScriptBuffer(GtkSource.Buffer):
         (('Level1', None, 'Level 1', None, None, 1),
          ('Level2', None, 'Level 2', None, None, 2)),
         2, self._onChange)
-    self._wait_for_focus_toggle = Gtk.ToggleAction('WaitForFocus',
+    self._wait_for_focus_toggle = Gtk.ToggleAction('WaitForFocus', 
                                                    'Record focus events',
                                                    None, None)
     self._wait_for_focus_toggle.set_active(True)



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