summaryrefslogtreecommitdiff
path: root/gi/overrides/Gtk.py
diff options
context:
space:
mode:
Diffstat (limited to 'gi/overrides/Gtk.py')
-rw-r--r--gi/overrides/Gtk.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index d1ed83da..35d5fcb9 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -21,18 +21,13 @@
import sys
import warnings
-
-if sys.version_info[0] == 2:
- import collections as abc
-else:
- from collections import abc
+from collections import abc
from gi.repository import GObject
from .._ossighelper import wakeup_on_signal, register_sigint_fallback
from .._gtktemplate import Template
from ..overrides import override, strip_boolean_result, deprecated_init
from ..module import get_introspection_module
-from .._compat import string_types
from gi import PyGIDeprecationWarning
@@ -409,7 +404,7 @@ if Gtk._version in ("2.0", "3.0"):
class UIManager(Gtk.UIManager):
def add_ui_from_string(self, buffer):
- if not isinstance(buffer, string_types):
+ if not isinstance(buffer, str):
raise TypeError('buffer must be a string')
length = _get_utf8_length(buffer)
@@ -463,7 +458,7 @@ if Gtk._version in ("2.0", "3.0"):
def _get_utf8_length(string):
- assert isinstance(string, string_types)
+ assert isinstance(string, str)
if not isinstance(string, bytes):
string = string.encode("utf-8")
return len(string)
@@ -485,7 +480,7 @@ class Builder(Gtk.Builder):
self.connect_signals_full(_builder_connect_callback, obj_or_map)
def add_from_string(self, buffer):
- if not isinstance(buffer, string_types):
+ if not isinstance(buffer, str):
raise TypeError('buffer must be a string')
length = _get_utf8_length(buffer)
@@ -493,7 +488,7 @@ class Builder(Gtk.Builder):
return Gtk.Builder.add_from_string(self, buffer, length)
def add_objects_from_string(self, buffer, object_ids):
- if not isinstance(buffer, string_types):
+ if not isinstance(buffer, str):
raise TypeError('buffer must be a string')
length = _get_utf8_length(buffer)
@@ -759,7 +754,7 @@ class TextBuffer(Gtk.TextBuffer):
Gtk.TextBuffer.set_text(self, text, length)
def insert(self, iter, text, length=-1):
- if not isinstance(text, string_types):
+ if not isinstance(text, str):
raise TypeError('text must be a string, not %s' % type(text))
Gtk.TextBuffer.insert(self, iter, text, length)
@@ -788,7 +783,7 @@ class TextBuffer(Gtk.TextBuffer):
self.insert_with_tags(iter, text, *tag_objs)
def insert_at_cursor(self, text, length=-1):
- if not isinstance(text, string_types):
+ if not isinstance(text, str):
raise TypeError('text must be a string, not %s' % type(text))
Gtk.TextBuffer.insert_at_cursor(self, text, length)
@@ -1209,7 +1204,7 @@ class TreePath(Gtk.TreePath):
def __new__(cls, path=0):
if isinstance(path, int):
path = str(path)
- elif not isinstance(path, string_types):
+ elif not isinstance(path, str):
path = ":".join(str(val) for val in path)
if len(path) == 0: