From fc4057868724c90da8403e234c21ddeebec14b88 Mon Sep 17 00:00:00 2001 From: Josip Date: Wed, 2 Apr 2014 16:22:40 +0200 Subject: [PATCH] Fix PyGObject-3.11 DeprecationWarning GObject.idle_add() ==> GLib.idle_add() --- gramps/gen/plug/_gramplet.py | 8 ++++---- gramps/gui/editors/displaytabs/addrembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/altnameembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/attrembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/backrefmodel.py | 7 ++++--- gramps/gui/editors/displaytabs/citationembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/embeddedlist.py | 7 ++++--- gramps/gui/editors/displaytabs/eventembedlist.py | 3 ++- gramps/gui/editors/displaytabs/gallerytab.py | 3 ++- gramps/gui/editors/displaytabs/groupembeddedlist.py | 5 +++-- gramps/gui/editors/displaytabs/ldsembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/locationembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/nameembedlist.py | 3 ++- gramps/gui/editors/displaytabs/notetab.py | 3 ++- gramps/gui/editors/displaytabs/personeventembedlist.py | 5 +++-- gramps/gui/editors/displaytabs/personrefembedlist.py | 3 ++- gramps/gui/editors/displaytabs/placerefembedlist.py | 3 ++- gramps/gui/editors/displaytabs/repoembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/srcattrembedlist.py | 4 ++-- gramps/gui/editors/displaytabs/webembedlist.py | 3 ++- gramps/gui/editors/editfamily.py | 5 +++-- gramps/gui/widgets/validatedmaskedentry.py | 7 ++++--- 22 files changed, 55 insertions(+), 42 deletions(-) diff --git a/gramps/gen/plug/_gramplet.py b/gramps/gen/plug/_gramplet.py index 65ccbd211..3e0eccd85 100644 --- a/gramps/gen/plug/_gramplet.py +++ b/gramps/gen/plug/_gramplet.py @@ -285,7 +285,7 @@ class Gramplet(object): """ The main interface for running the :meth:`main` method. """ - from gi.repository import GObject + from gi.repository import GObject, GLib if ((not self.active or self.gui.gstate in ["closed", "minimized"] or not self.dbstate.open) and @@ -304,7 +304,7 @@ class Gramplet(object): self.interrupt() self._generator = self.main() self._pause = False - self._idle_id = GObject.idle_add(self._updater, + self._idle_id = GLib.idle_add(self._updater, priority=GObject.PRIORITY_LOW - 10) def _updater(self): @@ -361,9 +361,9 @@ class Gramplet(object): """ Resume the :meth:`main` method that has previously paused. """ - from gi.repository import GObject + from gi.repository import GObject, Glib self._pause = False - self._idle_id = GObject.idle_add(self._updater, + self._idle_id = GLib.idle_add(self._updater, priority=GObject.PRIORITY_LOW - 10) def update_all(self, *args): diff --git a/gramps/gui/editors/displaytabs/addrembedlist.py b/gramps/gui/editors/displaytabs/addrembedlist.py index c13dadaac..b200a24f8 100644 --- a/gramps/gui/editors/displaytabs/addrembedlist.py +++ b/gramps/gui/editors/displaytabs/addrembedlist.py @@ -31,7 +31,7 @@ Address List display tab. #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -124,7 +124,7 @@ class AddrEmbedList(EmbeddedList): data = self.get_data() data.append(name) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): """ diff --git a/gramps/gui/editors/displaytabs/altnameembedlist.py b/gramps/gui/editors/displaytabs/altnameembedlist.py index 649c55762..a5ad8d0bd 100644 --- a/gramps/gui/editors/displaytabs/altnameembedlist.py +++ b/gramps/gui/editors/displaytabs/altnameembedlist.py @@ -25,7 +25,7 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -74,7 +74,7 @@ class AltNameEmbedList(EmbeddedList): def add_callback(self, place_name): data = self.get_data() self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): place_name = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/attrembedlist.py b/gramps/gui/editors/displaytabs/attrembedlist.py index 867050c7d..1d4467b3a 100644 --- a/gramps/gui/editors/displaytabs/attrembedlist.py +++ b/gramps/gui/editors/displaytabs/attrembedlist.py @@ -27,7 +27,7 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -108,7 +108,7 @@ class AttrEmbedList(EmbeddedList): data.append(name) self.changed = True self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data)-1) + GLib.idle_add(self.tree.scroll_to_cell, len(data)-1) def edit_button_clicked(self, obj): attr = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/backrefmodel.py b/gramps/gui/editors/displaytabs/backrefmodel.py index 0aeb2a2a2..2ab8bf11a 100644 --- a/gramps/gui/editors/displaytabs/backrefmodel.py +++ b/gramps/gui/editors/displaytabs/backrefmodel.py @@ -30,6 +30,7 @@ import sys #------------------------------------------------------------------------- from gi.repository import GObject from gi.repository import Gtk +from gi.repository import GLib from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext @@ -57,9 +58,9 @@ class BackRefModel(Gtk.ListStore): self.sref_list = sref_list self.count = 0 if sys.version_info[0] < 3: - self.idle = GObject.idle_add(self.load_model().next) + self.idle = GLib.idle_add(self.load_model().next) else: - self.idle = GObject.idle_add(self.load_model().__next__) + self.idle = GLib.idle_add(self.load_model().__next__) def destroy(self): GObject.source_remove(self.idle) @@ -68,7 +69,7 @@ class BackRefModel(Gtk.ListStore): """ Objects can have very large backreferences. To avoid blocking the interface up to the moment that the model is created, this method is - called via GObject.idle_add. + called via GLib.idle_add. WARNING: a consequence of above is that loading can still be happening while the GUI using this model is no longer used. Disconnect any methods before closing the GUI. diff --git a/gramps/gui/editors/displaytabs/citationembedlist.py b/gramps/gui/editors/displaytabs/citationembedlist.py index 1bf865c90..48bb61a7f 100644 --- a/gramps/gui/editors/displaytabs/citationembedlist.py +++ b/gramps/gui/editors/displaytabs/citationembedlist.py @@ -36,7 +36,7 @@ LOG = logging.getLogger(".citation") # GTK/Gnome modules # #------------------------------------------------------------------------- -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -152,7 +152,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement): self.callman.register_handles({'citation': [value]}) self.changed = True self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def share_button_clicked(self, obj): SelectCitation = SelectorFactory('Citation') diff --git a/gramps/gui/editors/displaytabs/embeddedlist.py b/gramps/gui/editors/displaytabs/embeddedlist.py index a7327caf6..bd897dba3 100644 --- a/gramps/gui/editors/displaytabs/embeddedlist.py +++ b/gramps/gui/editors/displaytabs/embeddedlist.py @@ -40,6 +40,7 @@ else: # #------------------------------------------------------------------------- from gi.repository import GObject +from gi.repository import GLib from gi.repository import Gdk from gi.repository import Gtk from gi.repository import Pango @@ -346,7 +347,7 @@ class EmbeddedList(ButtonTab): self.tree.get_selection().select_path(path) # The height/location of Gtk.treecells is calculated in an idle handler # so use idle_add to scroll cell into view. - GObject.idle_add(self.tree.scroll_to_cell, path) + GLib.idle_add(self.tree.scroll_to_cell, path) def _move_down(self, row_from, obj, selmethod=None): """ @@ -364,7 +365,7 @@ class EmbeddedList(ButtonTab): #select the row path = '%d' % (row_from+1) self.tree.get_selection().select_path(path) - GObject.idle_add(self.tree.scroll_to_cell, path) + GLib.idle_add(self.tree.scroll_to_cell, path) def get_icon_name(self): """ @@ -599,7 +600,7 @@ class EmbeddedList(ButtonTab): self.dirty_selection = False self._selection_changed() if self.tree.get_realized(): - GObject.idle_add(self.tree.scroll_to_point, offset.x, offset.y) + GLib.idle_add(self.tree.scroll_to_point, offset.x, offset.y) self.post_rebuild(selectedpath) def post_rebuild(self, prebuildpath): diff --git a/gramps/gui/editors/displaytabs/eventembedlist.py b/gramps/gui/editors/displaytabs/eventembedlist.py index d8cc9854b..1299a9c0a 100644 --- a/gramps/gui/editors/displaytabs/eventembedlist.py +++ b/gramps/gui/editors/displaytabs/eventembedlist.py @@ -30,6 +30,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gi.repository import Gtk from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -290,7 +291,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList): self.callman.register_handles({'event': [primary.handle]}) self.changed = True self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, + GLib.idle_add(self.tree.scroll_to_cell, (self._WORKGROUP, len(data) - 1)) def object_edited(self, ref, event): diff --git a/gramps/gui/editors/displaytabs/gallerytab.py b/gramps/gui/editors/displaytabs/gallerytab.py index e34d39c84..e39c95fcd 100644 --- a/gramps/gui/editors/displaytabs/gallerytab.py +++ b/gramps/gui/editors/displaytabs/gallerytab.py @@ -51,6 +51,7 @@ from gi.repository import GdkPixbuf from gi.repository import Gtk from gi.repository import Pango from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -311,7 +312,7 @@ class GalleryTab(ButtonTab, DbGUIElement): itr_last = model.iter_nth_child(None, len(data) - 1) if itr_last: path = model.get_path(itr_last) - GObject.idle_add(self.iconlist.scroll_to_path, path, False, + GLib.idle_add(self.iconlist.scroll_to_path, path, False, 0.0, 0.0) def __blocked_text(self): diff --git a/gramps/gui/editors/displaytabs/groupembeddedlist.py b/gramps/gui/editors/displaytabs/groupembeddedlist.py index 5ded22067..a5d83a767 100644 --- a/gramps/gui/editors/displaytabs/groupembeddedlist.py +++ b/gramps/gui/editors/displaytabs/groupembeddedlist.py @@ -41,6 +41,7 @@ from gi.repository import Gdk from gi.repository import Gtk from gi.repository import Pango from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # # GRAMPS classes @@ -320,7 +321,7 @@ class GroupEmbeddedList(EmbeddedList): #select the row path = (self._WORKGROUP, row_from[1]-1) self.tree.get_selection().select_path(path) - GObject.idle_add(self.tree.scroll_to_cell, path) + GLib.idle_add(self.tree.scroll_to_cell, path) else: self._move_up_notwork(row_from, obj, selmethod) @@ -353,7 +354,7 @@ class GroupEmbeddedList(EmbeddedList): #select the row path = (self._WORKGROUP, row_from[1]+1) self.tree.get_selection().select_path(path) - GObject.idle_add(self.tree.scroll_to_cell, path) + GLib.idle_add(self.tree.scroll_to_cell, path) else: self._move_down_notwork(row_from, obj, selmethod) diff --git a/gramps/gui/editors/displaytabs/ldsembedlist.py b/gramps/gui/editors/displaytabs/ldsembedlist.py index e9cb61956..ff0cb7125 100644 --- a/gramps/gui/editors/displaytabs/ldsembedlist.py +++ b/gramps/gui/editors/displaytabs/ldsembedlist.py @@ -27,7 +27,7 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -97,7 +97,7 @@ class LdsEmbedList(EmbeddedList): data = self.get_data() data.append(name) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): lds = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/locationembedlist.py b/gramps/gui/editors/displaytabs/locationembedlist.py index a2e576451..d3bc2640a 100644 --- a/gramps/gui/editors/displaytabs/locationembedlist.py +++ b/gramps/gui/editors/displaytabs/locationembedlist.py @@ -27,7 +27,7 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -86,7 +86,7 @@ class LocationEmbedList(EmbeddedList): data = self.get_data() data.append(name) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): loc = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/nameembedlist.py b/gramps/gui/editors/displaytabs/nameembedlist.py index 8d7db9b40..fe099bbfe 100644 --- a/gramps/gui/editors/displaytabs/nameembedlist.py +++ b/gramps/gui/editors/displaytabs/nameembedlist.py @@ -28,6 +28,7 @@ #------------------------------------------------------------------------- from gi.repository import Gtk from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -170,7 +171,7 @@ class NameEmbedList(GroupEmbeddedList): data = self.get_data()[self._WORKGROUP] data.append(name) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, + GLib.idle_add(self.tree.scroll_to_cell, (self._WORKGROUP, len(data) - 1)) def edit_button_clicked(self, obj): diff --git a/gramps/gui/editors/displaytabs/notetab.py b/gramps/gui/editors/displaytabs/notetab.py index 61e63d8c3..376a89d02 100644 --- a/gramps/gui/editors/displaytabs/notetab.py +++ b/gramps/gui/editors/displaytabs/notetab.py @@ -34,6 +34,7 @@ _ = glocale.translation.gettext # #------------------------------------------------------------------------- from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -149,7 +150,7 @@ class NoteTab(EmbeddedList, DbGUIElement): self.callman.register_handles({'note': [name]}) self.changed = True self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): """ diff --git a/gramps/gui/editors/displaytabs/personeventembedlist.py b/gramps/gui/editors/displaytabs/personeventembedlist.py index 50132bef8..39a826d22 100644 --- a/gramps/gui/editors/displaytabs/personeventembedlist.py +++ b/gramps/gui/editors/displaytabs/personeventembedlist.py @@ -29,6 +29,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -155,7 +156,7 @@ class PersonEventEmbedList(EventEmbedList): # New index is index-1 but for path, add another 1 for person events. path = (index,) self.tree.get_selection().select_path(path) - GObject.idle_add(self.tree.scroll_to_cell, path) + GLib.idle_add(self.tree.scroll_to_cell, path) def _move_down_group(self, groupindex): """ @@ -183,4 +184,4 @@ class PersonEventEmbedList(EventEmbedList): # New index is index+1 but for path, add another 1 for person events. path = (index + 2,) self.tree.get_selection().select_path(path) - GObject.idle_add(self.tree.scroll_to_cell, path) + GLib.idle_add(self.tree.scroll_to_cell, path) diff --git a/gramps/gui/editors/displaytabs/personrefembedlist.py b/gramps/gui/editors/displaytabs/personrefembedlist.py index dd3060eeb..26c28d449 100644 --- a/gramps/gui/editors/displaytabs/personrefembedlist.py +++ b/gramps/gui/editors/displaytabs/personrefembedlist.py @@ -28,6 +28,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -98,7 +99,7 @@ class PersonRefEmbedList(EmbeddedList): data = self.get_data() data.append(obj) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): from .. import EditPersonRef diff --git a/gramps/gui/editors/displaytabs/placerefembedlist.py b/gramps/gui/editors/displaytabs/placerefembedlist.py index 63269d70a..f06453c71 100644 --- a/gramps/gui/editors/displaytabs/placerefembedlist.py +++ b/gramps/gui/editors/displaytabs/placerefembedlist.py @@ -28,6 +28,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -86,7 +87,7 @@ class PlaceRefEmbedList(EmbeddedList): data = self.get_data() data.append(name) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): placeref = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/repoembedlist.py b/gramps/gui/editors/displaytabs/repoembedlist.py index 293f01375..bfbaa921e 100644 --- a/gramps/gui/editors/displaytabs/repoembedlist.py +++ b/gramps/gui/editors/displaytabs/repoembedlist.py @@ -27,7 +27,7 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -153,7 +153,7 @@ class RepoEmbedList(EmbeddedList, DbGUIElement): self.callman.register_handles({'repository': [value[1].handle]}) self.changed = True self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): ref = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/srcattrembedlist.py b/gramps/gui/editors/displaytabs/srcattrembedlist.py index 9ca5f9302..8f1045f30 100644 --- a/gramps/gui/editors/displaytabs/srcattrembedlist.py +++ b/gramps/gui/editors/displaytabs/srcattrembedlist.py @@ -27,7 +27,7 @@ #------------------------------------------------------------------------- from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext -from gi.repository import GObject +from gi.repository import GObject, GLib #------------------------------------------------------------------------- # @@ -145,7 +145,7 @@ class SrcAttrEmbedList(EmbeddedList): data.append(name) self.changed = True self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data)-1) + GLib.idle_add(self.tree.scroll_to_cell, len(data)-1) def edit_button_clicked(self, obj): attr = self.get_selected() diff --git a/gramps/gui/editors/displaytabs/webembedlist.py b/gramps/gui/editors/displaytabs/webembedlist.py index 1149bccb7..9c6bfc571 100644 --- a/gramps/gui/editors/displaytabs/webembedlist.py +++ b/gramps/gui/editors/displaytabs/webembedlist.py @@ -29,6 +29,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gi.repository import Gtk from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -96,7 +97,7 @@ class WebEmbedList(EmbeddedList): data = self.get_data() data.append(url) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, len(data) - 1) + GLib.idle_add(self.tree.scroll_to_cell, len(data) - 1) def edit_button_clicked(self, obj): from .. import EditUrl diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py index a45edc139..f41d70c03 100644 --- a/gramps/gui/editors/editfamily.py +++ b/gramps/gui/editors/editfamily.py @@ -60,6 +60,7 @@ from gi.repository import Gtk from gi.repository import Gdk from gi.repository import Pango from gi.repository import GObject +from gi.repository import GLib #------------------------------------------------------------------------- # @@ -204,7 +205,7 @@ class ChildEmbedList(EmbeddedList): ref.ref = person.get_handle() self.family.add_child_ref(ref) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, + GLib.idle_add(self.tree.scroll_to_cell, len(self.family.get_child_ref_list()) - 1) self.call_edit_childref(ref) @@ -226,7 +227,7 @@ class ChildEmbedList(EmbeddedList): ref.ref = person.get_handle() self.family.add_child_ref(ref) self.rebuild() - GObject.idle_add(self.tree.scroll_to_cell, + GLib.idle_add(self.tree.scroll_to_cell, len(self.family.get_child_ref_list()) - 1) self.call_edit_childref(ref) diff --git a/gramps/gui/widgets/validatedmaskedentry.py b/gramps/gui/widgets/validatedmaskedentry.py index 3d4c88896..5ab8602c9 100644 --- a/gramps/gui/widgets/validatedmaskedentry.py +++ b/gramps/gui/widgets/validatedmaskedentry.py @@ -42,6 +42,7 @@ _LOG = logging.getLogger(".widgets.validatedmaskedentry") # #------------------------------------------------------------------------- from gi.repository import GObject +from gi.repository import GLib from gi.repository import Gdk from gi.repository import Gtk from gi.repository import GdkPixbuf @@ -736,7 +737,7 @@ class MaskedEntry(UndoableEntry): if field is not False: pos = self.get_field_pos(field+1) if pos is not None: - GObject.idle_add(self.set_position, pos) + GLib.idle_add(self.set_position, pos) return pos return None @@ -795,11 +796,11 @@ class MaskedEntry(UndoableEntry): # text[pos+length:end]+ # text[end:]) new_pos = pos+1 - GObject.idle_add(self.set_position, new_pos) + GLib.idle_add(self.set_position, new_pos) # If the field is full, jump to the next field if len(self.get_field_text(field)) == self.get_field_length(field)-1: - GObject.idle_add(self.set_field, field+1, True) + GLib.idle_add(self.set_field, field+1, True) self.set_field(field+1) return new_pos, new_text