Replaced deprecated GObject methods with GLib methods

master
William Orr 11 years ago committed by Daniel Narvaez
parent 3a8760c9e4
commit e649070aa2

@ -80,8 +80,8 @@ test.show()
# test.queue_draw() # test.queue_draw()
# return True # return True
# #
#from gi.repository import GObject #from gi.repository import GLib
#GObject.idle_add(idle_cb) #GLib.idle_add(idle_cb)
if __name__ == '__main__': if __name__ == '__main__':
common.main(test) common.main(test)

@ -434,7 +434,7 @@ class TimeoutAlert(Alert):
self.add_button(Gtk.ResponseType.OK, _('Continue'), self._timeout_text) self.add_button(Gtk.ResponseType.OK, _('Continue'), self._timeout_text)
self._timeout_text.show() self._timeout_text.show()
GObject.timeout_add_seconds(1, self.__timeout) GLib.timeout_add_seconds(1, self.__timeout)
def __timeout(self): def __timeout(self):
self._timeout -= 1 self._timeout -= 1
@ -479,7 +479,7 @@ class NotifyAlert(Alert):
self.add_button(Gtk.ResponseType.OK, _('Ok'), self._timeout_text) self.add_button(Gtk.ResponseType.OK, _('Ok'), self._timeout_text)
self._timeout_text.show() self._timeout_text.show()
GObject.timeout_add(1000, self.__timeout) GLib.timeout_add(1000, self.__timeout)
def __timeout(self): def __timeout(self):
self._timeout -= 1 self._timeout -= 1

@ -22,6 +22,7 @@ STABLE.
import time import time
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
EASE_OUT_EXPO = 0 EASE_OUT_EXPO = 0
EASE_IN_EXPO = 1 EASE_IN_EXPO = 1
@ -54,7 +55,7 @@ class Animator(GObject.GObject):
self.stop() self.stop()
self._start_time = time.time() self._start_time = time.time()
self._timeout_sid = GObject.timeout_add( self._timeout_sid = GLib.timeout_add(
int(self._interval * 1000), self._next_frame_cb) int(self._interval * 1000), self._next_frame_cb)
def stop(self): def stop(self):

@ -29,6 +29,7 @@ import math
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
from gi.repository import SugarGestures from gi.repository import SugarGestures
from sugar3.graphics import palettegroup from sugar3.graphics import palettegroup
@ -429,7 +430,7 @@ class MouseSpeedDetector(GObject.GObject):
self.stop() self.stop()
self._mouse_pos = self._get_mouse_position() self._mouse_pos = self._get_mouse_position()
self._timeout_hid = GObject.timeout_add(self._delay, self._timer_cb) self._timeout_hid = GLib.timeout_add(self._delay, self._timer_cb)
def stop(self): def stop(self):
if self._timeout_hid is not None: if self._timeout_hid is not None:

@ -21,6 +21,7 @@ STABLE.
""" """
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GdkX11 from gi.repository import GdkX11
from gi.repository import Gtk from gi.repository import Gtk
@ -161,7 +162,7 @@ class Window(Gtk.Window):
self._unfullscreen_button_timeout_id = None self._unfullscreen_button_timeout_id = None
self._unfullscreen_button_timeout_id = \ self._unfullscreen_button_timeout_id = \
GObject.timeout_add_seconds( \ GLib.timeout_add_seconds( \
_UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \ _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \
self.__unfullscreen_button_timeout_cb) self.__unfullscreen_button_timeout_cb)
@ -285,7 +286,7 @@ class Window(Gtk.Window):
self._unfullscreen_button_timeout_id = None self._unfullscreen_button_timeout_id = None
self._unfullscreen_button_timeout_id = \ self._unfullscreen_button_timeout_id = \
GObject.timeout_add_seconds( \ GLib.timeout_add_seconds( \
_UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \ _UNFULLSCREEN_BUTTON_VISIBILITY_TIMEOUT, \
self.__unfullscreen_button_timeout_cb) self.__unfullscreen_button_timeout_cb)

@ -20,7 +20,7 @@ Test the sugar3.graphics.progressicon.ProgressIcon widget.
""" """
from gi.repository import GObject from gi.repository import GLib
from sugar3.graphics.progressicon import ProgressIcon from sugar3.graphics.progressicon import ProgressIcon
from sugar3.graphics import style from sugar3.graphics import style
@ -59,7 +59,7 @@ def timeout_cb():
return False return False
return True return True
GObject.timeout_add(50, timeout_cb) GLib.timeout_add(50, timeout_cb)
if __name__ == '__main__': if __name__ == '__main__':
common.main(test) common.main(test)

Loading…
Cancel
Save