Skip to content

Commit

Permalink
Import all gi bindings via lib.gibindings
Browse files Browse the repository at this point in the history
Ensures that the correct version of bindings are specified before
any binding is imported, even when modules are loaded individually.

This was previously done with an initial import of lib/gichecks.py
but only ensured correct versions when running from main.py.
  • Loading branch information
jplloyd committed May 15, 2020
1 parent 1aa0223 commit 8c7015e
Show file tree
Hide file tree
Showing 89 changed files with 200 additions and 198 deletions.
2 changes: 1 addition & 1 deletion desktop/mypaint-ora-thumbnailer.py
Expand Up @@ -32,7 +32,7 @@

gi.require_version("GdkPixbuf", "2.0")
try:
from gi.repository import GdkPixbuf
from lib.gibindings import GdkPixbuf
except:
raise

Expand Down
6 changes: 3 additions & 3 deletions gui/accelmap.py
Expand Up @@ -14,9 +14,9 @@
from __future__ import division, print_function
import logging

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import Pango
from lib.gettext import gettext as _

import lib.xml
Expand Down
10 changes: 5 additions & 5 deletions gui/application.py
Expand Up @@ -37,11 +37,11 @@
import logging
import json

from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GLib
from lib.gibindings import GObject
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import GdkPixbuf
from lib.gibindings import GLib
from gettext import gettext as _

import lib.observable
Expand Down
2 changes: 1 addition & 1 deletion gui/autorecover.py
Expand Up @@ -16,7 +16,7 @@
import shutil
import logging

from gi.repository import Gtk
from lib.gibindings import Gtk

import lib.document
import lib.helpers
Expand Down
4 changes: 2 additions & 2 deletions gui/backgroundwindow.py
Expand Up @@ -17,8 +17,8 @@
import logging

from gettext import gettext as _
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from lib.gibindings import Gtk
from lib.gibindings import GdkPixbuf

from . import pixbuflist
from . import windowing
Expand Down
8 changes: 4 additions & 4 deletions gui/brusheditor.py
Expand Up @@ -18,10 +18,10 @@
import os
import logging

from gi.repository import Gtk
from gi.repository import Pango
from gi.repository import GLib
from gi.repository import GdkPixbuf
from lib.gibindings import Gtk
from lib.gibindings import Pango
from lib.gibindings import GLib
from lib.gibindings import GdkPixbuf

from lib.gettext import C_
from lib import brushsettings
Expand Down
4 changes: 2 additions & 2 deletions gui/brushiconeditor.py
Expand Up @@ -12,8 +12,8 @@
import logging
from gettext import gettext as _

from gi.repository import Gtk
from gi.repository import GLib
from lib.gibindings import Gtk
from lib.gibindings import GLib

from . import tileddrawwidget
from . import windowing
Expand Down
4 changes: 2 additions & 2 deletions gui/brushmanager.py
Expand Up @@ -28,8 +28,8 @@
from lib.gettext import C_
from lib.helpers import utf8

from gi.repository import Gtk
from gi.repository import GdkPixbuf
from lib.gibindings import Gtk
from lib.gibindings import GdkPixbuf

from . import dialogs
from lib.brush import BrushInfo
Expand Down
6 changes: 3 additions & 3 deletions gui/brushselectionwindow.py
Expand Up @@ -20,9 +20,9 @@
from __future__ import division, print_function
import logging

from gi.repository import Gtk
from gi.repository import GdkPixbuf
from gi.repository import GLib
from lib.gibindings import Gtk
from lib.gibindings import GdkPixbuf
from lib.gibindings import GLib

from lib.gettext import C_
from lib.gettext import ngettext
Expand Down
2 changes: 1 addition & 1 deletion gui/builderhacks.py
Expand Up @@ -13,7 +13,7 @@
## Imports
from __future__ import division, print_function

from gi.repository import Gtk
from lib.gibindings import Gtk

import lib.xml

Expand Down
8 changes: 4 additions & 4 deletions gui/buttonmap.py
Expand Up @@ -12,10 +12,10 @@
from gettext import gettext as _
import logging

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject
from gi.repository import Pango
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import GObject
from lib.gibindings import Pango

import lib.xml
from . import widgets
Expand Down
8 changes: 4 additions & 4 deletions gui/colors/adjbases.py
Expand Up @@ -20,10 +20,10 @@
import logging
from gettext import gettext as _

from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from lib.gibindings import GObject
from lib.gibindings import Gdk
from lib.gibindings import Gtk
from lib.gibindings import GdkPixbuf
import cairo

from .util import clamp
Expand Down
4 changes: 2 additions & 2 deletions gui/colors/bases.py
Expand Up @@ -14,8 +14,8 @@
import logging
logger = logging.getLogger(__name__)

from gi.repository import Gtk
from gi.repository import Gdk
from lib.gibindings import Gtk
from lib.gibindings import Gdk
import cairo


Expand Down
6 changes: 3 additions & 3 deletions gui/colors/changers.py
Expand Up @@ -13,8 +13,8 @@
## Imports
from __future__ import division, print_function

from gi.repository import GdkPixbuf
from gi.repository import Gdk
from lib.gibindings import GdkPixbuf
from lib.gibindings import Gdk

import lib.color
import gui.colors
Expand Down Expand Up @@ -123,7 +123,7 @@ class Rings (_CColorChanger):


if __name__ == '__main__':
from gi.repository import Gtk
from lib.gibindings import Gtk
import os
import sys
mgr = gui.colors.ColorManager(prefs={}, datapath='.')
Expand Down
4 changes: 2 additions & 2 deletions gui/colors/hcywheel.py
Expand Up @@ -18,8 +18,8 @@
import re
import os.path

from gi.repository import Gtk
from gi.repository import Gdk
from lib.gibindings import Gtk
from lib.gibindings import Gdk
import cairo

from .adjbases import ColorManager
Expand Down
2 changes: 1 addition & 1 deletion gui/colors/hsvcube.py
Expand Up @@ -16,7 +16,7 @@
from gettext import gettext as _

import cairo
from gi.repository import Gtk
from lib.gibindings import Gtk

from .util import clamp
from .util import draw_marker_circle
Expand Down
2 changes: 1 addition & 1 deletion gui/colors/hsvsquare.py
Expand Up @@ -15,7 +15,7 @@
import math
from gettext import gettext as _

from gi.repository import Gtk
from lib.gibindings import Gtk
import cairo

from .util import clamp
Expand Down
4 changes: 2 additions & 2 deletions gui/colors/hsvwheel.py
Expand Up @@ -14,8 +14,8 @@

from gettext import gettext as _

from gi.repository import Gtk
from gi.repository import Gdk
from lib.gibindings import Gtk
from lib.gibindings import Gdk

from .adjbases import HueSaturationWheelAdjuster
from .sliders import HSVValueSlider
Expand Down
6 changes: 3 additions & 3 deletions gui/colors/paletteview.py
Expand Up @@ -24,9 +24,9 @@
import logging
from io import open

from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import GLib
from lib.gibindings import Gdk
from lib.gibindings import Gtk
from lib.gibindings import GLib
import cairo
from lib.gettext import C_

Expand Down
2 changes: 1 addition & 1 deletion gui/colors/sliders.py
Expand Up @@ -12,7 +12,7 @@

from __future__ import division, print_function

from gi.repository import Gtk
from lib.gibindings import Gtk

from lib.color import RGBColor
from lib.color import HSVColor
Expand Down
2 changes: 1 addition & 1 deletion gui/colors/uimisc.py
Expand Up @@ -12,7 +12,7 @@

from __future__ import division, print_function

from gi.repository import Gtk
from lib.gibindings import Gtk


## Layout constants ##
Expand Down
2 changes: 1 addition & 1 deletion gui/colortools.py
Expand Up @@ -11,7 +11,7 @@

from __future__ import division, print_function

from gi.repository import Gtk
from lib.gibindings import Gtk

from lib.gettext import C_

Expand Down
2 changes: 1 addition & 1 deletion gui/compatibility.py
Expand Up @@ -9,7 +9,7 @@

from logging import getLogger

from gi.repository import Gtk
from lib.gibindings import Gtk

from . import compatconfig as config

Expand Down
6 changes: 3 additions & 3 deletions gui/cursor.py
Expand Up @@ -15,9 +15,9 @@
import gui.drawutils
from lib.pycompat import xrange

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import GdkPixbuf

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion gui/curve.py
Expand Up @@ -13,7 +13,7 @@
import logging
from math import pi

from gi.repository import Gtk, Gdk
from lib.gibindings import Gtk, Gdk

from lib.helpers import clamp

Expand Down
6 changes: 3 additions & 3 deletions gui/device.py
Expand Up @@ -18,9 +18,9 @@
import re

from lib.gettext import C_
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import Pango

from lib.observable import event
import gui.application
Expand Down
6 changes: 3 additions & 3 deletions gui/dialogs.py
Expand Up @@ -13,9 +13,9 @@
## Imports
from __future__ import division, print_function

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import GdkPixbuf

from gettext import gettext as _
from fnmatch import fnmatch
Expand Down
6 changes: 3 additions & 3 deletions gui/document.py
Expand Up @@ -25,9 +25,9 @@
import weakref
import logging

from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import GLib

import lib.document
import lib.layer
Expand Down
6 changes: 3 additions & 3 deletions gui/drawutils.py
Expand Up @@ -28,9 +28,9 @@

import numpy
import cairo
from gi.repository import GdkPixbuf
from gi.repository import Gdk
from gi.repository import Gtk
from lib.gibindings import GdkPixbuf
from lib.gibindings import Gdk
from lib.gibindings import Gtk

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions gui/drawwindow.py
Expand Up @@ -26,8 +26,8 @@
import math
import xml.etree.ElementTree as ET

from gi.repository import Gtk
from gi.repository import Gdk
from lib.gibindings import Gtk
from lib.gibindings import Gdk

from . import compatibility
from . import historypopup
Expand Down
6 changes: 3 additions & 3 deletions gui/externalapp.py
Expand Up @@ -24,9 +24,9 @@
from lib.gettext import C_
from lib.layer.core import LayerBase # noqa

from gi.repository import Gio
from gi.repository import Pango
from gi.repository import Gtk
from lib.gibindings import Gio
from lib.gibindings import Pango
from lib.gibindings import Gtk

import lib.xml

Expand Down
4 changes: 2 additions & 2 deletions gui/factoryaction.py
Expand Up @@ -14,8 +14,8 @@
from warnings import warn

import gi
from gi.repository import Gtk
from gi.repository import GObject
from lib.gibindings import Gtk
from lib.gibindings import GObject


class FactoryAction (Gtk.Action):
Expand Down
4 changes: 2 additions & 2 deletions gui/filehandling.py
Expand Up @@ -23,8 +23,8 @@
from collections import OrderedDict
import time

from gi.repository import Gtk
from gi.repository import Pango
from lib.gibindings import Gtk
from lib.gibindings import Pango

from lib import helpers
from lib import fileutils
Expand Down

0 comments on commit 8c7015e

Please sign in to comment.