Geography : replace GObject.timeout_add by glib.timeout_add as it is deprecated

svn: r21342
This commit is contained in:
Serge Noiraud 2013-02-12 08:38:19 +00:00
parent 566c3fb32b
commit ef65c893ea
3 changed files with 10 additions and 7 deletions

View File

@ -33,6 +33,7 @@ import sys
import re
from gi.repository import GObject
import time
import glib
from math import pi
#-------------------------------------------------------------------------
@ -598,10 +599,10 @@ class GeoGraphyView(OsmGps, NavigationView):
and lvl < 18 ):
lvl += 1
self.osm.set_zoom(lvl)
GObject.timeout_add(50, self._autozoom_in, lvl,
glib.timeout_add(50, self._autozoom_in, lvl,
p1lat, p1lon, p2lat, p2lon)
else:
GObject.timeout_add(50, self._autozoom_out, lvl,
glib.timeout_add(50, self._autozoom_out, lvl,
p1lat, p1lon, p2lat, p2lon)
def _autozoom_out(self, lvl, p1lat, p1lon, p2lat, p2lon):
@ -613,7 +614,7 @@ class GeoGraphyView(OsmGps, NavigationView):
and lvl > 1 ):
lvl -= 1
self.osm.set_zoom(lvl)
GObject.timeout_add(50, self._autozoom_out, lvl,
glib.timeout_add(50, self._autozoom_out, lvl,
p1lat, p1lon, p2lat, p2lon)
else:
layer = self.get_selection_layer()
@ -640,7 +641,7 @@ class GeoGraphyView(OsmGps, NavigationView):
p2lat = self.end_selection.rlat
p2lon = self.end_selection.rlon
# We zoom in until at least one marker missing.
GObject.timeout_add(50, self._autozoom_in, level_start,
glib.timeout_add(50, self._autozoom_in, level_start,
p1lat, p1lon, p2lat, p2lon)
def _set_center_and_zoom(self):

View File

@ -38,6 +38,7 @@ from gi.repository import GObject
import time
import threading
from math import *
import glib
#-------------------------------------------------------------------------
#
@ -464,7 +465,7 @@ class GeoMoves(GeoGraphyView):
return
self.message_layer.add_message(_("All descendance for %s" % _nd.display(person)))
color = Gdk.color_parse(self._config.get('geography.color_base'))
GObject.timeout_add(int(self._config.get("geography.generation_interval")),
glib.timeout_add(int(self._config.get("geography.generation_interval")),
self.animate_moves, 0, person, color)
def animate_moves(self, index, person, color):
@ -532,7 +533,7 @@ class GeoMoves(GeoGraphyView):
time_to_wait = int(self._config.get("geography.generation_interval"))
self._create_markers()
# process next generation in a few milliseconds
GObject.timeout_add(time_to_wait, self.animate_moves,
glib.timeout_add(time_to_wait, self.animate_moves,
index+1, person, color)
else:
self.started = False

View File

@ -40,6 +40,7 @@ KEY_TAB = Gdk.KEY_Tab
import socket
from gi.repository import Gtk
from gi.repository import GObject
import glib
#-------------------------------------------------------------------------
#
@ -275,7 +276,7 @@ class GeoPerson(GeoGraphyView):
# in this case, stepyear is >= 9000
# large move means longitude or latitude differences greater than geography.maximum_lon_lat
# degrees.
GObject.timeout_add(self._config.get("geography.speed"), self.animate,
glib.timeout_add(self._config.get("geography.speed"), self.animate,
menu, marks, i, stepyear)
return False