Skip to content

Commit

Permalink
Merge pull request #2826 from timovwb/master
Browse files Browse the repository at this point in the history
GTK3 backend: Replaced deprecated GObject calls with GLib
  • Loading branch information
tacaswell committed Feb 21, 2014
2 parents 292cddc + 1b3eee7 commit 84a8389
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/matplotlib/backends/backend_gtk3.py
Expand Up @@ -22,7 +22,7 @@ def fn_name(): return sys._getframe(1).f_code.co_name
"to be installed.")

try:
from gi.repository import Gtk, Gdk, GObject
from gi.repository import Gtk, Gdk, GObject, GLib
except ImportError:
raise ImportError("Gtk3 backend requires pygobject to be installed.")

Expand Down Expand Up @@ -92,11 +92,11 @@ def _timer_start(self):
# Need to stop it, otherwise we potentially leak a timer id that will
# never be stopped.
self._timer_stop()
self._timer = GObject.timeout_add(self._interval, self._on_timer)
self._timer = GLib.timeout_add(self._interval, self._on_timer)

def _timer_stop(self):
if self._timer is not None:
GObject.source_remove(self._timer)
GLib.source_remove(self._timer)
self._timer = None

def _timer_set_interval(self):
Expand Down Expand Up @@ -206,14 +206,14 @@ def __init__(self, figure):
self.set_double_buffered(True)
self.set_can_focus(True)
self._renderer_init()
self._idle_event_id = GObject.idle_add(self.idle_event)
self._idle_event_id = GLib.idle_add(self.idle_event)

def destroy(self):
#Gtk.DrawingArea.destroy(self)
self.close_event()
GObject.source_remove(self._idle_event_id)
GLib.source_remove(self._idle_event_id)
if self._idle_draw_id != 0:
GObject.source_remove(self._idle_draw_id)
GLib.source_remove(self._idle_draw_id)

def scroll_event(self, widget, event):
if _debug: print('FigureCanvasGTK3.%s' % fn_name())
Expand Down Expand Up @@ -329,7 +329,7 @@ def idle_draw(*args):
self._idle_draw_id = 0
return False
if self._idle_draw_id == 0:
self._idle_draw_id = GObject.idle_add(idle_draw)
self._idle_draw_id = GLib.idle_add(idle_draw)

def new_timer(self, *args, **kwargs):
"""
Expand Down

0 comments on commit 84a8389

Please sign in to comment.