From bb9f9b6c2690f3894764a5a57e48654b67c8dea9 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 29 Aug 2019 09:48:48 +1000 Subject: [PATCH] gui: reshuffle the includes until gi and flake8 are happy We have implied inclusion orders here, specifically with gi. This works as long as the files are included in the right order from other files but its not generic enough - we really do need the gi.require_version() bit everywhere to avoid issues. Of course, once we do this flake8 complains about everything so let's reshuffle things in an order it's happy with. This seems to be local modules first, then ... whatever except when not? application.py is excluded from this patch because it's about to get changed in the next one and I'm too lazy to separate those out. Signed-off-by: Peter Hutterer --- tuhi/gui/drawing.py | 3 ++- tuhi/gui/drawingperspective.py | 4 ++-- tuhi/gui/window.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tuhi/gui/drawing.py b/tuhi/gui/drawing.py index af7f4ac..a2018da 100644 --- a/tuhi/gui/drawing.py +++ b/tuhi/gui/drawing.py @@ -12,7 +12,6 @@ # from gettext import gettext as _ -from gi.repository import GObject, Gtk, GdkPixbuf, Gdk import xdg.BaseDirectory import os @@ -22,6 +21,8 @@ from tuhi.svg import JsonSvg import gi gi.require_version("Gtk", "3.0") +from gi.repository import GObject, Gtk, GdkPixbuf, Gdk # NOQA + DATA_PATH = Path(xdg.BaseDirectory.xdg_cache_home, 'tuhi', 'svg') diff --git a/tuhi/gui/drawingperspective.py b/tuhi/gui/drawingperspective.py index ec47d36..d2f8faf 100644 --- a/tuhi/gui/drawingperspective.py +++ b/tuhi/gui/drawingperspective.py @@ -11,15 +11,15 @@ # GNU General Public License for more details. # -from gi.repository import GObject, Gtk from .drawing import Drawing from .config import Config import time -import gi import logging +import gi gi.require_version("Gtk", "3.0") +from gi.repository import GObject, Gtk # NOQA logger = logging.getLogger('tuhi.gui.drawingperspective') diff --git a/tuhi/gui/window.py b/tuhi/gui/window.py index 129c4a6..f6e9a68 100644 --- a/tuhi/gui/window.py +++ b/tuhi/gui/window.py @@ -11,16 +11,16 @@ # GNU General Public License for more details. # -from gettext import gettext as _ -from gi.repository import Gtk, Gio, GLib, GObject - from .drawingperspective import DrawingPerspective from .config import Config from tuhi.dbusclient import TuhiDBusClientManager +from gettext import gettext as _ import logging + import gi gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, Gio, GLib, GObject # NOQA logger = logging.getLogger('tuhi.gui.window')