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

svn: r21341
This commit is contained in:
Serge Noiraud 2013-02-12 08:33:49 +00:00
parent 8108adbef8
commit 18e1150010
3 changed files with 10 additions and 7 deletions

View File

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

View File

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

View File

@ -41,6 +41,7 @@ KEY_TAB = Gdk.KEY_Tab
import socket import socket
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GObject from gi.repository import GObject
import glib
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -276,7 +277,7 @@ class GeoPerson(GeoGraphyView):
# in this case, stepyear is >= 9000 # in this case, stepyear is >= 9000
# large move means longitude or latitude differences greater than geography.maximum_lon_lat # large move means longitude or latitude differences greater than geography.maximum_lon_lat
# degrees. # 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) menu, marks, i, stepyear)
return False return False