[accerciser] Fix for bug 691136 - Replace deprecated GObject methods with their GLib equivalents



commit 1914670671575f1a96b4d6b138f7ded585da064a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jan 4 10:43:28 2013 -0500

    Fix for bug 691136 - Replace deprecated GObject methods with their GLib equivalents

 macaroon/macaroon/playback/keypress_actions.py |   14 +++++++-------
 macaroon/macaroon/playback/sequence.py         |    2 +-
 macaroon/macaroon/playback/wait_actions.py     |    4 ++--
 plugins/event_monitor.py                       |    6 +++---
 plugins/ipython_view.py                        |   10 +++++-----
 plugins/validate.py                            |   10 +++++-----
 src/lib/accerciser/accerciser.py               |    4 ++--
 src/lib/accerciser/accessible_treeview.py      |    7 ++++---
 src/lib/accerciser/node.py                     |    7 ++++---
 9 files changed, 33 insertions(+), 31 deletions(-)
---
diff --git a/macaroon/macaroon/playback/keypress_actions.py b/macaroon/macaroon/playback/keypress_actions.py
index 86b23d2..420d7cc 100644
--- a/macaroon/macaroon/playback/keypress_actions.py
+++ b/macaroon/macaroon/playback/keypress_actions.py
@@ -17,7 +17,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 GLib
 import pyatspi
 
 from sequence_step import AtomicAction
@@ -170,15 +170,15 @@ class KeyComboAction(AtomicAction):
     interval = 0
     mod_hw_codes = map(mod_key_code_mappings.get, modifiers.value_names)
     for mod_hw_code in mod_hw_codes:
-      GObject.timeout_add(interval, self._keyPress, mod_hw_code)
+      GLib.timeout_add(interval, self._keyPress, mod_hw_code)
       interval += keystroke_interval
-    GObject.timeout_add(interval, self._keyPressRelease, key_code)
+    GLib.timeout_add(interval, self._keyPressRelease, key_code)
     interval += keystroke_interval
     mod_hw_codes.reverse()
     for mod_hw_code in mod_hw_codes:
-      GObject.timeout_add(interval, self._keyRelease, mod_hw_code)
+      GLib.timeout_add(interval, self._keyRelease, mod_hw_code)
       interval += keystroke_interval
-    GObject.timeout_add(interval, self.stepDone)
+    GLib.timeout_add(interval, self.stepDone)
 
   def _keyPress(self, hw_code):
     '''
@@ -258,10 +258,10 @@ class TypeAction(AtomicAction):
     '''
     interval = 0
     for char in string_to_type:
