Skip to content

Commit

Permalink
Revert "Order imports with isort"
Browse files Browse the repository at this point in the history
This reverts commit 28a5e76.
It broke 423950b, noqa-marked imports and the import ordering rules in `gui/application.py`.
Unfortunately, imports are just too full of side-effect to have them sorted automatically.
  • Loading branch information
jtojnar committed Sep 22, 2024
1 parent 891e797 commit 4a091c9
Show file tree
Hide file tree
Showing 132 changed files with 953 additions and 710 deletions.
1 change: 1 addition & 0 deletions desktop/mypaint-ora-thumbnailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import gi


gi.require_version("GdkPixbuf", "2.0")
try:
from lib.gibindings import GdkPixbuf
Expand Down
10 changes: 6 additions & 4 deletions doc/spectral/rgb_to_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@

# !pip install git+git://github.com/colour-science/colour


import colour
import numpy as np
from scipy.optimize import minimize


from colour.colorimetry import (
STANDARD_OBSERVERS_CMFS,
SpectralDistribution,
SpectralShape,
sd_ones,
sd_zeros,
spectral_to_XYZ_integration,
sd_zeros,
)
from colour.utilities import from_range_100, to_domain_1
from scipy.optimize import minimize
from colour.utilities import to_domain_1, from_range_100


# could use straight Meng but we can do Chromatic Adaptation via the illuminant_SPD instead
# this is Meng modified to be more similar to Scott Allen Burns least log slope squared method
Expand Down
9 changes: 6 additions & 3 deletions gui/accelmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
import logging
import re

import lib.xml
from lib.gettext import C_
from lib.gibindings import Gtk
from lib.gibindings import Gdk
from lib.gibindings import Pango
from lib.gettext import gettext as _
from lib.gibindings import Gdk, Gtk, Pango
from lib.gettext import C_

import lib.xml
from lib.pycompat import unicode

logger = logging.getLogger(__name__)
Expand Down
98 changes: 52 additions & 46 deletions gui/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,68 +28,74 @@
# guess GTK is caching something internally, like GLib's g_get_*_dir()
# stuff, but wtf is libmypaint doing to break those?

import json
import logging
import os
import sys
from os.path import join
from collections import namedtuple
import logging
import json

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 _
from os.path import join

import gui.autorecover
import gui.compatibility as compat
import gui.cursor
import gui.device
import gui.factoryaction # registration only
import gui.picker
import gui.profiling
import gui.userconfig
import lib.observable
import lib.cache
import lib.config
import lib.document
import lib.fileutils
import lib.glib
import lib.observable
import lib.strokemap
import lib.xml
from lib import brush, brushsettings, helpers, mypaintlib, validation
from lib.gibindings import Gdk, GdkPixbuf, GLib, GObject, Gtk
from lib.pycompat import unicode

from . import accelmap # noqa: F401
from . import colorpreview # noqa: F401
from . import colors # noqa: F401
from . import colortools # noqa: F401
from lib import brush
from lib import helpers
from lib import mypaintlib
from lib import brushsettings
from lib import validation
import gui.compatibility as compat
import gui.device
from . import filehandling
from . import keyboard
from . import brushmanager
from . import document
from . import tileddrawwidget
from . import workspace # noqa: F401
from . import topbar # noqa: F401
from . import drawwindow # noqa: F401
from . import fill # noqa: F401
from . import framewindow # noqa: F401
from . import history # noqa: F401
from . import backgroundwindow
from . import preferenceswindow
from . import brusheditor
from . import layerswindow # noqa: F401
from . import optionspanel # noqa: F401
from . import previewwindow # noqa: F401
from . import optionspanel # noqa: F401
from . import framewindow # noqa: F401
from . import scratchwindow # noqa: F401
from . import inputtestwindow
from . import brushiconeditor
from . import history # noqa: F401
from . import colortools # noqa: F401
from . import brushmodifier
from . import blendmodehandler
from . import toolbar # noqa: F401
from . import topbar # noqa: F401
from . import workspace # noqa: F401
from . import (
backgroundwindow,
blendmodehandler,
brusheditor,
brushiconeditor,
brushmanager,
brushmodifier,
document,
filehandling,
inputtestwindow,
keyboard,
linemode,
preferenceswindow,
tileddrawwidget,
)
from . import linemode
from . import colors # noqa: F401
from . import colorpreview # noqa: F401
from . import fill # noqa: F401
from . import accelmap # noqa: F401
from .brushcolor import BrushColorManager
from .buttonmap import ButtonMapping
from .overlays import LastPaintPosOverlay # noqa: F401
from .overlays import ScaleOverlay # noqa: F401
from .buttonmap import ButtonMapping
import lib.config
import lib.glib
import gui.cursor
import lib.fileutils
import gui.picker
import gui.userconfig
import gui.factoryaction # registration only
import gui.autorecover
import lib.xml
import gui.profiling
from lib.pycompat import unicode

logger = logging.getLogger(__name__)

Expand Down
11 changes: 6 additions & 5 deletions gui/autorecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@

"""Autorecovery UI"""

import logging
import os.path
import shutil
import weakref
import os.path
from gettext import gettext as _
import shutil
import logging