-      GObject.timeout_add(interval, self._charType,
+      GLib.timeout_add(interval, self._charType,
                           Gdk.unicode_to_keyval(ord(char)))
       interval += self.interval 
-    GObject.timeout_add(interval, self.stepDone)
+    GLib.timeout_add(interval, self.stepDone)
 
   def _charType(self, keyval):
     '''
diff --git a/macaroon/macaroon/playback/sequence.py b/macaroon/macaroon/playback/sequence.py
index bacb1b1..282f234 100644
--- a/macaroon/macaroon/playback/sequence.py
+++ b/macaroon/macaroon/playback/sequence.py
@@ -112,7 +112,7 @@ class MacroSequence(GObject.GObject):
                                            *self._anticipated_event_types)
     self._current_handler = action.connect('done', self._onStepDone)
 
-    GObject.timeout_add(action.delta_time, self._doAction, action)
+    GLib.timeout_add(action.delta_time, self._doAction, action)
 
   def _onAnticipatedEvent(self, event):
     '''
diff --git a/macaroon/macaroon/playback/wait_actions.py b/macaroon/macaroon/playback/wait_actions.py
index 437878b..818e09f 100644
--- a/macaroon/macaroon/playback/wait_actions.py
+++ b/macaroon/macaroon/playback/wait_actions.py
@@ -15,7 +15,7 @@ See "COPYING" in the source distribution for more information.
 Headers in this file shall remain intact.
 '''
 
-from gi.repository import GObject
+from gi.repository import GLib
 import pyatspi
 
 import re
@@ -78,7 +78,7 @@ class WaitAction(SequenceStep):
     self._cached_events = cached_events
     if self.checkExistingState(): return
     pyatspi.Registry.registerEventListener(self.onEvent, *self.wait_for)
-    GObject.timeout_add(self._timeout, self._onTimeout)
+    GLib.timeout_add(self._timeout, self._onTimeout)
 
   def checkExistingState(self):
     '''
diff --git a/plugins/event_monitor.py b/plugins/event_monitor.py
index 2a86fdf..e3e29e1 100644
--- a/plugins/event_monitor.py
+++ b/plugins/event_monitor.py
@@ -14,7 +14,7 @@ import gi
 
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
-from gi.repository import GObject
+from gi.repository import GLib
 from gi.repository import Pango
 
 import pyatspi
@@ -122,7 +122,7 @@ class EventMonitor(ViewportPlugin):
       events.extend(sub_events)
     events = list(set([event.strip(':') for event in events]))
     events.sort()
-    GObject.idle_add(self._appendChildren, None, '', 0, events)
+    GLib.idle_add(self._appendChildren, None, '', 0, events)
 
   def _initTextView(self):
     '''
@@ -161,7 +161,7 @@ class EventMonitor(ViewportPlugin):
         iter = self.events_model.append(parent_iter, 
                                         [event.split(':')[-1],
                                          event, False, False])
-        GObject.idle_add(self._appendChildren, iter, event, level + 1, events)
+        GLib.idle_add(self._appendChildren, iter, event, level + 1, events)
     return False
         
   def _onToggled(self, renderer_toggle, path):
diff --git a/plugins/ipython_view.py b/plugins/ipython_view.py
index 1e65bb0..bf2e89b 100755
--- a/plugins/ipython_view.py
+++ b/plugins/ipython_view.py
@@ -16,7 +16,7 @@ import gi
 
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
-from gi.repository import GObject
+from gi.repository import GLib
 from gi.repository import Pango
 
 import re
@@ -365,7 +365,7 @@ class ConsoleView(gtk.TextView):
     self.connect('key-press-event', self.onKeyPress)
     
   def write(self, text, editable=False):
-    GObject.idle_add(self._write, text, editable)
+    GLib.idle_add(self._write, text, editable)
 
   def _write(self, text, editable=False):
     '''
@@ -399,7 +399,7 @@ class ConsoleView(gtk.TextView):
 
 
   def showPrompt(self, prompt):
-    GObject.idle_add(self._showPrompt, prompt)
+    GLib.idle_add(self._showPrompt, prompt)
 
   def _showPrompt(self, prompt):
     '''
@@ -413,7 +413,7 @@ class ConsoleView(gtk.TextView):
                                self.text_buffer.get_end_iter())
 
   def changeLine(self, text):
-    GObject.idle_add(self._changeLine, text)
+    GLib.idle_add(self._changeLine, text)
 
   def _changeLine(self, text):
     '''
@@ -440,7 +440,7 @@ class ConsoleView(gtk.TextView):
     return rv
 
   def showReturned(self, text):
-    GObject.idle_add(self._showReturned, text)
+    GLib.idle_add(self._showReturned, text)
 
   def _showReturned(self, text):
     '''
diff --git a/plugins/validate.py b/plugins/validate.py
index cbf1ce1..7a62585 100644
--- a/plugins/validate.py
+++ b/plugins/validate.py
@@ -308,7 +308,7 @@ class ValidatorViewport(ViewportPlugin):
     response = save_dialog.run()
     if response == gtk.ResponseType.OK:
       self.save_to = open(save_dialog.get_filename(), 'w')
-      GObject.idle_add(self._writeFile)
+      GLib.idle_add(self._writeFile)
     save_dialog.destroy()
 
   def _onClear(self, button):
@@ -346,7 +346,7 @@ class ValidatorViewport(ViewportPlugin):
     self.write_in_progress = True
     self._setDefaultSaveVars()
     # register an idle callback
-    self.idle_save_id = GObject.idle_add(self._onSaveIdle)
+    self.idle_save_id = GLib.idle_add(self._onSaveIdle)
     self.progress.set_text(_('Saving'))
     # disable controls
     self.validate.set_sensitive(False)
@@ -358,7 +358,7 @@ class ValidatorViewport(ViewportPlugin):
     components to their enabled states.
     '''
     # stop callbacks
-    GObject.source_remove(self.idle_save_id)
+    GLib.source_remove(self.idle_save_id)
     # reset progress
     self.progress.set_fraction(0.0)
     self.progress.set_text(_('Idle'))
@@ -394,7 +394,7 @@ class ValidatorViewport(ViewportPlugin):
     # build our walk generator
     self.walk = self._traverse(self.acc, state)
     # register an idle callback
-    self.idle_validate_id = GObject.idle_add(self._onValidateIdle)
+    self.idle_validate_id = GLib.idle_add(self._onValidateIdle)
     self.progress.set_text(_('Validating'))
     # disable controls
     self.schema.set_sensitive(False)
@@ -408,7 +408,7 @@ class ValidatorViewport(ViewportPlugin):
     various UI components to their enabled states.
     '''
     # stop callbacks
-    GObject.source_remove(self.idle_validate_id)
+    GLib.source_remove(self.idle_validate_id)
     # destroy generator
     self.walk = None
     # reset progress
diff --git a/src/lib/accerciser/accerciser.py b/src/lib/accerciser/accerciser.py
index ea08c4c..e092499 100644
--- a/src/lib/accerciser/accerciser.py
+++ b/src/lib/accerciser/accerciser.py
@@ -17,7 +17,7 @@ is available at U{http://www.opensource.org/licenses/bsd-license.php}
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
 from gi.repository import Wnck as wnck
-from gi.repository import GObject
+from gi.repository import GLib
 from gi.repository import Atk as atk
 
 import os, sys, locale
@@ -100,7 +100,7 @@ class Main(Tools):
     '''
     Runs the app.
     '''
-    GObject.timeout_add(200, self._pumpEvents)
+    GLib.timeout_add(200, self._pumpEvents)
     try:
       pyatspi.Registry.start(async=True, gil=False)
     except KeyboardInterrupt:
diff --git a/src/lib/accerciser/accessible_treeview.py b/src/lib/accerciser/accessible_treeview.py
index 9f29215..484ef7e 100644
--- a/src/lib/accerciser/accessible_treeview.py
+++ b/src/lib/accerciser/accessible_treeview.py
@@ -15,6 +15,7 @@ is available at U{http://www.opensource.org/licenses/bsd-license.php}
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
 from gi.repository import GdkPixbuf
+from gi.repository import GLib
 from gi.repository import GObject
 
 import pyatspi
@@ -222,7 +223,7 @@ class AccessibleModel(gtk.TreeStore, Tools):
     self._populating_tasks += 1
     if self._populating_tasks == 1:
       self.emit('start-populating')
-    GObject.idle_add(self._popOnIdle, row_reference)
+    GLib.idle_add(self._popOnIdle, row_reference)
 
   def _childrenIndexesInParent(self, accessible):
     '''
@@ -754,7 +755,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
       # We do this because an application won't have an icon loaded in 
       # the window manager when it is first registered to at-spi
       if new_child == new_child.getApplication():
-        GObject.timeout_add(1000, self._refreshIcon, new_child)
+        GLib.timeout_add(1000, self._refreshIcon, new_child)
     
   def _refreshIcon(self, app):
     '''
@@ -947,7 +948,7 @@ class AccessibleTreeView(gtk.TreeView, Tools):
     @type iter: L{gtk.TreeIter}
     '''
     # TODO: Remove idle_add when at-spi2 reentrancy issues are fixed
-    GObject.idle_add(self._accCellDataFuncReal, tvc, cellrenderer, model, iter_id)
+    GLib.idle_add(self._accCellDataFuncReal, tvc, cellrenderer, model, iter_id)
 
   def _accCellDataFuncReal(self, tvc, cellrenderer, model, iter_id):
     '''
diff --git a/src/lib/accerciser/node.py b/src/lib/accerciser/node.py
index c514d93..7146f10 100644
--- a/src/lib/accerciser/node.py
+++ b/src/lib/accerciser/node.py
@@ -15,6 +15,7 @@ import gi
 
 from gi.repository import Gtk as gtk
 from gi.repository import Gdk as gdk
+from gi.repository import GLib
 from gi.repository import GObject
 from gi.repository.Gio import Settings as GSettings
 #from gi.repository import cairo
@@ -156,7 +157,7 @@ class Node(GObject.GObject, Tools):
                                 gdk.CapStyle.BUTT, gdk.JoinStyle.MITER)
     self.inv = gtk.Invisible()
     self.inv.set_screen(screen)
-    GObject.timeout_add(30, self._drawRectangle)
+    GLib.timeout_add(30, self._drawRectangle)
 
   def _drawRectangle(self):
     '''
@@ -244,7 +245,7 @@ class _HighLight(gtk.Window):
     
   def highlight(self, duration=500):
     if duration > 0:
-      GObject.timeout_add(duration, lambda w: w.destroy(), self)
+      GLib.timeout_add(duration, lambda w: w.destroy(), self)
       self.show_all()
     else:
       self.destroy()
@@ -341,7 +342,7 @@ class _HighLight(gtk.Window):
 #    
 #  def highlight(self, duration=500):
 #    if duration > 0:
-#      GObject.timeout_add(duration, lambda w: w.destroy(), self)
+#      GLib.timeout_add(duration, lambda w: w.destroy(), self)
 #      self.show_all()
 #    else:
 #      self.destroy()



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