from lib.gibindings import Gtk

import lib.document
import lib.errors
import lib.helpers
from lib.gibindings import Gtk
import lib.errors
from lib.pycompat import unicode

logger = logging.getLogger(__name__)
Expand Down
16 changes: 10 additions & 6 deletions gui/backgroundwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@

## Imports

import logging
import os
import sys
import logging

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

from . import pixbuflist
from . import windowing
from lib import tiledsurface
from lib import helpers
import lib.pixbuf
from lib import helpers, tiledsurface
from lib.gibindings import GdkPixbuf, Gtk
from lib.pycompat import unicode, xrange

from . import pixbuflist, windowing
from lib.pycompat import unicode
from lib.pycompat import xrange

logger = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions gui/brushcolor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

"""Brush color changer."""

import lib.color

from . import colors
import lib.color


class BrushColorManager(colors.ColorManager):
Expand Down
18 changes: 11 additions & 7 deletions gui/brusheditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,28 @@

# Imports:

import logging
import os
import logging

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

import lib.brush
from lib import brushsettings
from lib.gettext import C_
from lib.gibindings import GdkPixbuf, GLib, Gtk, Pango
from lib import brushsettings
from lib.pycompat import iteritems, itervalues

from . import brushmanager
from . import curve as notuseddirectly # noqa - needed for interactive testing
import lib.brush
from . import dialogs
from . import brushmanager
from .builderhacks import add_objects_from_template_string
from .windowing import SubWindow
from . import curve as notuseddirectly # noqa - needed for interactive testing

# The widget class needs to be in scope before it is
# instantiated via the loading of the glade file.
from .sliderwidget import InputSlider # noqa
from .windowing import SubWindow

logger = logging.getLogger(__name__)

Expand Down
12 changes: 8 additions & 4 deletions gui/brushiconeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
import logging
from gettext import gettext as _

from lib.gibindings import Gtk
from lib.gibindings import GLib

from . import tileddrawwidget
from . import windowing
import lib.document
from gui.document import CanvasController
from lib.gibindings import GLib, Gtk
from lib.observable import event

from . import brushmanager, drawutils, tileddrawwidget, windowing
from .freehand import FreehandMode
from . import brushmanager
from lib.observable import event
from . import drawutils

logger = logging.getLogger(__name__)

Expand Down
35 changes: 20 additions & 15 deletions gui/brushmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,33 @@

## Imports

import contextlib
import logging
from itertools import chain
import os
import shutil
import uuid
import zipfile
from itertools import chain
from os.path import basename
from warnings import warn
import logging
import shutil
import uuid
import contextlib

import gui.mode
import lib.config
import lib.pixbuf
from lib.brush import BrushInfo
from lib.gettext import C_
from lib.gettext import gettext as _
from lib.gibindings import GdkPixbuf, Gtk
from lib.gettext import C_
from lib.helpers import utf8
from lib.observable import event
from lib.pycompat import PY3, unicode, xrange

from . import dialogs, drawutils
from lib.gibindings import Gtk
from lib.gibindings import GdkPixbuf

from . import dialogs
from lib.brush import BrushInfo
from lib.observable import event
import lib.pixbuf
from . import drawutils
import gui.mode
import lib.config
from lib.pycompat import unicode
from lib.pycompat import xrange
from lib.pycompat import PY3

if PY3:
import urllib.parse
Expand Down Expand Up @@ -263,8 +268,8 @@ def _mock(cls):
any zipfile.Zipfile()s you open, even for read.
"""
from shutil import rmtree
from tempfile import mkdtemp
from shutil import rmtree

dist_brushes = lib.config.mypaint_brushdir
tmp_user_brushes = mkdtemp(suffix="_brushes")
Expand Down
5 changes: 3 additions & 2 deletions gui/brushmanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

from math import ceil, hypot, log, pi

import gui.mode
import gui.overlays
import gui.mode

from lib.brush import brush_visual_radius
from lib.gettext import C_
from lib.gibindings import Gdk
from lib.gettext import C_


class BrushSizeOverlay(gui.overlays.Overlay):
Expand Down
2 changes: 1 addition & 1 deletion gui/brushmodifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# (at your option) any later version.

from gettext import gettext as _
from lib.helpers import rgb_to_hsv, hsv_to_rgb

import gui.blendmodehandler
from lib.helpers import hsv_to_rgb, rgb_to_hsv


class BrushModifier(object):
Expand Down
13 changes: 10 additions & 3 deletions gui/brushselectionwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@

import logging

from lib.gettext import C_, ngettext
from lib.gibindings import GdkPixbuf, GLib, Gtk
from lib.gibindings import Gtk
from lib.gibindings import GdkPixbuf
from lib.gibindings import GLib

from . import brushmanager, dialogs, pixbuflist, widgets
from lib.gettext import C_
from lib.gettext import ngettext

from . import pixbuflist
from . import dialogs
from . import brushmanager
from .toolstack import SizedVBoxToolWidget
from . import widgets

logger = logging.getLogger(__name__)

Expand Down
Loading

0 comments on commit 4a091c9

Please sign in to comment.