diff --git a/.appveyor.yml b/.appveyor.yml index 037759c6..6ceeb22e 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,13 +8,14 @@ install: - choco install strawberryperl - copy %PYTHON%\python.exe %PYTHON%\python3.exe - SET PATH=%PYTHON%;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH% + - python3 -mpip install Pillow - python3 -mpip install flake8 - - python3 -mpip install random2 + - python3 -mpip install flake8-import-order - python3 -mpip install py2exe - python3 -mpip install pycotap - - python3 -mpip install six - - python3 -mpip install Pillow - python3 -mpip install pygame + - python3 -mpip install random2 + - python3 -mpip install six - perl -v - copy C:\msys64\mingw64\bin\mingw32-make.exe C:\msys64\mingw64\bin\make.exe - SET PATH=C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH% diff --git a/.travis.yml b/.travis.yml index e5c3cc82..c5b84c01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ before_install: install: - sudo cpanm Code::TidyAll::Plugin::Flake8 Perl::Tidy Test::Code::TidyAll Test::Differences Test::TrailingSpace - export PY_MODS='pycotap random2 six' - - "`which python3` -m pip install --upgrade flake8 $PY_MODS" + - "`which python3` -m pip install --upgrade flake8 flake8-import-order $PY_MODS" - "sudo /usr/bin/python3 -m pip install --upgrade $PY_MODS || true" - "sudo `which python2` -m pip install --upgrade $PY_MODS" - which python diff --git a/android/initsdk.py b/android/initsdk.py index e1d36c9a..edc5267a 100755 --- a/android/initsdk.py +++ b/android/initsdk.py @@ -1,15 +1,18 @@ #! /usr/bin/env python3 # -*- coding: iso-8859-1 -*- -import sys -import os -import requests -import logging -import hashlib import glob +import hashlib +import logging +import os +import sys from zipfile import ZipFile, ZipInfo + from clint.textui import progress +import requests + + cachefiles = [ ('https://dl.google.com/android/repository/platform-tools-latest-linux.zip', '', diff --git a/data/themes/clearlooks/create_imgs.py b/data/themes/clearlooks/create_imgs.py index 0022980c..f10a3f91 100755 --- a/data/themes/clearlooks/create_imgs.py +++ b/data/themes/clearlooks/create_imgs.py @@ -2,6 +2,7 @@ # -*- mode: python; coding: koi8-r; -*- import os + import gtk imdir = 'images' diff --git a/html-src/gen-html.py b/html-src/gen-html.py index 4ca1a5ba..3b40bdab 100755 --- a/html-src/gen-html.py +++ b/html-src/gen-html.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 -import sys -import os import builtins -from pysollib.mygettext import fix_gettext +import os +import sys from pysollib.gamedb import GAME_DB from pysollib.gamedb import GI from pysollib.mfxutil import latin1_normalize +from pysollib.mygettext import fix_gettext # outdir = '../html' pysollib_dir = '../' @@ -15,10 +15,10 @@ pysollib_dir = '../' builtins._ = lambda x: x builtins.n_ = lambda x: x -import pysollib.games # noqa: F402 +import pysollib.games # noqa: F402,I100,I202 import pysollib.games.mahjongg # noqa: F402 -import pysollib.games.ultra # noqa: F402 import pysollib.games.special # noqa: F401,F402 +import pysollib.games.ultra # noqa: F401,F402 try: os.mkdir('html') diff --git a/pysol.py b/pysol.py index 42b2d2ae..9e18defe 100755 --- a/pysol.py +++ b/pysol.py @@ -33,8 +33,7 @@ init() # HAS TO BE after call to init(). # See docs/README.SOURCE. # Flake8 test would complain here E402, so disabled - -from pysollib.main import main # noqa: E402 +from pysollib.main import main # noqa: E402,I202 # Execute it. # import profile diff --git a/pysollib/actions.py b/pysollib/actions.py index cbde8ebb..b75ad9ed 100644 --- a/pysollib/actions.py +++ b/pysollib/actions.py @@ -21,41 +21,34 @@ # # ---------------------------------------------------------------------------## - -# imports -import os import locale +import os -# PySol imports +from pysollib.gamedb import GI +from pysollib.help import help_about, help_html from pysollib.mfxutil import Struct, openURL from pysollib.mfxutil import print_err -from pysollib.pysolrandom import constructRandom -from pysollib.settings import TITLE, PACKAGE_URL -from pysollib.settings import TOP_TITLE -from pysollib.settings import DEBUG -from pysollib.gamedb import GI - -# stats imports -from pysollib.stats import FileStatsFormatter -from pysollib.pysoltk import SingleGame_StatsDialog, AllGames_StatsDialog -from pysollib.pysoltk import FullLog_StatsDialog, SessionLog_StatsDialog -from pysollib.pysoltk import Status_StatsDialog, Top_StatsDialog -from pysollib.pysoltk import ProgressionDialog -from pysollib.pysoltk import GameInfoDialog - -# toolkit imports from pysollib.mygettext import _ -from pysollib.pysoltk import MfxMessageDialog, MfxSimpleEntry -from pysollib.pysoltk import MfxExceptionDialog -from pysollib.pysoltk import PlayerOptionsDialog -from pysollib.pysoltk import TimeoutsDialog +from pysollib.pysolrandom import constructRandom +from pysollib.pysoltk import AllGames_StatsDialog, SingleGame_StatsDialog from pysollib.pysoltk import ColorsDialog -from pysollib.pysoltk import FontsDialog from pysollib.pysoltk import EditTextDialog +from pysollib.pysoltk import FontsDialog +from pysollib.pysoltk import FullLog_StatsDialog, SessionLog_StatsDialog +from pysollib.pysoltk import GameInfoDialog +from pysollib.pysoltk import MfxExceptionDialog +from pysollib.pysoltk import MfxMessageDialog, MfxSimpleEntry +from pysollib.pysoltk import PlayerOptionsDialog +from pysollib.pysoltk import ProgressionDialog +from pysollib.pysoltk import PysolMenubarTk, PysolToolbarTk +from pysollib.pysoltk import Status_StatsDialog, Top_StatsDialog +from pysollib.pysoltk import TimeoutsDialog from pysollib.pysoltk import create_find_card_dialog from pysollib.pysoltk import create_solver_dialog -from pysollib.pysoltk import PysolMenubarTk, PysolToolbarTk -from pysollib.help import help_about, help_html +from pysollib.settings import DEBUG +from pysollib.settings import PACKAGE_URL, TITLE +from pysollib.settings import TOP_TITLE +from pysollib.stats import FileStatsFormatter # ************************************************************************ diff --git a/pysollib/app.py b/pysollib/app.py index b6cab94e..5c3bcc93 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -28,37 +28,34 @@ import re import traceback from pickle import UnpicklingError -# PySol imports -from pysollib.mfxutil import destruct, Struct -from pysollib.mfxutil import pickle, unpickle -from pysollib.mfxutil import getusername, getprefdir -from pysollib.mfxutil import latin1_normalize, print_err -from pysollib.mfxutil import USE_PIL -from pysollib.util import CARDSET, IMAGE_EXTENSIONS -from pysollib.settings import PACKAGE, VERSION_TUPLE, WIN_SYSTEM -from pysollib.resource import CSI, CardsetConfig, Cardset, CardsetManager -from pysollib.resource import Tile, TileManager -from pysollib.resource import Sample, SampleManager -from pysollib.resource import Music, MusicManager +from pysollib.gamedb import GAME_DB, GI, loadGame from pysollib.images import Images, SubsampledImages -from pysollib.pysolrandom import PysolRandom -from pysollib.gamedb import GI, GAME_DB, loadGame -from pysollib.options import Options -from pysollib.settings import TOP_SIZE, TOOLKIT -from pysollib.settings import DEBUG -from pysollib.winsystems import TkSettings - -# Toolkit imports +from pysollib.mfxutil import Struct, destruct +from pysollib.mfxutil import USE_PIL +from pysollib.mfxutil import getprefdir, getusername +from pysollib.mfxutil import latin1_normalize, print_err +from pysollib.mfxutil import pickle, unpickle from pysollib.mygettext import _ -from pysollib.pysoltk import wm_withdraw, loadImage -from pysollib.pysoltk import MfxDialog, MfxMessageDialog, MfxExceptionDialog -from pysollib.pysoltk import TclError, MfxScrolledCanvas +from pysollib.options import Options +from pysollib.pysolrandom import PysolRandom +from pysollib.pysoltk import HTMLViewer +from pysollib.pysoltk import HelpStatusbar, PysolStatusbar +from pysollib.pysoltk import MfxDialog, MfxExceptionDialog, MfxMessageDialog +from pysollib.pysoltk import MfxScrolledCanvas, TclError from pysollib.pysoltk import PysolProgressBar -from pysollib.pysoltk import PysolStatusbar, HelpStatusbar from pysollib.pysoltk import SelectCardsetDialogWithPreview from pysollib.pysoltk import SelectDialogTreeData -from pysollib.pysoltk import HTMLViewer from pysollib.pysoltk import destroy_find_card_dialog +from pysollib.pysoltk import loadImage, wm_withdraw +from pysollib.resource import CSI, Cardset, CardsetConfig, CardsetManager +from pysollib.resource import Music, MusicManager +from pysollib.resource import Sample, SampleManager +from pysollib.resource import Tile, TileManager +from pysollib.settings import DEBUG +from pysollib.settings import PACKAGE, VERSION_TUPLE, WIN_SYSTEM +from pysollib.settings import TOOLKIT, TOP_SIZE +from pysollib.util import CARDSET, IMAGE_EXTENSIONS +from pysollib.winsystems import TkSettings if TOOLKIT == 'tk': from pysollib.ui.tktile.solverdialog import destroy_solver_dialog else: diff --git a/pysollib/configobj/configobj.py b/pysollib/configobj/configobj.py index 1546b362..0018205b 100644 --- a/pysollib/configobj/configobj.py +++ b/pysollib/configobj/configobj.py @@ -17,13 +17,14 @@ # Comments, suggestions and bug reports welcome. -import sys import os import re -import six - -from six import string_types +import sys from warnings import warn + +import six +from six import string_types + INTP_VER = sys.version_info[:2] if INTP_VER < (2, 2): raise RuntimeError("Python v.2.2 or later needed") diff --git a/pysollib/configobj/validate.py b/pysollib/configobj/validate.py index dea2a39f..46833a72 100644 --- a/pysollib/configobj/validate.py +++ b/pysollib/configobj/validate.py @@ -124,9 +124,10 @@ A badly formatted set of arguments will raise a ``VdtParamError``. """ -import sys -import six import re +import sys + +import six __docformat__ = "restructuredtext en" diff --git a/pysollib/customgame.py b/pysollib/customgame.py index 0f5c3df7..61d94dd1 100644 --- a/pysollib/customgame.py +++ b/pysollib/customgame.py @@ -21,28 +21,28 @@ # # ---------------------------------------------------------------------------## -import six -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, \ - KING, \ - UNLIMITED_MOVES -from pysollib.stack import Spider_AC_Foundation, \ +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import Yukon_Hint +from pysollib.layout import Layout +from pysollib.stack import \ AC_RowStack, \ BO_RowStack, \ DealReserveRedealTalonStack, \ DealRowRedealTalonStack, \ - RK_RowStack, \ GroundsForADivorceTalonStack, \ InitialDealTalonStack, \ OpenStack, \ + RK_RowStack, \ ReserveStack, \ + SC_RowStack, \ + SS_RowStack, \ + SpiderTalonStack, \ + Spider_AC_Foundation, \ Spider_AC_RowStack, \ Spider_RK_Foundation, \ Spider_SS_Foundation, \ Spider_SS_RowStack, \ - SpiderTalonStack, \ - SC_RowStack, \ - SS_RowStack, \ StackWrapper, \ SuperMoveAC_RowStack, \ SuperMoveBO_RowStack, \ @@ -56,14 +56,15 @@ from pysollib.stack import Spider_AC_Foundation, \ WasteStack, \ WasteTalonStack, \ Yukon_AC_RowStack, \ - Yukon_SS_RowStack, \ - Yukon_RK_RowStack -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import Yukon_Hint - + Yukon_RK_RowStack, \ + Yukon_SS_RowStack +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, \ + KING, \ + UNLIMITED_MOVES from pysollib.wizardutil import WizardWidgets +import six + # ************************************************************************ # * # ************************************************************************ diff --git a/pysollib/game.py b/pysollib/game.py index 14e1eba0..69d172a1 100644 --- a/pysollib/game.py +++ b/pysollib/game.py @@ -23,35 +23,35 @@ # imports -import time import math +import time import traceback -import six - -from pysollib.mygettext import _ -from gettext import ungettext -from six import BytesIO -from six.moves import range from pickle import Pickler, Unpickler, UnpicklingError -# PySol imports +from pysollib.gamedb import GI from pysollib.mfxutil import Image, ImageTk, USE_PIL -from pysollib.mfxutil import destruct, Struct, SubclassResponsibility -from pysollib.mfxutil import uclock, usleep +from pysollib.mfxutil import Struct, SubclassResponsibility, destruct from pysollib.mfxutil import format_time, print_err +from pysollib.mfxutil import uclock, usleep +from pysollib.mygettext import _ +from pysollib.mygettext import ungettext +from pysollib.pysolrandom import LCRandom31, PysolRandom, constructRandom, \ + random__long2str, random__str2long +from pysollib.pysoltk import CURSOR_WATCH +from pysollib.pysoltk import Card +from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE +from pysollib.pysoltk import MfxCanvasLine, MfxCanvasRectangle, MfxCanvasText +from pysollib.pysoltk import MfxExceptionDialog, MfxMessageDialog +from pysollib.pysoltk import after, after_cancel, after_idle +from pysollib.pysoltk import bind, wm_map +from pysollib.settings import DEBUG from pysollib.settings import PACKAGE, TITLE, TOOLKIT, TOP_TITLE from pysollib.settings import VERSION, VERSION_TUPLE -from pysollib.settings import DEBUG -from pysollib.gamedb import GI -from pysollib.pysolrandom import PysolRandom, LCRandom31, constructRandom, \ - random__long2str, random__str2long -from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE -from pysollib.pysoltk import CURSOR_WATCH -from pysollib.pysoltk import bind, wm_map -from pysollib.pysoltk import after, after_idle, after_cancel -from pysollib.pysoltk import MfxMessageDialog, MfxExceptionDialog -from pysollib.pysoltk import MfxCanvasText, MfxCanvasLine, MfxCanvasRectangle -from pysollib.pysoltk import Card + +import six +from six import BytesIO +from six.moves import range + if TOOLKIT == 'tk': from pysollib.ui.tktile.solverdialog import reset_solver_dialog else: diff --git a/pysollib/gamedb.py b/pysollib/gamedb.py index 2db4de12..06f21533 100644 --- a/pysollib/gamedb.py +++ b/pysollib/gamedb.py @@ -22,16 +22,14 @@ # ---------------------------------------------------------------------------## -# imports -import six import imp -# PySol imports -from pysollib.mfxutil import Struct, print_err -from pysollib.resource import CSI import pysollib.settings - +from pysollib.mfxutil import Struct, print_err from pysollib.mygettext import _, n_ +from pysollib.resource import CSI + +import six # ************************************************************************ # * constants diff --git a/pysollib/games/acesup.py b/pysollib/games/acesup.py index 8ec3f370..3ddaa15f 100644 --- a/pysollib/games/acesup.py +++ b/pysollib/games/acesup.py @@ -20,30 +20,25 @@ # along with this program. If not, see . # # --------------------------------------------------------------------------- - -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, NO_RANK, \ - UNLIMITED_ACCEPTS, \ - UNLIMITED_MOVES +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.montecarlo import MonteCarlo_RowStack +from pysollib.layout import Layout from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ DealRowTalonStack, \ - isRankSequence, \ OpenStack, \ - ReserveStack, \ RK_RowStack, \ - TalonStack, \ + ReserveStack, \ Spider_RK_Foundation, \ Stack, \ - StackWrapper -from pysollib.game import Game -from pysollib.layout import Layout - -from pysollib.games.montecarlo import MonteCarlo_RowStack + StackWrapper, \ + TalonStack, \ + isRankSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, NO_RANK, \ + UNLIMITED_ACCEPTS, \ + UNLIMITED_MOVES # ************************************************************************ diff --git a/pysollib/games/algerian.py b/pysollib/games/algerian.py index 9661db68..10996638 100644 --- a/pysollib/games/algerian.py +++ b/pysollib/games/algerian.py @@ -21,27 +21,24 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, KING +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout from pysollib.stack import \ DealRowTalonStack, \ ReserveStack, \ SS_FoundationStack, \ SS_RowStack, \ - UD_SS_RowStack, \ - StackWrapper -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint - + StackWrapper, \ + UD_SS_RowStack +from pysollib.util import ACE, KING # ************************************************************************ # * Carthage # ************************************************************************ + class Carthage_Talon(DealRowTalonStack): def dealCards(self, sound=False): if sound: diff --git a/pysollib/games/auldlangsyne.py b/pysollib/games/auldlangsyne.py index 323739b6..ee9692ef 100644 --- a/pysollib/games/auldlangsyne.py +++ b/pysollib/games/auldlangsyne.py @@ -21,31 +21,26 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.numerica import Numerica_Hint +from pysollib.layout import Layout from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, QUEEN from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ DealRowTalonStack, \ OpenStack, \ OpenTalonStack, \ + RK_FoundationStack, \ RedealTalonStack, \ ReserveStack, \ - RK_FoundationStack, \ SS_FoundationStack, \ Stack, \ StackWrapper, \ WasteStack, \ WasteTalonStack - -from pysollib.game import Game -from pysollib.layout import Layout - -from pysollib.games.numerica import Numerica_Hint +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, QUEEN # ************************************************************************ diff --git a/pysollib/games/bakersdozen.py b/pysollib/games/bakersdozen.py index 1f943f43..3fbee060 100644 --- a/pysollib/games/bakersdozen.py +++ b/pysollib/games/bakersdozen.py @@ -21,12 +21,12 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, KING, NO_RANK, UNLIMITED_ACCEPTS, \ - UNLIMITED_MOVES +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint +from pysollib.hint import FreeCellSolverWrapper +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -34,16 +34,13 @@ from pysollib.stack import \ RK_RowStack, \ SS_FoundationStack, \ SS_RowStack, \ + StackWrapper, \ SuperMoveAC_RowStack, \ TalonStack, \ UD_AC_RowStack, \ - UD_SS_RowStack, \ - StackWrapper -from pysollib.mfxutil import kwdefault -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.hint import FreeCellSolverWrapper + UD_SS_RowStack +from pysollib.util import ACE, KING, NO_RANK, UNLIMITED_ACCEPTS, \ + UNLIMITED_MOVES # ************************************************************************ diff --git a/pysollib/games/bakersgame.py b/pysollib/games/bakersgame.py index 81530ada..f6b398f0 100644 --- a/pysollib/games/bakersgame.py +++ b/pysollib/games/bakersgame.py @@ -21,12 +21,12 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.util import KING +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.freecell import FreeCell +from pysollib.hint import DefaultHint +from pysollib.hint import FreeCellSolverWrapper, FreeCellType_Hint +from pysollib.layout import Layout from pysollib.stack import \ AC_RowStack, \ FreeCell_SS_RowStack, \ @@ -36,13 +36,9 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ SS_RowStack, \ - SuperMoveSS_RowStack, \ - StackWrapper -from pysollib.layout import Layout -from pysollib.hint import DefaultHint -from pysollib.hint import FreeCellType_Hint, FreeCellSolverWrapper - -from pysollib.games.freecell import FreeCell + StackWrapper, \ + SuperMoveSS_RowStack +from pysollib.util import KING # ************************************************************************ # * Baker's Game diff --git a/pysollib/games/beleagueredcastle.py b/pysollib/games/beleagueredcastle.py index c63afc93..ed95c8c9 100644 --- a/pysollib/games/beleagueredcastle.py +++ b/pysollib/games/beleagueredcastle.py @@ -21,39 +21,32 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, ANY_RANK, NO_RANK, KING, QUEEN, RANKS +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, FreeCellType_Hint +from pysollib.hint import FreeCellSolverWrapper +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ InitialDealTalonStack, \ OpenStack, \ - ReserveStack, \ RK_FoundationStack, \ RK_RowStack, \ - Spider_SS_RowStack, \ + ReserveStack, \ SS_FoundationStack, \ + Spider_SS_RowStack, \ + StackWrapper, \ SuperMoveRK_RowStack, \ TalonStack, \ UD_AC_RowStack, \ UD_RK_RowStack, \ UD_SS_RowStack, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper -from pysollib.mfxutil import kwdefault -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint, FreeCellType_Hint -from pysollib.hint import FreeCellSolverWrapper -from pysollib.pysoltk import MfxCanvasText + WasteTalonStack +from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, QUEEN, RANKS -# ************************************************************************ -# * -# ************************************************************************ - class BeleagueredCastleType_Hint(CautiousDefaultHint): # FIXME: demo is not too clever in this game pass diff --git a/pysollib/games/bisley.py b/pysollib/games/bisley.py index 8d42dbd4..3204e886 100644 --- a/pysollib/games/bisley.py +++ b/pysollib/games/bisley.py @@ -21,27 +21,24 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, NO_RANK, KING, RANKS, UNLIMITED_REDEALS +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AC_RowStack, \ BasicRowStack, \ InitialDealTalonStack, \ ReserveStack, \ SS_FoundationStack, \ + StackWrapper, \ UD_AC_RowStack, \ UD_RK_RowStack, \ UD_SS_RowStack, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText + WasteTalonStack +from pysollib.util import ACE, KING, NO_RANK, RANKS, UNLIMITED_REDEALS # ************************************************************************ diff --git a/pysollib/games/braid.py b/pysollib/games/braid.py index 13d08548..a22b5fd2 100644 --- a/pysollib/games/braid.py +++ b/pysollib/games/braid.py @@ -21,13 +21,15 @@ # # --------------------------------------------------------------------------- -# imports import math -# PySol imports +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, DefaultHint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, NO_RANK, KING, RANKS, UNLIMITED_CARDS +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ @@ -36,19 +38,11 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ SS_RowStack, \ - WasteStack, \ - WasteTalonStack, \ Stack, \ - StackWrapper -from pysollib.mfxutil import kwdefault -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - -# ************************************************************************ -# * -# ************************************************************************ + StackWrapper, \ + WasteStack, \ + WasteTalonStack +from pysollib.util import ACE, KING, NO_RANK, RANKS, UNLIMITED_CARDS class Braid_Hint(DefaultHint): diff --git a/pysollib/games/bristol.py b/pysollib/games/bristol.py index 9c43b725..d2229370 100644 --- a/pysollib/games/bristol.py +++ b/pysollib/games/bristol.py @@ -21,32 +21,25 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ACE, ANY_RANK, NO_RANK, KING, RANKS, UNLIMITED_CARDS +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AC_RowStack, \ KingAC_RowStack, \ OpenStack, \ OpenTalonStack, \ - ReserveStack, \ RK_FoundationStack, \ RK_RowStack, \ + ReserveStack, \ SS_FoundationStack, \ SS_RowStack, \ + StackWrapper, \ TalonStack, \ - WasteStack, \ - StackWrapper -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - -# ************************************************************************ -# * -# ************************************************************************ + WasteStack +from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, RANKS, UNLIMITED_CARDS class Bristol_Hint(CautiousDefaultHint): diff --git a/pysollib/games/buffalobill.py b/pysollib/games/buffalobill.py index 957b70df..f3bbe58a 100644 --- a/pysollib/games/buffalobill.py +++ b/pysollib/games/buffalobill.py @@ -21,18 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import KING +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.layout import Layout from pysollib.stack import \ BasicRowStack, \ InitialDealTalonStack, \ - SS_FoundationStack, \ - ReserveStack -from pysollib.game import Game -from pysollib.layout import Layout + ReserveStack, \ + SS_FoundationStack +from pysollib.util import KING # ************************************************************************ # * Buffalo Bill diff --git a/pysollib/games/calculation.py b/pysollib/games/calculation.py index 1a22ff78..d88018d2 100644 --- a/pysollib/games/calculation.py +++ b/pysollib/games/calculation.py @@ -1,26 +1,19 @@ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import DefaultHint -from pysollib.pysoltk import MfxCanvasText, get_text_width +from pysollib.layout import Layout from pysollib.mygettext import _ - -from pysollib.util import ANY_SUIT, KING, \ - RANKS - +from pysollib.pysoltk import MfxCanvasText, get_text_width from pysollib.stack import \ BasicRowStack, \ DealRowTalonStack, \ InitialDealTalonStack, \ RK_FoundationStack, \ Stack, \ + StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper - -# ************************************************************************ -# * -# ************************************************************************ + WasteTalonStack +from pysollib.util import ANY_SUIT, KING, RANKS class Calculation_Hint(DefaultHint): diff --git a/pysollib/games/camelot.py b/pysollib/games/camelot.py index cd453c9d..8089bb2e 100644 --- a/pysollib/games/camelot.py +++ b/pysollib/games/camelot.py @@ -21,22 +21,13 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import AbstractHint, CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.numerica import Numerica_Hint - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK, \ - RANKS, QUEEN, \ - UNLIMITED_CARDS - +from pysollib.hint import AbstractHint, CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ @@ -45,10 +36,12 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ SS_RowStack, \ + StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper - + WasteTalonStack +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK, \ + QUEEN, RANKS, \ + UNLIMITED_CARDS # ************************************************************************ # * Camelot # ************************************************************************ diff --git a/pysollib/games/canfield.py b/pysollib/games/canfield.py index f047e424..da86c434 100644 --- a/pysollib/games/canfield.py +++ b/pysollib/games/canfield.py @@ -1,12 +1,9 @@ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.mygettext import _ -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import KING, RANKS, QUEEN, UNLIMITED_REDEALS - from pysollib.stack import \ AC_RowStack, \ KingAC_RowStack, \ @@ -15,12 +12,10 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ SS_RowStack, \ + StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper -# ************************************************************************ -# * -# ************************************************************************ + WasteTalonStack +from pysollib.util import KING, QUEEN, RANKS, UNLIMITED_REDEALS class Canfield_Hint(CautiousDefaultHint): diff --git a/pysollib/games/capricieuse.py b/pysollib/games/capricieuse.py index cc839e2d..c0354522 100644 --- a/pysollib/games/capricieuse.py +++ b/pysollib/games/capricieuse.py @@ -21,26 +21,20 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.gypsy import DieRussische_Foundation - -from pysollib.util import ANY_SUIT, KING - +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout from pysollib.stack import \ AC_RowStack, \ InitialDealTalonStack, \ - RedealTalonStack, \ RK_FoundationStack, \ + RedealTalonStack, \ SS_FoundationStack, \ - UD_SS_RowStack, \ - StackWrapper + StackWrapper, \ + UD_SS_RowStack +from pysollib.util import ANY_SUIT, KING # ************************************************************************ diff --git a/pysollib/games/curdsandwhey.py b/pysollib/games/curdsandwhey.py index 307d19dc..d2e1cd12 100644 --- a/pysollib/games/curdsandwhey.py +++ b/pysollib/games/curdsandwhey.py @@ -21,36 +21,32 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault -from pysollib.game import Game import pysollib.game -from pysollib.layout import Layout +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint, CautiousDefaultHint - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, UNLIMITED_ACCEPTS, \ - UNLIMITED_MOVES +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.stack import \ - AbstractFoundationStack, \ AC_RowStack, \ + AbstractFoundationStack, \ BasicRowStack, \ DealRowTalonStack, \ InitialDealTalonStack, \ - isRankSequence, \ - isSameSuitSequence, \ OpenStack, \ OpenTalonStack, \ RK_RowStack, \ SS_FoundationStack, \ SS_RowStack, \ + StackWrapper, \ TalonStack, \ WasteStack, \ WasteTalonStack, \ - StackWrapper + isRankSequence, \ + isSameSuitSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, UNLIMITED_ACCEPTS, \ + UNLIMITED_MOVES # ************************************************************************ # * Curds and Whey diff --git a/pysollib/games/daddylonglegs.py b/pysollib/games/daddylonglegs.py index 6fd986e4..48b92418 100644 --- a/pysollib/games/daddylonglegs.py +++ b/pysollib/games/daddylonglegs.py @@ -1,21 +1,15 @@ # vim:ts=4:et:nowrap:fileencoding=utf-8 # -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - - -from pysollib.util import ACE - from pysollib.stack import \ DealRowTalonStack, \ + StackWrapper, \ Yukon_SS_RowStack, \ - isSameSuitSequence, \ - StackWrapper + isSameSuitSequence +from pysollib.util import ACE # *********************************************************************** # Daddy Longlegs (by Jim Sizelove) diff --git a/pysollib/games/dieboesesieben.py b/pysollib/games/dieboesesieben.py index 681ab661..fed860f0 100644 --- a/pysollib/games/dieboesesieben.py +++ b/pysollib/games/dieboesesieben.py @@ -21,16 +21,11 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.gypsy import \ DieKoenigsbergerin_Talon, DieRussische_Foundation - +from pysollib.layout import Layout from pysollib.stack import AC_RowStack # ************************************************************************ diff --git a/pysollib/games/diplomat.py b/pysollib/games/diplomat.py index 64848571..9ae90e46 100644 --- a/pysollib/games/diplomat.py +++ b/pysollib/games/diplomat.py @@ -21,27 +21,21 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.fortythieves import FortyThieves_Hint from pysollib.games.spider import Spider_Hint - -from pysollib.util import ACE, KING - +from pysollib.layout import Layout from pysollib.stack import \ RK_RowStack, \ SS_FoundationStack, \ SS_RowStack, \ Spider_SS_RowStack, \ + StackWrapper, \ UD_SS_RowStack, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper + WasteTalonStack +from pysollib.util import ACE, KING # ************************************************************************ # * Diplomat diff --git a/pysollib/games/doublets.py b/pysollib/games/doublets.py index ea521f94..0090dd11 100644 --- a/pysollib/games/doublets.py +++ b/pysollib/games/doublets.py @@ -21,21 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import ANY_SUIT, KING - +from pysollib.layout import Layout from pysollib.stack import \ AbstractFoundationStack, \ ReserveStack, \ WasteStack, \ WasteTalonStack +from pysollib.util import ANY_SUIT, KING # ************************************************************************ # * Doublets diff --git a/pysollib/games/eiffeltower.py b/pysollib/games/eiffeltower.py index 892cd4a3..b9586611 100644 --- a/pysollib/games/eiffeltower.py +++ b/pysollib/games/eiffeltower.py @@ -21,21 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.game import Game import pysollib.game +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -# from pysollib.util import ACE - from pysollib.stack import \ OpenStack, \ + StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper + WasteTalonStack # ************************************************************************ # * Eiffel Tower diff --git a/pysollib/games/fan.py b/pysollib/games/fan.py index b7b15b2f..f977dff3 100644 --- a/pysollib/games/fan.py +++ b/pysollib/games/fan.py @@ -21,19 +21,13 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint from pysollib.hint import FreeCellSolverWrapper +from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import ACE, KING, NO_RANK, UNLIMITED_CARDS - from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -50,17 +44,14 @@ from pysollib.stack import \ SS_FoundationStack, \ SS_RowStack, \ Stack, \ + StackWrapper, \ SuperMoveSS_RowStack, \ TalonStack, \ UD_RK_RowStack, \ - UD_SS_RowStack, \ - StackWrapper + UD_SS_RowStack +from pysollib.util import ACE, KING, NO_RANK, UNLIMITED_CARDS -# ************************************************************************ -# * -# ************************************************************************ - class Fan_Hint(CautiousDefaultHint): # FIXME: demo is not too clever in this game pass diff --git a/pysollib/games/fortythieves.py b/pysollib/games/fortythieves.py index ce134c07..ab5495c2 100644 --- a/pysollib/games/fortythieves.py +++ b/pysollib/games/fortythieves.py @@ -21,19 +21,11 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.gypsy import DieRussische_Foundation - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, \ - UNLIMITED_MOVES, UNLIMITED_REDEALS - +from pysollib.hint import CautiousDefaultHint, DefaultHint +from pysollib.layout import Layout from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -45,17 +37,15 @@ from pysollib.stack import \ SS_RowStack, \ Spider_SS_RowStack, \ Stack, \ + StackWrapper, \ TalonStack, \ UD_AC_RowStack, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper + WasteTalonStack +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, \ + UNLIMITED_MOVES, UNLIMITED_REDEALS -# ************************************************************************ -# * -# ************************************************************************ - class FortyThieves_Hint(CautiousDefaultHint): # FIXME: demo is not too clever in this game pass diff --git a/pysollib/games/freecell.py b/pysollib/games/freecell.py index a251c379..545b83bb 100644 --- a/pysollib/games/freecell.py +++ b/pysollib/games/freecell.py @@ -21,20 +21,13 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import DefaultHint -from pysollib.hint import FreeCellType_Hint, FreeCellSolverWrapper - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.spider import Spider_AC_Foundation - -from pysollib.util import ACE, ANY_SUIT, KING, NO_RANK, UNLIMITED_CARDS - +from pysollib.hint import DefaultHint +from pysollib.hint import FreeCellSolverWrapper, FreeCellType_Hint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -48,10 +41,11 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ Stack, \ + StackWrapper, \ SuperMoveAC_RowStack, \ SuperMoveRK_RowStack, \ - isAlternateColorSequence, \ - StackWrapper + isAlternateColorSequence +from pysollib.util import ACE, ANY_SUIT, KING, NO_RANK, UNLIMITED_CARDS # ************************************************************************ # * FreeCell diff --git a/pysollib/games/glenwood.py b/pysollib/games/glenwood.py index a2f6d32a..6643005a 100644 --- a/pysollib/games/glenwood.py +++ b/pysollib/games/glenwood.py @@ -21,19 +21,12 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.canfield import Canfield_Hint - -from pysollib.util import ANY_RANK, RANKS - +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ @@ -42,6 +35,7 @@ from pysollib.stack import \ SS_RowStack, \ WasteStack, \ WasteTalonStack +from pysollib.util import ANY_RANK, RANKS # ************************************************************************ # * Glenwood diff --git a/pysollib/games/golf.py b/pysollib/games/golf.py index 34db8a40..5c2e7122 100644 --- a/pysollib/games/golf.py +++ b/pysollib/games/golf.py @@ -21,24 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI import pysollib.game -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint -from pysollib.hint import BlackHoleSolverWrapper -from pysollib.pysoltk import MfxCanvasText +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.pileon import FourByFour_Hint - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, RANKS, \ - SUITS, \ - UNLIMITED_REDEALS - +from pysollib.hint import AbstractHint, CautiousDefaultHint, DefaultHint +from pysollib.hint import BlackHoleSolverWrapper +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ @@ -51,16 +43,15 @@ from pysollib.stack import \ SS_FoundationStack, \ SS_RowStack, \ Stack, \ + StackWrapper, \ TalonStack, \ UD_RK_RowStack, \ WasteStack, \ WasteTalonStack, \ - isSameSuitSequence, \ - StackWrapper - -# ************************************************************************ -# * -# ************************************************************************ + isSameSuitSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, RANKS, \ + SUITS, \ + UNLIMITED_REDEALS class Golf_Hint(AbstractHint): diff --git a/pysollib/games/grandduchess.py b/pysollib/games/grandduchess.py index eb6d7a66..df6ae92f 100644 --- a/pysollib/games/grandduchess.py +++ b/pysollib/games/grandduchess.py @@ -21,20 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -from pysollib.util import ACE, KING - from pysollib.stack import \ ArbitraryStack, \ BasicRowStack, \ RedealTalonStack, \ SS_FoundationStack +from pysollib.util import ACE, KING # ************************************************************************ # * Grand Duchess diff --git a/pysollib/games/grandfathersclock.py b/pysollib/games/grandfathersclock.py index e168dd93..d6732966 100644 --- a/pysollib/games/grandfathersclock.py +++ b/pysollib/games/grandfathersclock.py @@ -21,20 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, DefaultHint from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint - -# ************************************************************************ -# * -# ************************************************************************ - -from pysollib.util import ACE, ANY_SUIT, JACK, KING, QUEEN - from pysollib.stack import \ AC_FoundationStack, \ BasicRowStack, \ @@ -47,6 +37,7 @@ from pysollib.stack import \ SS_RowStack, \ WasteStack, \ WasteTalonStack +from pysollib.util import ACE, ANY_SUIT, JACK, KING, QUEEN class GrandfathersClock_Hint(CautiousDefaultHint): diff --git a/pysollib/games/gypsy.py b/pysollib/games/gypsy.py index 38e53603..4feb04e6 100644 --- a/pysollib/games/gypsy.py +++ b/pysollib/games/gypsy.py @@ -21,21 +21,13 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.spider import Spider_Hint, Spider_RowStack, \ + Spider_SS_Foundation from pysollib.hint import KlondikeType_Hint, YukonType_Hint - -from pysollib.games.spider import Spider_SS_Foundation, \ - Spider_RowStack, Spider_Hint - -from pysollib.util import ACE, ANY_SUIT, KING, UNLIMITED_ACCEPTS, \ - UNLIMITED_MOVES - +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ @@ -49,17 +41,19 @@ from pysollib.stack import \ SS_RowStack, \ Spider_SS_RowStack, \ Stack, \ + StackWrapper, \ TalonStack, \ WasteStack, \ WasteTalonStack, \ - Yukon_AC_RowStack, \ - StackWrapper - + Yukon_AC_RowStack +from pysollib.util import ACE, ANY_SUIT, KING, UNLIMITED_ACCEPTS, \ + UNLIMITED_MOVES # ************************************************************************ # * Gypsy # ************************************************************************ + class Gypsy(Game): Layout_Method = staticmethod(Layout.gypsyLayout) Talon_Class = DealRowTalonStack diff --git a/pysollib/games/harp.py b/pysollib/games/harp.py index 52a6cba5..dfa9b013 100644 --- a/pysollib/games/harp.py +++ b/pysollib/games/harp.py @@ -21,31 +21,25 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.spider import Spider_Hint +from pysollib.games.spider import Spider_RowStack, Spider_SS_Foundation from pysollib.hint import CautiousDefaultHint from pysollib.hint import KlondikeType_Hint - -from pysollib.games.spider import Spider_RowStack, Spider_SS_Foundation, \ - Spider_Hint - -from pysollib.util import ACE, KING - +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.stack import \ AC_RowStack, \ BO_RowStack, \ KingAC_RowStack, \ SS_FoundationStack, \ + SS_RowStack, \ Spider_SS_RowStack, \ StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - SS_RowStack + WasteTalonStack +from pysollib.util import ACE, KING # ************************************************************************ # * Double Klondike (Klondike with 2 decks and 9 rows) diff --git a/pysollib/games/headsandtails.py b/pysollib/games/headsandtails.py index b5029435..3242e830 100644 --- a/pysollib/games/headsandtails.py +++ b/pysollib/games/headsandtails.py @@ -21,22 +21,17 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import KING - +from pysollib.layout import Layout from pysollib.stack import \ AC_RowStack, \ InitialDealTalonStack, \ OpenStack, \ SS_FoundationStack, \ SS_RowStack +from pysollib.util import KING # ************************************************************************ # * Heads and Tails diff --git a/pysollib/games/katzenschwanz.py b/pysollib/games/katzenschwanz.py index 6924efed..5a345ec9 100644 --- a/pysollib/games/katzenschwanz.py +++ b/pysollib/games/katzenschwanz.py @@ -21,21 +21,12 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import FreeCellType_Hint, CautiousDefaultHint +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, FreeCellType_Hint from pysollib.hint import FreeCellSolverWrapper +from pysollib.layout import Layout from pysollib.pysoltk import MfxCanvasText - - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, RANKS, \ - QUEEN, \ - UNLIMITED_ACCEPTS - from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ @@ -50,10 +41,8 @@ from pysollib.stack import \ TalonStack, \ WasteStack, \ WasteTalonStack - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK, \ + QUEEN, RANKS, UNLIMITED_ACCEPTS class DerKatzenschwanz_Hint(FreeCellType_Hint): diff --git a/pysollib/games/klondike.py b/pysollib/games/klondike.py index cd4f19d5..76775478 100644 --- a/pysollib/games/klondike.py +++ b/pysollib/games/klondike.py @@ -21,24 +21,17 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault, Struct -from pysollib.game import Game import pysollib.game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.hint import KlondikeType_Hint -from pysollib.hint import FreeCellSolverWrapper -from pysollib.pysoltk import MfxCanvasText - +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.canfield import CanfieldRush_Talon - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK - +from pysollib.hint import CautiousDefaultHint +from pysollib.hint import FreeCellSolverWrapper +from pysollib.hint import KlondikeType_Hint +from pysollib.layout import Layout +from pysollib.mfxutil import Struct, kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ AC_RowStack, \ BO_RowStack, \ @@ -53,14 +46,15 @@ from pysollib.stack import \ ReserveStack, \ SC_RowStack, \ SS_FoundationStack, \ + SS_RowStack, \ Stack, \ StackWrapper, \ SuperMoveAC_RowStack, \ UD_SS_RowStack, \ WasteStack, \ WasteTalonStack, \ - isSameColorSequence, \ - SS_RowStack + isSameColorSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, NO_RANK # ************************************************************************ # * Klondike diff --git a/pysollib/games/labyrinth.py b/pysollib/games/labyrinth.py index 99dceb92..8838e7cc 100644 --- a/pysollib/games/labyrinth.py +++ b/pysollib/games/labyrinth.py @@ -21,15 +21,8 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -# from pysollib.gamedb import registerGame, GameInfo from pysollib.game import Game from pysollib.layout import Layout - -# from pysollib.util import - from pysollib.stack import \ BasicRowStack, \ DealRowTalonStack, \ diff --git a/pysollib/games/larasgame.py b/pysollib/games/larasgame.py index 2b1ec106..3d46ed4c 100644 --- a/pysollib/games/larasgame.py +++ b/pysollib/games/larasgame.py @@ -21,28 +21,17 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - - -# from pysollib.util import - +from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.stack import \ OpenStack, \ SS_FoundationStack, \ Stack, \ WasteTalonStack -# ************************************************************************ -# * -# ************************************************************************ - class LarasGame_Hint(CautiousDefaultHint): pass diff --git a/pysollib/games/mahjongg/mahjongg.py b/pysollib/games/mahjongg/mahjongg.py index f0339fc1..f62e145f 100644 --- a/pysollib/games/mahjongg/mahjongg.py +++ b/pysollib/games/mahjongg/mahjongg.py @@ -21,29 +21,26 @@ # # --------------------------------------------------------------------------- -# Imports -from six.moves import range import re import time -from gettext import ungettext -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault, Struct, Image from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint -from pysollib.settings import TOOLKIT, DEBUG -from pysollib.pysoltk import MfxCanvasText, MfxCanvasImage -from pysollib.pysoltk import bind, EVENT_HANDLED, ANCHOR_NW +from pysollib.layout import Layout +from pysollib.mfxutil import Image, Struct, kwdefault +from pysollib.mygettext import _ +from pysollib.mygettext import ungettext +from pysollib.pysoltk import ANCHOR_NW, EVENT_HANDLED, bind +from pysollib.pysoltk import MfxCanvasImage, MfxCanvasText from pysollib.pysoltk import MfxMessageDialog - -from pysollib.util import ANY_SUIT, NO_RANK - +from pysollib.settings import DEBUG, TOOLKIT from pysollib.stack import \ InitialDealTalonStack, \ OpenStack +from pysollib.util import ANY_SUIT, NO_RANK + +from six.moves import range def factorial(x): diff --git a/pysollib/games/mahjongg/shisensho.py b/pysollib/games/mahjongg/shisensho.py index d6f89775..0263a77c 100644 --- a/pysollib/games/mahjongg/shisensho.py +++ b/pysollib/games/mahjongg/shisensho.py @@ -21,32 +21,23 @@ # # --------------------------------------------------------------------------- -# Imports -from gettext import ungettext -from six.moves import range - -from pysollib.settings import TOOLKIT - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.mahjongg.mahjongg import AbstractMahjonggGame, \ + Mahjongg_RowStack, \ + comp_cardset from pysollib.hint import AbstractHint -from pysollib.pysoltk import MfxCanvasText, MfxCanvasLine - -from pysollib.games.mahjongg.mahjongg import Mahjongg_RowStack, \ - AbstractMahjonggGame, comp_cardset - -from pysollib.util import ANY_SUIT - +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.mygettext import ungettext +from pysollib.pysoltk import MfxCanvasLine, MfxCanvasText +from pysollib.settings import TOOLKIT from pysollib.stack import \ AbstractFoundationStack, \ InitialDealTalonStack +from pysollib.util import ANY_SUIT -# ************************************************************************ -# * -# ************************************************************************ +from six.moves import range class Shisen_Hint(AbstractHint): diff --git a/pysollib/games/matriarchy.py b/pysollib/games/matriarchy.py index ba1823c2..7803bf36 100644 --- a/pysollib/games/matriarchy.py +++ b/pysollib/games/matriarchy.py @@ -21,23 +21,18 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import KING, QUEEN, VARIABLE_REDEALS - from pysollib.stack import \ + SS_RowStack, \ Stack, \ WasteStack, \ - WasteTalonStack, \ - SS_RowStack + WasteTalonStack +from pysollib.util import KING, QUEEN, VARIABLE_REDEALS # ************************************************************************ # * Talon diff --git a/pysollib/games/montana.py b/pysollib/games/montana.py index 49b4a930..8ef146c5 100644 --- a/pysollib/games/montana.py +++ b/pysollib/games/montana.py @@ -21,16 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import DefaultHint - -from pysollib.util import ACE, NO_SUIT - +from pysollib.layout import Layout from pysollib.stack import \ BasicRowStack, \ InitialDealTalonStack, \ @@ -40,6 +34,7 @@ from pysollib.stack import \ TalonStack, \ WasteStack, \ WasteTalonStack +from pysollib.util import ACE, NO_SUIT # ************************************************************************ # * diff --git a/pysollib/games/montecarlo.py b/pysollib/games/montecarlo.py index 260a93b2..902ffd94 100644 --- a/pysollib/games/montecarlo.py +++ b/pysollib/games/montecarlo.py @@ -21,16 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import DefaultHint - -from pysollib.util import ANY_RANK, ANY_SUIT, KING, NO_RANK, UNLIMITED_REDEALS - +from pysollib.layout import Layout from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ @@ -38,9 +32,10 @@ from pysollib.stack import \ InitialDealTalonStack, \ OpenStack, \ ReserveStack, \ + SS_FoundationStack, \ StackWrapper, \ - TalonStack, \ - SS_FoundationStack + TalonStack +from pysollib.util import ANY_RANK, ANY_SUIT, KING, NO_RANK, UNLIMITED_REDEALS # ************************************************************************ # * diff --git a/pysollib/games/napoleon.py b/pysollib/games/napoleon.py index 1d925244..575ccb9d 100644 --- a/pysollib/games/napoleon.py +++ b/pysollib/games/napoleon.py @@ -21,29 +21,24 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.braid import Braid_Foundation - -from pysollib.util import ACE, KING, RANKS, UNLIMITED_CARDS - +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ BasicRowStack, \ InitialDealTalonStack, \ ReserveStack, \ SS_FoundationStack, \ Stack, \ - UD_SS_RowStack, \ - StackWrapper + StackWrapper, \ + UD_SS_RowStack +from pysollib.util import ACE, KING, RANKS, UNLIMITED_CARDS + # ************************************************************************ # * stacks diff --git a/pysollib/games/needle.py b/pysollib/games/needle.py index dbbd17d9..704a9306 100644 --- a/pysollib/games/needle.py +++ b/pysollib/games/needle.py @@ -21,16 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -# from pysollib.util import ANY_SUIT, KING - +from pysollib.layout import Layout from pysollib.stack import \ AC_RowStack, \ InitialDealTalonStack, \ diff --git a/pysollib/games/numerica.py b/pysollib/games/numerica.py index 52c127a9..b2aa4422 100644 --- a/pysollib/games/numerica.py +++ b/pysollib/games/numerica.py @@ -21,21 +21,14 @@ # # --------------------------------------------------------------------------- -# imports import time -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, DefaultHint from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint from pysollib.mfxutil import kwdefault - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK, \ - UNLIMITED_ACCEPTS, \ - UNLIMITED_CARDS - +from pysollib.mygettext import _ from pysollib.stack import \ AC_RowStack, \ BasicRowStack, \ @@ -52,10 +45,9 @@ from pysollib.stack import \ TalonStack, \ WasteStack, \ WasteTalonStack - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK, \ + UNLIMITED_ACCEPTS, \ + UNLIMITED_CARDS class Numerica_Hint(DefaultHint): diff --git a/pysollib/games/osmosis.py b/pysollib/games/osmosis.py index b9dba059..34ef31ae 100644 --- a/pysollib/games/osmosis.py +++ b/pysollib/games/osmosis.py @@ -21,25 +21,20 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -from pysollib.util import ANY_RANK, ANY_SUIT, UNLIMITED_REDEALS - +from pysollib.mygettext import _ from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ FullStackWrapper, \ InitialDealTalonStack, \ OpenStack, \ + ReserveStack, \ WasteStack, \ - WasteTalonStack, \ - ReserveStack + WasteTalonStack +from pysollib.util import ANY_RANK, ANY_SUIT, UNLIMITED_REDEALS # ************************************************************************ # * Osmosis diff --git a/pysollib/games/parallels.py b/pysollib/games/parallels.py index ffd8124b..4abf40fb 100644 --- a/pysollib/games/parallels.py +++ b/pysollib/games/parallels.py @@ -21,19 +21,14 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -from pysollib.util import ACE, KING - from pysollib.stack import \ BasicRowStack, \ DealRowTalonStack, \ SS_FoundationStack +from pysollib.util import ACE, KING # ************************************************************************ # * Parallels diff --git a/pysollib/games/pasdedeux.py b/pysollib/games/pasdedeux.py index 64f9b8b0..1234905b 100644 --- a/pysollib/games/pasdedeux.py +++ b/pysollib/games/pasdedeux.py @@ -21,24 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint - +from pysollib.layout import Layout from pysollib.stack import \ InvisibleStack, \ ReserveStack, \ WasteStack, \ WasteTalonStack -# ************************************************************************ -# * -# ************************************************************************ - class PasDeDeux_Hint(AbstractHint): # FIXME: this is very simple diff --git a/pysollib/games/picturegallery.py b/pysollib/games/picturegallery.py index f1ee5574..444761a1 100644 --- a/pysollib/games/picturegallery.py +++ b/pysollib/games/picturegallery.py @@ -21,16 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint - -from pysollib.util import ACE, KING, QUEEN - +from pysollib.layout import Layout from pysollib.stack import \ BasicRowStack, \ DealRowTalonStack, \ @@ -42,6 +36,7 @@ from pysollib.stack import \ StackWrapper, \ WasteStack, \ WasteTalonStack +from pysollib.util import ACE, KING, QUEEN # ************************************************************************ # * diff --git a/pysollib/games/pileon.py b/pysollib/games/pileon.py index 28df8f69..b28537a4 100644 --- a/pysollib/games/pileon.py +++ b/pysollib/games/pileon.py @@ -21,32 +21,27 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, DefaultHint from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, RANKS - from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ DealRowTalonStack, \ InitialDealTalonStack, \ RK_RowStack, \ + ReserveStack, \ Stack, \ UD_AC_RowStack, \ UD_RK_RowStack, \ WasteStack, \ WasteTalonStack, \ cardsFaceDown, \ - isRankSequence, \ - ReserveStack + isRankSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, RANKS # ************************************************************************ # * PileOn diff --git a/pysollib/games/pushpin.py b/pysollib/games/pushpin.py index cb432a58..b8beca43 100644 --- a/pysollib/games/pushpin.py +++ b/pysollib/games/pushpin.py @@ -21,25 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint - -from pysollib.util import ANY_RANK, ANY_SUIT - +from pysollib.layout import Layout from pysollib.stack import \ AbstractFoundationStack, \ DealRowTalonStack, \ - Stack, \ - ReserveStack - -# ************************************************************************ -# * -# ************************************************************************ + ReserveStack, \ + Stack +from pysollib.util import ANY_RANK, ANY_SUIT class PushPin_Hint(AbstractHint): diff --git a/pysollib/games/pyramid.py b/pysollib/games/pyramid.py index f8cc4511..2b49cbfa 100644 --- a/pysollib/games/pyramid.py +++ b/pysollib/games/pyramid.py @@ -21,18 +21,11 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import DefaultHint +from pysollib.layout import Layout from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK, QUEEN, \ - UNLIMITED_CARDS, UNLIMITED_REDEALS - from pysollib.stack import \ AbstractFoundationStack, \ BasicRowStack, \ @@ -41,13 +34,15 @@ from pysollib.stack import \ FaceUpWasteTalonStack, \ InitialDealTalonStack, \ OpenStack, \ + ReserveStack, \ Stack, \ StackWrapper, \ TalonStack, \ WasteStack, \ WasteTalonStack, \ - getNumberOfFreeStacks, \ - ReserveStack + getNumberOfFreeStacks +from pysollib.util import ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK, QUEEN, \ + UNLIMITED_CARDS, UNLIMITED_REDEALS # ************************************************************************ diff --git a/pysollib/games/royalcotillion.py b/pysollib/games/royalcotillion.py index df67c118..8efe135c 100644 --- a/pysollib/games/royalcotillion.py +++ b/pysollib/games/royalcotillion.py @@ -21,19 +21,12 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.unionsquare import UnionSquare_Foundation - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK - +from pysollib.hint import CautiousDefaultHint, DefaultHint +from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -45,6 +38,7 @@ from pysollib.stack import \ RK_FoundationStack, \ RK_RowStack, \ ReserveStack, \ + SS_FoundationStack, \ SS_RowStack, \ Stack, \ StackWrapper, \ @@ -52,14 +46,14 @@ from pysollib.stack import \ UD_SS_RowStack, \ WasteStack, \ WasteTalonStack, \ - isSameSuitSequence, \ - SS_FoundationStack - + isSameSuitSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, JACK, KING, NO_RANK # ************************************************************************ # * Royal Cotillion # ************************************************************************ + class RoyalCotillion_Foundation(SS_FoundationStack): def getBottomImage(self): if self.cap.base_rank == 1: diff --git a/pysollib/games/royaleast.py b/pysollib/games/royaleast.py index 8139d17b..37c511d4 100644 --- a/pysollib/games/royaleast.py +++ b/pysollib/games/royaleast.py @@ -21,19 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - +from pysollib.layout import Layout from pysollib.stack import \ RK_RowStack, \ + SS_FoundationStack, \ WasteStack, \ - WasteTalonStack, \ - SS_FoundationStack + WasteTalonStack # ************************************************************************ # * Royal East diff --git a/pysollib/games/sanibel.py b/pysollib/games/sanibel.py index 33536a45..4bf20299 100644 --- a/pysollib/games/sanibel.py +++ b/pysollib/games/sanibel.py @@ -21,19 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.layout import Layout -from pysollib.hint import Yukon_Hint +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.gypsy import Gypsy - +from pysollib.hint import Yukon_Hint +from pysollib.layout import Layout from pysollib.stack import \ - Yukon_AC_RowStack, \ + SS_FoundationStack, \ StackWrapper, \ WasteTalonStack, \ - SS_FoundationStack + Yukon_AC_RowStack # ************************************************************************ # * Sanibel diff --git a/pysollib/games/siebenbisas.py b/pysollib/games/siebenbisas.py index 60e7fb8d..df9cdc69 100644 --- a/pysollib/games/siebenbisas.py +++ b/pysollib/games/siebenbisas.py @@ -21,25 +21,20 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import ACE, KING, QUEEN - +from pysollib.layout import Layout from pysollib.stack import \ BasicRowStack, \ InitialDealTalonStack, \ InvisibleStack, \ ReserveStack, \ + SS_FoundationStack, \ Stack, \ getPileFromStacks, \ - isSameSuitSequence, \ - SS_FoundationStack + isSameSuitSequence +from pysollib.util import ACE, KING, QUEEN # ************************************************************************ # * diff --git a/pysollib/games/simplex.py b/pysollib/games/simplex.py index dd7881ce..70592422 100644 --- a/pysollib/games/simplex.py +++ b/pysollib/games/simplex.py @@ -21,21 +21,16 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.game import Game import pysollib.game +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -from pysollib.util import ANY_RANK, ANY_SUIT - from pysollib.stack import \ + AbstractFoundationStack, \ SequenceRowStack, \ WasteStack, \ - WasteTalonStack, \ - AbstractFoundationStack + WasteTalonStack +from pysollib.util import ANY_RANK, ANY_SUIT # ************************************************************************ # * Simplex diff --git a/pysollib/games/special/hanoi.py b/pysollib/games/special/hanoi.py index 523f8507..76030c5c 100644 --- a/pysollib/games/special/hanoi.py +++ b/pysollib/games/special/hanoi.py @@ -21,18 +21,14 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - +from pysollib.layout import Layout from pysollib.stack import \ + BasicRowStack, \ InitialDealTalonStack, \ - isRankSequence, \ - BasicRowStack + isRankSequence # ************************************************************************ # * Tower of Hanoy diff --git a/pysollib/games/special/memory.py b/pysollib/games/special/memory.py index 667cbdb4..09953b46 100644 --- a/pysollib/games/special/memory.py +++ b/pysollib/games/special/memory.py @@ -21,17 +21,11 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -# from pysollib.util import ANY_SUIT - from pysollib.stack import \ InitialDealTalonStack, \ InvisibleStack, \ diff --git a/pysollib/games/special/pegged.py b/pysollib/games/special/pegged.py index 84915aff..cfed9103 100644 --- a/pysollib/games/special/pegged.py +++ b/pysollib/games/special/pegged.py @@ -21,25 +21,16 @@ # # --------------------------------------------------------------------------- -# Imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint - -from pysollib.util import ANY_SUIT - +from pysollib.layout import Layout from pysollib.stack import \ AbstractFoundationStack, \ InitialDealTalonStack, \ InvisibleStack, \ ReserveStack - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.util import ANY_SUIT class Pegged_Hint(AbstractHint): diff --git a/pysollib/games/special/poker.py b/pysollib/games/special/poker.py index 35fd1eac..a44caea1 100644 --- a/pysollib/games/special/poker.py +++ b/pysollib/games/special/poker.py @@ -21,15 +21,11 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - from pysollib.stack import \ InitialDealTalonStack, \ InvisibleStack, \ diff --git a/pysollib/games/special/tarock.py b/pysollib/games/special/tarock.py index 50efb875..6c73ab93 100644 --- a/pysollib/games/special/tarock.py +++ b/pysollib/games/special/tarock.py @@ -21,33 +21,27 @@ # # ---------------------------------------------------------------------------## -# Imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - -from pysollib.games.braid import Braid_Foundation, Braid_BraidStack, \ - Braid_RowStack, Braid_ReserveStack, Braid +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.bakersdozen import Cruel_Talon - -from pysollib.util import ANY_RANK, NO_RANK, UNLIMITED_ACCEPTS, UNLIMITED_MOVES - +from pysollib.games.braid import Braid, Braid_ReserveStack, Braid_RowStack +from pysollib.games.braid import Braid_BraidStack, Braid_Foundation +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ InitialDealTalonStack, \ OpenStack, \ RK_RowStack, \ ReserveStack, \ SS_FoundationStack, \ + SS_RowStack, \ StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - SS_RowStack + WasteTalonStack +from pysollib.util import ANY_RANK, NO_RANK, UNLIMITED_ACCEPTS, UNLIMITED_MOVES # ************************************************************************ # * Tarock Talon Stacks diff --git a/pysollib/games/spider.py b/pysollib/games/spider.py index eefdd504..3e107906 100644 --- a/pysollib/games/spider.py +++ b/pysollib/games/spider.py @@ -21,22 +21,15 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault -from pysollib.game import Game import pysollib.game -from pysollib.layout import Layout +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint -from pysollib.hint import SpiderType_Hint, YukonType_Hint from pysollib.hint import FreeCellSolverWrapper - -from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, \ - UNLIMITED_ACCEPTS, UNLIMITED_CARDS, UNLIMITED_MOVES - +from pysollib.hint import SpiderType_Hint, YukonType_Hint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -48,6 +41,7 @@ from pysollib.stack import \ OpenStack, \ RK_RowStack, \ ReserveStack, \ + SS_FoundationStack, \ Spider_AC_Foundation, \ Spider_SS_Foundation, \ Spider_SS_RowStack, \ @@ -62,8 +56,9 @@ from pysollib.stack import \ isAlternateColorSequence, \ isRankSequence, \ isSameColorSequence, \ - isSameSuitSequence, \ - SS_FoundationStack + isSameSuitSequence +from pysollib.util import ACE, ANY_RANK, ANY_SUIT, KING, \ + UNLIMITED_ACCEPTS, UNLIMITED_CARDS, UNLIMITED_MOVES # ************************************************************************ diff --git a/pysollib/games/sthelena.py b/pysollib/games/sthelena.py index 7304a055..2a648956 100644 --- a/pysollib/games/sthelena.py +++ b/pysollib/games/sthelena.py @@ -21,31 +21,22 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import ACE, JACK, KING, NO_RANK - +from pysollib.layout import Layout from pysollib.stack import \ DealRowTalonStack, \ InitialDealTalonStack, \ RedealTalonStack, \ + SS_FoundationStack, \ StackWrapper, \ TalonStack, \ UD_RK_RowStack, \ - UD_SS_RowStack, \ - SS_FoundationStack + UD_SS_RowStack +from pysollib.util import ACE, JACK, KING, NO_RANK -# ************************************************************************ -# * -# ************************************************************************ - class StHelena_Talon(TalonStack): def canDealCards(self): diff --git a/pysollib/games/sultan.py b/pysollib/games/sultan.py index 51352213..07b7cbe9 100644 --- a/pysollib/games/sultan.py +++ b/pysollib/games/sultan.py @@ -21,17 +21,10 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import ACE, ANY_SUIT, JACK, KING, NO_RANK, QUEEN, \ - UNLIMITED_REDEALS - +from pysollib.layout import Layout from pysollib.stack import \ AC_FoundationStack, \ AbstractFoundationStack, \ @@ -44,6 +37,7 @@ from pysollib.stack import \ RK_FoundationStack, \ RK_RowStack, \ ReserveStack, \ + SS_FoundationStack, \ SS_RowStack, \ Stack, \ StackWrapper, \ @@ -51,8 +45,9 @@ from pysollib.stack import \ UD_AC_RowStack, \ UD_SS_RowStack, \ WasteStack, \ - WasteTalonStack, \ - SS_FoundationStack + WasteTalonStack +from pysollib.util import ACE, ANY_SUIT, JACK, KING, NO_RANK, QUEEN, \ + UNLIMITED_REDEALS # ************************************************************************ diff --git a/pysollib/games/takeaway.py b/pysollib/games/takeaway.py index cb9e4dd2..2ff7a439 100644 --- a/pysollib/games/takeaway.py +++ b/pysollib/games/takeaway.py @@ -21,16 +21,10 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -from pysollib.util import ANY_RANK, ANY_SUIT, JACK, KING, QUEEN - +from pysollib.mygettext import _ from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ @@ -38,15 +32,16 @@ from pysollib.stack import \ InitialDealTalonStack, \ OpenStack, \ Stack, \ + StackWrapper, \ UD_RK_RowStack, \ - isAlternateColorSequence, \ - StackWrapper - + isAlternateColorSequence +from pysollib.util import ANY_RANK, ANY_SUIT, JACK, KING, QUEEN # ************************************************************************ # * Take Away # ************************************************************************ + class TakeAway_Foundation(AbstractFoundationStack): def acceptsCards(self, from_stack, cards): diff --git a/pysollib/games/terrace.py b/pysollib/games/terrace.py index 3bf397b1..fae28e2b 100644 --- a/pysollib/games/terrace.py +++ b/pysollib/games/terrace.py @@ -21,16 +21,12 @@ # # --------------------------------------------------------------------------- -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import KING, NO_RANK - +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.stack import \ AC_FoundationStack, \ AC_RowStack, \ @@ -40,10 +36,7 @@ from pysollib.stack import \ StackWrapper, \ WasteStack, \ WasteTalonStack - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.util import KING, NO_RANK class Terrace_Talon(WasteTalonStack): diff --git a/pysollib/games/threepeaks.py b/pysollib/games/threepeaks.py index 669d49e9..ad3a7ac5 100644 --- a/pysollib/games/threepeaks.py +++ b/pysollib/games/threepeaks.py @@ -21,25 +21,16 @@ # # ---------------------------------------------------------------------------## -# Imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.golf import Golf_Hint, Golf_Waste from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.games.golf import Golf_Waste, Golf_Hint - +from pysollib.stack import OpenStack, StackWrapper, WasteTalonStack from pysollib.util import ANY_RANK -from pysollib.stack import \ - OpenStack, \ - StackWrapper, \ - WasteTalonStack - # ************************************************************************ # * Three Peaks Row Stack # ************************************************************************ diff --git a/pysollib/games/tournament.py b/pysollib/games/tournament.py index 7e6dd1bb..7559db14 100644 --- a/pysollib/games/tournament.py +++ b/pysollib/games/tournament.py @@ -21,17 +21,11 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import ACE, JACK, KING, QUEEN - +from pysollib.layout import Layout +from pysollib.mygettext import _ from pysollib.stack import \ AC_RowStack, \ BasicRowStack, \ @@ -39,9 +33,10 @@ from pysollib.stack import \ DealRowTalonStack, \ OpenStack, \ ReserveStack, \ + SS_FoundationStack, \ SS_RowStack, \ - Stack, \ - SS_FoundationStack + Stack +from pysollib.util import ACE, JACK, KING, QUEEN # ************************************************************************ # * Tournament diff --git a/pysollib/games/ultra/dashavatara.py b/pysollib/games/ultra/dashavatara.py index 0ce2c9a7..b475ae58 100644 --- a/pysollib/games/ultra/dashavatara.py +++ b/pysollib/games/ultra/dashavatara.py @@ -21,25 +21,16 @@ # # --------------------------------------------------------------------------- -# Imports import math import time - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import AbstractHint, CautiousDefaultHint, DefaultHint from pysollib.layout import Layout -from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK, \ - UNLIMITED_ACCEPTS, \ - UNLIMITED_CARDS, \ - UNLIMITED_MOVES - from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ @@ -53,8 +44,12 @@ from pysollib.stack import \ SS_RowStack, \ StackWrapper, \ WasteStack, \ - isSameSuitSequence, \ - WasteTalonStack + WasteTalonStack, \ + isSameSuitSequence +from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK, \ + UNLIMITED_ACCEPTS, \ + UNLIMITED_CARDS, \ + UNLIMITED_MOVES # ************************************************************************ # * Dashavatara Foundation Stacks diff --git a/pysollib/games/ultra/hanafuda.py b/pysollib/games/ultra/hanafuda.py index fac146b9..12ff458f 100644 --- a/pysollib/games/ultra/hanafuda.py +++ b/pysollib/games/ultra/hanafuda.py @@ -21,17 +21,9 @@ # # ---------------------------------------------------------------------------## -# Imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault -from pysollib.layout import Layout -from pysollib.hint import FreeCellType_Hint -from pysollib.pysoltk import MfxCanvasText - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.ultra.hanafuda_common import \ + AbstractFlowerGame, \ FlowerClock_Foundation, \ FlowerClock_RowStack, \ FourWinds_Foundation, \ @@ -45,18 +37,20 @@ from pysollib.games.ultra.hanafuda_common import \ MatsuKiri_Foundation, \ Matsukiri_RowStack, \ Oonsoo_SequenceStack, \ - Pagoda_Foundation, \ - AbstractFlowerGame - -from pysollib.util import ANY_RANK, ANY_SUIT - + Pagoda_Foundation +from pysollib.hint import FreeCellType_Hint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ DealRowTalonStack, \ InitialDealTalonStack, \ ReserveStack, \ WasteStack, \ - cardsFaceUp, \ - WasteTalonStack + WasteTalonStack, \ + cardsFaceUp +from pysollib.util import ANY_RANK, ANY_SUIT # ************************************************************************ # * Flower Clock diff --git a/pysollib/games/ultra/hanafuda1.py b/pysollib/games/ultra/hanafuda1.py index 312a1a90..d9db5a04 100644 --- a/pysollib/games/ultra/hanafuda1.py +++ b/pysollib/games/ultra/hanafuda1.py @@ -21,18 +21,12 @@ # # ---------------------------------------------------------------------------## -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import AbstractHint, CautiousDefaultHint -from pysollib.pysoltk import MfxCanvasText - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.ultra.hanafuda_common import \ - Flower_OpenStack, \ + AbstractFlowerGame, \ FlowerClock_RowStack, \ + Flower_OpenStack, \ HanafudaRK_RowStack, \ Hanafuda_SS_FoundationStack, \ Hanafuda_SequenceStack, \ @@ -42,11 +36,12 @@ from pysollib.games.ultra.hanafuda_common import \ Queue_Hint, \ Queue_ReserveStack, \ Queue_RowStack, \ - Samuri_RowStack, \ - AbstractFlowerGame - -from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK - + Samuri_RowStack +from pysollib.hint import AbstractHint, CautiousDefaultHint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ BasicRowStack, \ DealRowTalonStack, \ @@ -56,6 +51,7 @@ from pysollib.stack import \ StackWrapper, \ WasteStack, \ WasteTalonStack +from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK # ************************************************************************ diff --git a/pysollib/games/ultra/hanafuda_common.py b/pysollib/games/ultra/hanafuda_common.py index d25a4c81..254d15ed 100644 --- a/pysollib/games/ultra/hanafuda_common.py +++ b/pysollib/games/ultra/hanafuda_common.py @@ -23,23 +23,17 @@ import math -from pysollib.mygettext import _ -from pysollib.mfxutil import kwdefault from pysollib.game import Game from pysollib.hint import DefaultHint - -from pysollib.util import ANY_RANK, ANY_SUIT - +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.stack import \ AbstractFoundationStack, \ OpenStack, \ ReserveStack, \ - isRankSequence, \ - cardsFaceUp - -# ************************************************************************ -# * -# ***********************************************************************/ + cardsFaceUp, \ + isRankSequence +from pysollib.util import ANY_RANK, ANY_SUIT class AbstractFlowerGame(Game): diff --git a/pysollib/games/ultra/hexadeck.py b/pysollib/games/ultra/hexadeck.py index f91e4883..f7a6f303 100644 --- a/pysollib/games/ultra/hexadeck.py +++ b/pysollib/games/ultra/hexadeck.py @@ -24,34 +24,31 @@ # Imports import math -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.hint import CautiousDefaultHint, DefaultHint from pysollib.layout import Layout -from pysollib.hint import DefaultHint, CautiousDefaultHint +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK, UNLIMITED_ACCEPTS, \ - UNLIMITED_MOVES - from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ InitialDealTalonStack, \ + OpenStack, \ ReserveStack, \ SS_FoundationStack, \ StackWrapper, \ WasteStack, \ - WasteTalonStack, \ - OpenStack - + WasteTalonStack +from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK, UNLIMITED_ACCEPTS, \ + UNLIMITED_MOVES # ************************************************************************ # * Hex A Deck Foundation Stacks # ************************************************************************ + class HexADeck_FoundationStack(SS_FoundationStack): def __init__(self, x, y, game, suit, **cap): kwdefault(cap, max_move=0, max_cards=12) diff --git a/pysollib/games/ultra/larasgame.py b/pysollib/games/ultra/larasgame.py index 5615d798..438aae0b 100644 --- a/pysollib/games/ultra/larasgame.py +++ b/pysollib/games/ultra/larasgame.py @@ -21,19 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.games.larasgame import LarasGame_Talon, LarasGame, \ - LarasGame_Reserve - -from pysollib.stack import \ - OpenStack - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.larasgame import LarasGame, LarasGame_Reserve +from pysollib.games.larasgame import LarasGame_Talon +from pysollib.stack import OpenStack class DojoujisGame_Talon(LarasGame_Talon): diff --git a/pysollib/games/ultra/matrix.py b/pysollib/games/ultra/matrix.py index 02c74659..c9ce696a 100644 --- a/pysollib/games/ultra/matrix.py +++ b/pysollib/games/ultra/matrix.py @@ -21,21 +21,17 @@ # # ---------------------------------------------------------------------------## -# Imports import math -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.pysoltk import bind - -from pysollib.util import ANY_RANK - from pysollib.stack import \ InitialDealTalonStack, \ OpenStack +from pysollib.util import ANY_RANK # ************************************************************************ # * Matrix Row Stack diff --git a/pysollib/games/ultra/mughal.py b/pysollib/games/ultra/mughal.py index fa086f7c..4fe097ff 100644 --- a/pysollib/games/ultra/mughal.py +++ b/pysollib/games/ultra/mughal.py @@ -21,27 +21,22 @@ # # ---------------------------------------------------------------------------## -# Imports import math -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import AbstractHint, DefaultHint +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.pysoltk import MfxCanvasText - -from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK, UNLIMITED_ACCEPTS, \ - UNLIMITED_CARDS, UNLIMITED_MOVES - from pysollib.stack import \ AC_RowStack, \ AbstractFoundationStack, \ BasicRowStack, \ DealRowTalonStack, \ InitialDealTalonStack, \ + OpenStack, \ RK_RowStack, \ ReserveStack, \ SS_FoundationStack, \ @@ -49,8 +44,10 @@ from pysollib.stack import \ StackWrapper, \ WasteStack, \ WasteTalonStack, \ - isSameSuitSequence, \ - OpenStack + isSameSuitSequence +from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK, UNLIMITED_ACCEPTS, \ + UNLIMITED_CARDS, UNLIMITED_MOVES + # ************************************************************************ # * Mughal Foundation Stacks diff --git a/pysollib/games/ultra/tarock.py b/pysollib/games/ultra/tarock.py index 95031358..1f34ba5d 100644 --- a/pysollib/games/ultra/tarock.py +++ b/pysollib/games/ultra/tarock.py @@ -21,28 +21,18 @@ # # ---------------------------------------------------------------------------## -# Imports - -# Ultrasol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault -from pysollib.layout import Layout - +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.special.tarock import AbstractTarockGame, Grasshopper from pysollib.games.threepeaks import ThreePeaksNoScore - -from pysollib.util import ANY_RANK, NO_RANK, UNLIMITED_ACCEPTS, UNLIMITED_MOVES - +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.stack import \ InitialDealTalonStack, \ + OpenStack, \ ReserveStack, \ SS_FoundationStack, \ - StackWrapper, \ - OpenStack - -# ************************************************************************ -# * -# ************************************************************************ + StackWrapper +from pysollib.util import ANY_RANK, NO_RANK, UNLIMITED_ACCEPTS, UNLIMITED_MOVES class Tarock_OpenStack(OpenStack): diff --git a/pysollib/games/unionsquare.py b/pysollib/games/unionsquare.py index ac43ad4b..07dbceff 100644 --- a/pysollib/games/unionsquare.py +++ b/pysollib/games/unionsquare.py @@ -21,26 +21,21 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.mfxutil import kwdefault -from pysollib.game import Game import pysollib.game -from pysollib.layout import Layout +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.hint import CautiousDefaultHint - -from pysollib.util import ACE, ANY_RANK, NO_RANK - +from pysollib.layout import Layout +from pysollib.mfxutil import kwdefault from pysollib.stack import \ AbstractFoundationStack, \ OpenStack, \ Stack, \ + StackWrapper, \ UD_SS_RowStack, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper + WasteTalonStack +from pysollib.util import ACE, ANY_RANK, NO_RANK # ************************************************************************ diff --git a/pysollib/games/wavemotion.py b/pysollib/games/wavemotion.py index 231db857..e6c8c195 100644 --- a/pysollib/games/wavemotion.py +++ b/pysollib/games/wavemotion.py @@ -21,22 +21,17 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.layout import Layout - -from pysollib.util import ANY_RANK - from pysollib.stack import \ AC_RowStack, \ InitialDealTalonStack, \ OpenStack, \ + SS_RowStack, \ isAlternateColorSequence, \ - isSameSuitSequence, \ - SS_RowStack + isSameSuitSequence +from pysollib.util import ANY_RANK # ************************************************************************ # * Wave Motion diff --git a/pysollib/games/windmill.py b/pysollib/games/windmill.py index d6b32313..88666c84 100644 --- a/pysollib/games/windmill.py +++ b/pysollib/games/windmill.py @@ -21,19 +21,12 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.game import Game import pysollib.game -from pysollib.layout import Layout -from pysollib.hint import CautiousDefaultHint - +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame from pysollib.games.golf import BlackHole_Foundation - -from pysollib.util import ACE, ANY_SUIT, KING, UNLIMITED_CARDS - +from pysollib.hint import CautiousDefaultHint +from pysollib.layout import Layout from pysollib.stack import \ AC_RowStack, \ RK_FoundationStack, \ @@ -41,10 +34,11 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ Stack, \ + StackWrapper, \ UD_RK_RowStack, \ WasteStack, \ - WasteTalonStack, \ - StackWrapper + WasteTalonStack +from pysollib.util import ACE, ANY_SUIT, KING, UNLIMITED_CARDS # ************************************************************************ # * diff --git a/pysollib/games/yukon.py b/pysollib/games/yukon.py index ef711168..79dbf38a 100644 --- a/pysollib/games/yukon.py +++ b/pysollib/games/yukon.py @@ -21,13 +21,14 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import ANY_SUIT, KING +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.games.spider import Spider_SS_Foundation +from pysollib.hint import Yukon_Hint +from pysollib.layout import Layout from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxCanvasText from pysollib.stack import \ DealRowTalonStack, \ InitialDealTalonStack, \ @@ -36,17 +37,11 @@ from pysollib.stack import \ ReserveStack, \ SS_FoundationStack, \ StackWrapper, \ - Yukon_AC_RowStack, \ - Yukon_SS_RowStack, \ WasteStack, \ - WasteTalonStack - -from pysollib.game import Game -from pysollib.layout import Layout -from pysollib.hint import Yukon_Hint -from pysollib.pysoltk import MfxCanvasText - -from pysollib.games.spider import Spider_SS_Foundation + WasteTalonStack, \ + Yukon_AC_RowStack, \ + Yukon_SS_RowStack +from pysollib.util import ANY_SUIT, KING # ************************************************************************ diff --git a/pysollib/games/zodiac.py b/pysollib/games/zodiac.py index db52ecf1..ada4d76c 100644 --- a/pysollib/games/zodiac.py +++ b/pysollib/games/zodiac.py @@ -21,11 +21,9 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.gamedb import registerGame, GameInfo, GI -from pysollib.util import KING, NO_RANK, UNLIMITED_REDEALS +from pysollib.game import Game +from pysollib.gamedb import GI, GameInfo, registerGame +from pysollib.layout import Layout from pysollib.stack import \ OpenStack, \ ReserveStack, \ @@ -34,8 +32,7 @@ from pysollib.stack import \ UD_SS_RowStack, \ WasteStack, \ WasteTalonStack -from pysollib.game import Game -from pysollib.layout import Layout +from pysollib.util import KING, NO_RANK, UNLIMITED_REDEALS # ************************************************************************ diff --git a/pysollib/help.py b/pysollib/help.py index ce0cd519..87bb8618 100644 --- a/pysollib/help.py +++ b/pysollib/help.py @@ -26,11 +26,11 @@ # PySol imports from pysollib.mygettext import _ -from pysollib.settings import TITLE, PACKAGE_URL, TOOLKIT, VERSION -from pysollib.pysoltk import make_help_toplevel +from pysollib.pysoltk import HTMLViewer from pysollib.pysoltk import MfxMessageDialog from pysollib.pysoltk import PysolAboutDialog -from pysollib.pysoltk import HTMLViewer +from pysollib.pysoltk import make_help_toplevel +from pysollib.settings import PACKAGE_URL, TITLE, TOOLKIT, VERSION # ************************************************************************ diff --git a/pysollib/hint.py b/pysollib/hint.py index 4588f817..e2b6f493 100644 --- a/pysollib/hint.py +++ b/pysollib/hint.py @@ -24,18 +24,19 @@ # imports import os -import time -import subprocess import re -import six +import subprocess +import time from io import BytesIO # PySol imports -from pysollib.settings import DEBUG, FCS_COMMAND -from pysollib.pysolrandom import constructRandom from pysollib.mfxutil import destruct +from pysollib.pysolrandom import constructRandom +from pysollib.settings import DEBUG, FCS_COMMAND from pysollib.util import KING +import six + FCS_VERSION = None # ************************************************************************ diff --git a/pysollib/htmllib2.py b/pysollib/htmllib2.py index 80e56d96..1e705ac8 100644 --- a/pysollib/htmllib2.py +++ b/pysollib/htmllib2.py @@ -4,9 +4,10 @@ See the HTML 2.0 specification: http://www.w3.org/hypertext/WWW/MarkUp/html-spec/html-spec_toc.html """ -from six.moves import html_parser from formatter import AS_IS +from six.moves import html_parser + class HTMLParseError(RuntimeError): """Error raised when an HTML document can't be parsed.""" diff --git a/pysollib/images.py b/pysollib/images.py index 9720f1f6..1d4e2e02 100644 --- a/pysollib/images.py +++ b/pysollib/images.py @@ -22,19 +22,13 @@ # ---------------------------------------------------------------------------## -# imports import os -# settings -from pysollib.settings import TOOLKIT - -# PySol imports -from pysollib.resource import CSI from pysollib.mfxutil import Image, ImageTk, USE_PIL - -# Toolkit imports -from pysollib.pysoltk import loadImage, copyImage, createImage, \ - shadowImage, createBottom +from pysollib.pysoltk import copyImage, createBottom, createImage, loadImage +from pysollib.pysoltk import shadowImage +from pysollib.resource import CSI +from pysollib.settings import TOOLKIT # ************************************************************************ # * Images diff --git a/pysollib/init.py b/pysollib/init.py index bc822548..569481a1 100644 --- a/pysollib/init.py +++ b/pysollib/init.py @@ -21,12 +21,12 @@ # # ---------------------------------------------------------------------------## -import sys -import os -import locale -import subprocess - import gettext +import locale +import os +import subprocess +import sys + import pysollib.settings # ************************************************************************ diff --git a/pysollib/kivy/LApp.py b/pysollib/kivy/LApp.py index 36eab9ec..6833bec5 100644 --- a/pysollib/kivy/LApp.py +++ b/pysollib/kivy/LApp.py @@ -25,38 +25,32 @@ import logging import math import traceback -from kivy.graphics import Color -from kivy.graphics import Rectangle -from kivy.graphics import Line -from kivy.graphics import Triangle - -from kivy.utils import platform -from kivy.properties import StringProperty - +from kivy.animation import Animation +from kivy.app import App from kivy.base import EventLoop from kivy.base import stopTouchApp -from kivy.app import App -from kivy.animation import Animation -from kivy.core.audio import SoundLoader +from kivy.cache import Cache from kivy.clock import Clock - -from kivy.uix.image import Image as KivyImage -from kivy.uix.boxlayout import BoxLayout -from kivy.uix.widget import Widget -from kivy.uix.button import Button +from kivy.core.audio import SoundLoader +from kivy.core.window import Window +from kivy.graphics import Color +from kivy.graphics import Line +from kivy.graphics import Rectangle +from kivy.graphics import Triangle +from kivy.properties import StringProperty +from kivy.uix.actionbar import ActionButton +from kivy.uix.actionbar import ActionPrevious +from kivy.uix.actionbar import ActionView from kivy.uix.behaviors import ButtonBehavior +from kivy.uix.boxlayout import BoxLayout +from kivy.uix.button import Button +from kivy.uix.image import Image as KivyImage from kivy.uix.label import Label from kivy.uix.scrollview import ScrollView - -from kivy.uix.actionbar import ActionView -from kivy.uix.actionbar import ActionPrevious -from kivy.uix.actionbar import ActionButton - from kivy.uix.treeview import TreeView from kivy.uix.treeview import TreeViewLabel - -from kivy.core.window import Window -from kivy.cache import Cache +from kivy.uix.widget import Widget +from kivy.utils import platform # ============================================================================= diff --git a/pysollib/kivy/card.py b/pysollib/kivy/card.py index 97a8bd1a..8ef7ad09 100644 --- a/pysollib/kivy/card.py +++ b/pysollib/kivy/card.py @@ -21,19 +21,10 @@ # # ---------------------------------------------------------------------------# -# PySol imports from pysollib.acard import AbstractCard - -# Toolkit imports -from pysollib.kivy.tkcanvas import MfxCanvasGroup, MfxCanvasImage - -# from tkutil import Image -from pysollib.kivy.LApp import LImageItem from pysollib.kivy.LApp import LImage - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.kivy.LApp import LImageItem +from pysollib.kivy.tkcanvas import MfxCanvasGroup, MfxCanvasImage class _HideableCard(AbstractCard): diff --git a/pysollib/kivy/menubar.py b/pysollib/kivy/menubar.py index 1afee528..d86e84b6 100644 --- a/pysollib/kivy/menubar.py +++ b/pysollib/kivy/menubar.py @@ -22,45 +22,36 @@ # # ---------------------------------------------------------------------------# -# imports import math import os import re -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import Struct -from pysollib.util import CARDSET -from pysollib.settings import TITLE -from pysollib.settings import SELECT_GAME_MENU -from pysollib.gamedb import GI - -# toolkit imports -from pysollib.kivy.tkconst import EVENT_HANDLED, EVENT_PROPAGATE, CURSOR_WATCH -from pysollib.kivy.tkutil import bind -from pysollib.kivy.tkutil import after_idle -from pysollib.kivy.selectcardset import SelectCardsetDialogWithPreview - -from pysollib.kivy.selectgame import SelectGameDialog -from pysollib.pysoltk import connect_game_find_card_dialog - -from pysollib.kivy.findcarddialog import destroy_find_card_dialog -from pysollib.kivy.solverdialog import connect_game_solver_dialog -from pysollib.kivy.tkconst import TOOLBAR_BUTTONS - -# Kivy +from kivy.event import EventDispatcher from kivy.properties import BooleanProperty from kivy.properties import NumericProperty from kivy.properties import StringProperty -from kivy.event import EventDispatcher - +from pysollib.gamedb import GI from pysollib.kivy.LApp import LMenu -from pysollib.kivy.LApp import LTreeNode from pysollib.kivy.LApp import LMenuItem -from pysollib.kivy.LApp import LTopLevel from pysollib.kivy.LApp import LScrollView +from pysollib.kivy.LApp import LTopLevel +from pysollib.kivy.LApp import LTreeNode from pysollib.kivy.LApp import LTreeRoot +from pysollib.kivy.findcarddialog import destroy_find_card_dialog +from pysollib.kivy.selectcardset import SelectCardsetDialogWithPreview +from pysollib.kivy.selectgame import SelectGameDialog +from pysollib.kivy.solverdialog import connect_game_solver_dialog +from pysollib.kivy.tkconst import CURSOR_WATCH, EVENT_HANDLED, EVENT_PROPAGATE +from pysollib.kivy.tkconst import TOOLBAR_BUTTONS +from pysollib.kivy.tkutil import after_idle +from pysollib.kivy.tkutil import bind +from pysollib.mfxutil import Struct +from pysollib.mygettext import _ +from pysollib.pysoltk import connect_game_find_card_dialog +from pysollib.settings import SELECT_GAME_MENU +from pysollib.settings import TITLE +from pysollib.util import CARDSET # ************************************************************************ diff --git a/pysollib/kivy/selectcardset.py b/pysollib/kivy/selectcardset.py index 86ab3b17..69b51d12 100644 --- a/pysollib/kivy/selectcardset.py +++ b/pysollib/kivy/selectcardset.py @@ -21,15 +21,8 @@ # # ---------------------------------------------------------------------------# - -# imports -# import os - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import kwdefault - -# Toolkit imports +from pysollib.mygettext import _ from pysollib.pysoltk import MfxDialog # ************************************************************************ diff --git a/pysollib/kivy/selectgame.py b/pysollib/kivy/selectgame.py index 137dfca1..f333e518 100644 --- a/pysollib/kivy/selectgame.py +++ b/pysollib/kivy/selectgame.py @@ -21,24 +21,18 @@ # # ---------------------------------------------------------------------------# -# imports -# import os -from six.moves import UserList +from kivy.clock import Clock -# PySol imports -from pysollib.mygettext import _ from pysollib.gamedb import GI - -# Toolkit imports -from pysollib.kivy.selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode -from pysollib.kivy.selecttree import SelectDialogTreeData from pysollib.kivy.LApp import LScrollView from pysollib.kivy.LApp import LTopLevel from pysollib.kivy.LApp import LTreeNode from pysollib.kivy.LApp import LTreeRoot +from pysollib.kivy.selecttree import SelectDialogTreeData +from pysollib.kivy.selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from pysollib.mygettext import _ -# Kivy imports -from kivy.clock import Clock +from six.moves import UserList # ************************************************************************ diff --git a/pysollib/kivy/selecttree.py b/pysollib/kivy/selecttree.py index 12ae8db1..f7d698f7 100644 --- a/pysollib/kivy/selecttree.py +++ b/pysollib/kivy/selecttree.py @@ -25,7 +25,7 @@ # import tkFont # Toolkit imports -from pysollib.kivy.tktree import MfxTreeLeaf, MfxTreeNode, MfxTreeInCanvas +from pysollib.kivy.tktree import MfxTreeInCanvas, MfxTreeLeaf, MfxTreeNode # ************************************************************************ # * Nodes diff --git a/pysollib/kivy/tkcanvas.py b/pysollib/kivy/tkcanvas.py index 18934f72..ec1a0502 100644 --- a/pysollib/kivy/tkcanvas.py +++ b/pysollib/kivy/tkcanvas.py @@ -23,25 +23,23 @@ # ---------------------------------------------------------------------------# from __future__ import division + import logging -# PySol imports -# from pysollib.mfxutil import Image, ImageTk -from pysollib.kivy.LApp import LImage -from pysollib.kivy.LApp import LImage as Image -from pysollib.kivy.LApp import LImageItem -from pysollib.kivy.LApp import LColorToKivy -from pysollib.kivy.LApp import LText -from pysollib.kivy.LApp import LRectangle -from pysollib.kivy.LApp import LLine -from pysollib.kivy.LApp import LAnimationManager - -# kivy imports -from kivy.uix.widget import Widget -from kivy.uix.anchorlayout import AnchorLayout from kivy.clock import Clock from kivy.graphics import Color from kivy.graphics import Rectangle +from kivy.uix.anchorlayout import AnchorLayout +from kivy.uix.widget import Widget + +from pysollib.kivy.LApp import LAnimationManager +from pysollib.kivy.LApp import LColorToKivy +from pysollib.kivy.LApp import LImage +from pysollib.kivy.LApp import LImage as Image +from pysollib.kivy.LApp import LImageItem +from pysollib.kivy.LApp import LLine +from pysollib.kivy.LApp import LRectangle +from pysollib.kivy.LApp import LText # ************************************************************************ # * canvas items helpers diff --git a/pysollib/kivy/tkhtml.py b/pysollib/kivy/tkhtml.py index e3daaf0a..4c545216 100644 --- a/pysollib/kivy/tkhtml.py +++ b/pysollib/kivy/tkhtml.py @@ -21,26 +21,23 @@ # # ---------------------------------------------------------------------------# -# imports +import formatter import os import sys -# import htmllib -import pysollib.htmllib2 as htmllib -import formatter - -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import Struct, openURL -from pysollib.settings import TITLE -from pysollib.kivy.LApp import LTopLevel -from pysollib.kivy.LApp import LScrollView -from pysollib.kivy.LApp import LPopCommander -from pysollib.kivy.LApp import get_platform -from pysollib.pysoltk import MfxMessageDialog from kivy.uix.boxlayout import BoxLayout -from kivy.uix.label import Label from kivy.uix.button import Button +from kivy.uix.label import Label + +import pysollib.htmllib2 as htmllib +from pysollib.kivy.LApp import LPopCommander +from pysollib.kivy.LApp import LScrollView +from pysollib.kivy.LApp import LTopLevel +from pysollib.kivy.LApp import get_platform +from pysollib.mfxutil import Struct, openURL +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxMessageDialog +from pysollib.settings import TITLE REMOTE_PROTOCOLS = ("ftp:", "gopher:", "http:", "mailto:", "news:", "telnet:") diff --git a/pysollib/kivy/tkstats.py b/pysollib/kivy/tkstats.py index cd976100..f35475db 100644 --- a/pysollib/kivy/tkstats.py +++ b/pysollib/kivy/tkstats.py @@ -24,28 +24,27 @@ # import os # import time -# PySol imports -# from pysollib.mygettext import _, n_ -from pysollib.mygettext import _ -# from pysollib.mfxutil import kwdefault, KwStruct -from pysollib.mfxutil import KwStruct -# from pysollib.mfxutil import format_time -# from pysollib.util import * -# from pysollib.stats import PysolStatsFormatter, ProgressionFormatter -from pysollib.settings import TOP_TITLE -from pysollib.kivy.LApp import LImage - -# Toolkit imports -# from tkutil import bind, unbind_destroy, loadImage -from pysollib.pysoltk import MfxDialog, MfxMessageDialog -# from pysollib.pysoltk import MfxScrolledCanvas - # Kivy # from LApp import * -from kivy.uix.label import Label -from kivy.uix.widget import Widget from kivy.graphics import Color from kivy.graphics import Line +from kivy.uix.label import Label +from kivy.uix.widget import Widget + +# PySol imports +# Toolkit imports +# from pysollib.mfxutil import format_time +# from pysollib.mfxutil import kwdefault, KwStruct +# from pysollib.mygettext import _, n_ +# from pysollib.pysoltk import MfxScrolledCanvas +# from pysollib.stats import PysolStatsFormatter, ProgressionFormatter +# from pysollib.util import * +# from tkutil import bind, unbind_destroy, loadImage +from pysollib.kivy.LApp import LImage +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ +from pysollib.pysoltk import MfxDialog, MfxMessageDialog +from pysollib.settings import TOP_TITLE # FIXME - this file a quick hack and needs a rewrite diff --git a/pysollib/kivy/tkutil.py b/pysollib/kivy/tkutil.py index e0c808bc..45b114d5 100644 --- a/pysollib/kivy/tkutil.py +++ b/pysollib/kivy/tkutil.py @@ -27,20 +27,17 @@ from __future__ import division -# imports -import os import logging +import os from array import array -# Toolkit imports -from pysollib.kivy.LApp import LTopLevel0 -from pysollib.kivy.LApp import LImage - -# Kivy imports -from kivy.core.text import Label as CoreLabel -from kivy.core.image import Image as CoreImage -from kivy.graphics.texture import Texture from kivy.clock import Clock +from kivy.core.image import Image as CoreImage +from kivy.core.text import Label as CoreLabel +from kivy.graphics.texture import Texture + +from pysollib.kivy.LApp import LImage +from pysollib.kivy.LApp import LTopLevel0 # ************************************************************************ # * window manager util diff --git a/pysollib/kivy/tkwidget.py b/pysollib/kivy/tkwidget.py index ff9d82d8..cc59b864 100644 --- a/pysollib/kivy/tkwidget.py +++ b/pysollib/kivy/tkwidget.py @@ -27,29 +27,25 @@ # # Kivy Implementation used: MfxScrolledCanvas, MfxDialog (partly) -# imports from __future__ import division + import logging -# PySol imports -from pysollib.mfxutil import kwdefault, KwStruct -from pysollib.settings import WIN_SYSTEM -from pysollib.mygettext import _ +from kivy.clock import Clock +from kivy.uix.anchorlayout import AnchorLayout +from kivy.uix.boxlayout import BoxLayout +from kivy.uix.label import Label -# Toolkit imports +from pysollib.kivy.LApp import LBoxLayout +from pysollib.kivy.LApp import LImage +from pysollib.kivy.LApp import LScrollView +from pysollib.kivy.LApp import LTopLevel +from pysollib.kivy.tkcanvas import MfxCanvas from pysollib.kivy.tkutil import bind, unbind_destroy from pysollib.kivy.tkutil import makeToplevel -from pysollib.kivy.tkcanvas import MfxCanvas -from pysollib.kivy.LApp import LImage -from pysollib.kivy.LApp import LTopLevel -from pysollib.kivy.LApp import LBoxLayout -from pysollib.kivy.LApp import LScrollView - -# kivy -from kivy.uix.boxlayout import BoxLayout -from kivy.clock import Clock -from kivy.uix.label import Label -from kivy.uix.anchorlayout import AnchorLayout +from pysollib.mfxutil import KwStruct, kwdefault +from pysollib.mygettext import _ +from pysollib.settings import WIN_SYSTEM # ************************************************************************ # * abstract base class for the dialogs in this module diff --git a/pysollib/kivy/tkwrap.py b/pysollib/kivy/tkwrap.py index e47531a5..878f4b15 100644 --- a/pysollib/kivy/tkwrap.py +++ b/pysollib/kivy/tkwrap.py @@ -22,6 +22,7 @@ # ---------------------------------------------------------------------------# import logging + from kivy.cache import Cache TclError = 0 diff --git a/pysollib/kivy/toolbar.py b/pysollib/kivy/toolbar.py index e3082567..dc16ebf8 100644 --- a/pysollib/kivy/toolbar.py +++ b/pysollib/kivy/toolbar.py @@ -22,10 +22,10 @@ import os # PySol imports -from pysollib.util import IMAGE_EXTENSIONS -from pysollib.settings import TITLE -from pysollib.winsystems import TkSettings from pysollib.mygettext import _, n_ +from pysollib.settings import TITLE +from pysollib.util import IMAGE_EXTENSIONS +from pysollib.winsystems import TkSettings # ************************************************************************ # * diff --git a/pysollib/macosx/appSupport.py b/pysollib/macosx/appSupport.py index 2cfe794f..f64e724c 100644 --- a/pysollib/macosx/appSupport.py +++ b/pysollib/macosx/appSupport.py @@ -25,6 +25,7 @@ A number of function that enhance PySol on MacOSX when it used as a normal GUI application (as opposed to an X11 application). """ import sys + from six.moves.tkinter import TclError diff --git a/pysollib/main.py b/pysollib/main.py index 55b3eccd..f3b6fd9f 100644 --- a/pysollib/main.py +++ b/pysollib/main.py @@ -22,31 +22,28 @@ # ---------------------------------------------------------------------------## # imports +import getopt import os import sys import traceback -import getopt -# PySol imports -from pysollib.mygettext import _ -from pysollib.util import DataLoader -from pysollib.mfxutil import print_err -from pysollib.resource import Tile from pysollib.app import Application from pysollib.gamedb import GAME_DB -from pysollib.pysolaudio import AbstractAudioClient, \ - PysolSoundServerModuleClient -from pysollib.pysolaudio import Win32AudioClient, OSSAudioClient, \ - PyGameAudioClient, KivyAudioClient +from pysollib.mfxutil import print_err +from pysollib.mygettext import _ +from pysollib.pysolaudio import AbstractAudioClient +from pysollib.pysolaudio import KivyAudioClient, OSSAudioClient +from pysollib.pysolaudio import PyGameAudioClient, Win32AudioClient +from pysollib.pysolaudio import PysolSoundServerModuleClient from pysollib.pysolaudio import pysolsoundserver -from pysollib.settings import TITLE, SOUND_MOD, TOOLKIT -from pysollib.winsystems import init_root_window - -# Toolkit imports -from pysollib.pysoltk import loadImage from pysollib.pysoltk import MfxMessageDialog from pysollib.pysoltk import MfxRoot from pysollib.pysoltk import PysolProgressBar +from pysollib.pysoltk import loadImage +from pysollib.resource import Tile +from pysollib.settings import SOUND_MOD, TITLE, TOOLKIT +from pysollib.util import DataLoader +from pysollib.winsystems import init_root_window # ************************************************************************ # * diff --git a/pysollib/mfxutil.py b/pysollib/mfxutil.py index ee8b9efd..a0d0aed4 100644 --- a/pysollib/mfxutil.py +++ b/pysollib/mfxutil.py @@ -21,20 +21,19 @@ # # ---------------------------------------------------------------------------## -# imports +import locale +import os import re import sys -import six -import os import time -import locale import webbrowser -from six import print_ - from pickle import Pickler, Unpickler from pysollib.settings import PACKAGE, TOOLKIT +import six +from six import print_ + Image = ImageTk = ImageOps = None if TOOLKIT == 'tk': try: # PIL diff --git a/pysollib/mygettext.py b/pysollib/mygettext.py index 43080ee1..135c17ac 100644 --- a/pysollib/mygettext.py +++ b/pysollib/mygettext.py @@ -1,5 +1,6 @@ import gettext import sys + import six @@ -7,6 +8,27 @@ def n_(x): return x +def ungettext(msgid1, msgid2, n): + # unicoded ngettext + if not isinstance(msgid1, six.text_type): + msgid1 = six.text_type(msgid1, 'utf-8') + if not isinstance(msgid2, six.text_type): + msgid2 = six.text_type(msgid2, 'utf-8') + domain = gettext._current_domain + try: + t = gettext.translation(domain, + gettext._localedirs.get(domain, None)) + except IOError: + if n == 1: + return msgid1 + else: + return msgid2 + if sys.version_info >= (3, 0): + return t.ngettext(msgid1, msgid2, n) + else: + return t.ungettext(msgid1, msgid2, n) + + def fix_gettext(): def ugettext(message): # unicoded gettext @@ -25,25 +47,6 @@ def fix_gettext(): gettext.ugettext = ugettext - def ungettext(msgid1, msgid2, n): - # unicoded ngettext - if not isinstance(msgid1, six.text_type): - msgid1 = six.text_type(msgid1, 'utf-8') - if not isinstance(msgid2, six.text_type): - msgid2 = six.text_type(msgid2, 'utf-8') - domain = gettext._current_domain - try: - t = gettext.translation(domain, - gettext._localedirs.get(domain, None)) - except IOError: - if n == 1: - return msgid1 - else: - return msgid2 - if sys.version_info >= (3, 0): - return t.ngettext(msgid1, msgid2, n) - else: - return t.ungettext(msgid1, msgid2, n) gettext.ungettext = ungettext diff --git a/pysollib/options.py b/pysollib/options.py index c3c690ba..408a21c9 100644 --- a/pysollib/options.py +++ b/pysollib/options.py @@ -21,22 +21,19 @@ # # ---------------------------------------------------------------------------## -# imports -import sys -import six import os +import sys import traceback -# PySol imports -from pysollib.mfxutil import print_err -from pysollib.resource import CSI -from pysollib.configobj import configobj, validate + import pysollib.settings - -# Toolkit imports -from pysollib.pysoltk import TOOLBAR_BUTTONS, TOOLKIT - +from pysollib.configobj import configobj, validate +from pysollib.mfxutil import print_err from pysollib.mygettext import _ +from pysollib.pysoltk import TOOLBAR_BUTTONS, TOOLKIT +from pysollib.resource import CSI + +import six # ************************************************************************ # * Options diff --git a/pysollib/pysolaudio.py b/pysollib/pysolaudio.py index fed70348..1f399b8f 100644 --- a/pysollib/pysolaudio.py +++ b/pysollib/pysolaudio.py @@ -25,7 +25,6 @@ # imports import os import traceback - from threading import Thread try: diff --git a/pysollib/pysolgtk/colorsdialog.py b/pysollib/pysolgtk/colorsdialog.py index 98dc7fd4..784c08f4 100644 --- a/pysollib/pysolgtk/colorsdialog.py +++ b/pysollib/pysolgtk/colorsdialog.py @@ -21,18 +21,17 @@ # # ---------------------------------------------------------------------------## -# imports -from pysollib.mygettext import _ -# import os, sys import gtk import gtk.glade from gtk import gdk +from pysollib.mygettext import _ # ************************************************************************ # * # ************************************************************************ + class ColorsDialog: def __init__(self, parent, title, app, **kw): diff --git a/pysollib/pysolgtk/fontsdialog.py b/pysollib/pysolgtk/fontsdialog.py index a9bf043b..34587c21 100644 --- a/pysollib/pysolgtk/fontsdialog.py +++ b/pysollib/pysolgtk/fontsdialog.py @@ -21,15 +21,13 @@ # # --------------------------------------------------------------------------- -# imports -# import os, sys -# import types import gtk -import pango import gtk.glade -# PySol imports +import pango + from pysollib.mygettext import _ + from tkutil import create_pango_font_desc diff --git a/pysollib/pysolgtk/menubar.py b/pysollib/pysolgtk/menubar.py index bb483d74..309e2fba 100644 --- a/pysollib/pysolgtk/menubar.py +++ b/pysollib/pysolgtk/menubar.py @@ -26,21 +26,23 @@ import os import re +from findcarddialog import connect_game_find_card_dialog, \ + destroy_find_card_dialog + import gtk from gtk import gdk -# PySol imports -from pysollib.mygettext import _ from pysollib.gamedb import GI +from pysollib.mygettext import _ from pysollib.settings import TITLE -# toolkit imports -from soundoptionsdialog import SoundOptionsDialog from selectcardset import SelectCardsetDialogWithPreview -from selecttile import SelectTileDialogWithPreview + from selectgame import SelectGameDialogWithPreview -from findcarddialog import connect_game_find_card_dialog, \ - destroy_find_card_dialog + +from selecttile import SelectTileDialogWithPreview + +from soundoptionsdialog import SoundOptionsDialog def ltk2gtk(s): diff --git a/pysollib/pysolgtk/playeroptionsdialog.py b/pysollib/pysolgtk/playeroptionsdialog.py index 5f4ddeb9..e58fc224 100644 --- a/pysollib/pysolgtk/playeroptionsdialog.py +++ b/pysollib/pysolgtk/playeroptionsdialog.py @@ -21,16 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports import gobject + import gtk -# PySol imports +from pysollib.mfxutil import kwdefault from pysollib.mygettext import _ # Toolkit imports from tkwidget import MfxDialog -from pysollib.mfxutil import kwdefault # ************************************************************************ diff --git a/pysollib/pysolgtk/pysoltree.py b/pysollib/pysolgtk/pysoltree.py index 125e6ba1..fde31fe0 100644 --- a/pysollib/pysolgtk/pysoltree.py +++ b/pysollib/pysolgtk/pysoltree.py @@ -21,19 +21,10 @@ # # ---------------------------------------------------------------------------## - -# imports -import gtk import gobject -# PySol imports +import gtk -# Toolkit imports - - -# ************************************************************************ -# * -# ************************************************************************ class PysolTreeView: diff --git a/pysollib/pysolgtk/selectcardset.py b/pysollib/pysolgtk/selectcardset.py index ccef27b2..1005071e 100644 --- a/pysollib/pysolgtk/selectcardset.py +++ b/pysollib/pysolgtk/selectcardset.py @@ -21,23 +21,24 @@ # # ---------------------------------------------------------------------------## - -# imports import os -import gtk + import gobject -# PySol imports +import gtk + +from pysollib.mfxutil import kwdefault from pysollib.mygettext import _ from pysollib.resource import CSI -from pysollib.mfxutil import kwdefault -# Toolkit imports -from tkwidget import MfxDialog from pysoltree import PysolTreeView + from tkcanvas import MfxCanvas, MfxCanvasImage + from tkutil import loadImage +from tkwidget import MfxDialog + # ************************************************************************ # * Dialog diff --git a/pysollib/pysolgtk/selectgame.py b/pysollib/pysolgtk/selectgame.py index 066e6f4c..7cd74648 100644 --- a/pysollib/pysolgtk/selectgame.py +++ b/pysollib/pysolgtk/selectgame.py @@ -21,29 +21,29 @@ # # ---------------------------------------------------------------------------## - # imports import os -import gtk + import gobject -# from UserList import UserList +import gtk -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import destruct, Struct -from pysollib.mfxutil import kwdefault -from pysollib.mfxutil import format_time from pysollib.gamedb import GI from pysollib.help import help_html +from pysollib.mfxutil import Struct, destruct +from pysollib.mfxutil import format_time +from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ from pysollib.resource import CSI -# Toolkit imports -from tkutil import unbind_destroy -from tkwidget import MfxDialog -from tkcanvas import MfxCanvas from pysoltree import PysolTreeView +from tkcanvas import MfxCanvas + +from tkutil import unbind_destroy + +from tkwidget import MfxDialog + # ************************************************************************ # * Dialog diff --git a/pysollib/pysolgtk/selecttile.py b/pysollib/pysolgtk/selecttile.py index 91632950..63520310 100644 --- a/pysollib/pysolgtk/selecttile.py +++ b/pysollib/pysolgtk/selecttile.py @@ -22,25 +22,22 @@ # ---------------------------------------------------------------------------## -# imports - -# import os, string, sys, types import gobject + import gtk from gtk import gdk -# PySol imports -# from pysollib.mfxutil import destruct, Struct, KwStruct -from pysollib.mygettext import _ from pysollib.mfxutil import kwdefault +from pysollib.mygettext import _ -# Toolkit imports -# from tkutil import loadImage -from tkwidget import MfxDialog -from tkcanvas import MfxCanvas -from tkutil import setTransient from pysoltree import PysolTreeView +from tkcanvas import MfxCanvas + +from tkutil import setTransient + +from tkwidget import MfxDialog + class SelectTileDialogWithPreview(MfxDialog): diff --git a/pysollib/pysolgtk/statusbar.py b/pysollib/pysolgtk/statusbar.py index 4c8e0150..5ac50a49 100644 --- a/pysollib/pysolgtk/statusbar.py +++ b/pysollib/pysolgtk/statusbar.py @@ -21,17 +21,11 @@ # # ---------------------------------------------------------------------------## - -# imports import gtk -import six -# PySol imports from pysollib.mygettext import _ -# ************************************************************************ -# * -# ************************************************************************ +import six class BasicStatusbar: diff --git a/pysollib/pysolgtk/timeoutsdialog.py b/pysollib/pysolgtk/timeoutsdialog.py index f62c4cd3..55010814 100644 --- a/pysollib/pysolgtk/timeoutsdialog.py +++ b/pysollib/pysolgtk/timeoutsdialog.py @@ -21,17 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports -# import os, sys -from pysollib.mygettext import _ import gtk import gtk.glade +from pysollib.mygettext import _ # ************************************************************************ # * # ************************************************************************ + class TimeoutsDialog: def __init__(self, parent, title, app, **kw): diff --git a/pysollib/pysolgtk/tkcanvas.py b/pysollib/pysolgtk/tkcanvas.py index cf0313a7..ee5edc0c 100644 --- a/pysollib/pysolgtk/tkcanvas.py +++ b/pysollib/pysolgtk/tkcanvas.py @@ -39,11 +39,10 @@ # around. # - -# imports - import gobject + import gtk + try: import gnomecanvas except ImportError: diff --git a/pysollib/pysolgtk/tkhtml.py b/pysollib/pysolgtk/tkhtml.py index a167f80f..00ffe812 100644 --- a/pysollib/pysolgtk/tkhtml.py +++ b/pysollib/pysolgtk/tkhtml.py @@ -21,25 +21,25 @@ # # --------------------------------------------------------------------------- -# imports +import formatter +import htmllib import os import sys -import six -import htmllib -import formatter import traceback -from pysollib.mygettext import _ + +import gobject import gtk -import pango -import gobject from gtk import gdk -# PySol imports +import pango + from pysollib.mfxutil import Struct, openURL +from pysollib.mygettext import _ from pysollib.settings import TITLE -# Toolkit imports +import six + from tkwidget import MfxMessageDialog if __name__ == '__main__': diff --git a/pysollib/pysolgtk/tkstats.py b/pysollib/pysolgtk/tkstats.py index a00dab77..130d23b3 100644 --- a/pysollib/pysolgtk/tkstats.py +++ b/pysollib/pysolgtk/tkstats.py @@ -22,24 +22,23 @@ # ---------------------------------------------------------------------------## -# imports import sys import time -import gtk + import gobject -import pango + +import gtk import gtk.glade -# PySol imports -from pysollib.mygettext import _ +import pango + from pysollib.mfxutil import format_time +from pysollib.mygettext import _ from pysollib.settings import TITLE from pysollib.stats import PysolStatsFormatter -# Toolkit imports from tkwidget import MfxMessageDialog - if sys.version_info > (3,): def cmp(a, b): return ((b > a)-(a > b)) diff --git a/pysollib/pysolgtk/tkutil.py b/pysollib/pysolgtk/tkutil.py index 6d222988..6c9410a4 100644 --- a/pysollib/pysolgtk/tkutil.py +++ b/pysollib/pysolgtk/tkutil.py @@ -21,15 +21,15 @@ # # --------------------------------------------------------------------------- - -# imports import string import gobject + import gtk -import pango from gtk import gdk +import pango + # ************************************************************************ # * window util diff --git a/pysollib/pysolgtk/tkwidget.py b/pysollib/pysolgtk/tkwidget.py index a6e2db28..3628c10d 100644 --- a/pysollib/pysolgtk/tkwidget.py +++ b/pysollib/pysolgtk/tkwidget.py @@ -21,20 +21,13 @@ # # --------------------------------------------------------------------------- - -# imports - import gtk -# PySol imports +from pysollib.mfxutil import KwStruct, kwdefault, openURL from pysollib.mygettext import _ -# Toolkit imports from tkutil import setTransient -from pysollib.mfxutil import kwdefault, KwStruct, openURL - - gdk = gtk.gdk # ************************************************************************ # * diff --git a/pysollib/pysolrandom.py b/pysollib/pysolrandom.py index 58d11267..319094f2 100644 --- a/pysollib/pysolrandom.py +++ b/pysollib/pysolrandom.py @@ -25,6 +25,7 @@ # imports import re import time + from pysollib.mfxutil import SubclassResponsibility try: import random2 diff --git a/pysollib/resource.py b/pysollib/resource.py index a67168d3..6f3add63 100644 --- a/pysollib/resource.py +++ b/pysollib/resource.py @@ -21,18 +21,15 @@ # # ---------------------------------------------------------------------------## - -# imports -import os import glob +import os import traceback -import six -# PySol imports -from pysollib.mfxutil import Struct, KwStruct +from pysollib.mfxutil import KwStruct, Struct +from pysollib.mygettext import _ from pysollib.settings import DEBUG -from pysollib.mygettext import _ +import six # ************************************************************************ # * Abstract diff --git a/pysollib/stack.py b/pysollib/stack.py index f972991d..0db2746c 100644 --- a/pysollib/stack.py +++ b/pysollib/stack.py @@ -21,23 +21,22 @@ # # --------------------------------------------------------------------------- -from pysollib.mygettext import _ -# PySol imports -from pysollib.mfxutil import Struct, kwdefault, SubclassResponsibility from pysollib.mfxutil import Image, ImageTk, USE_PIL -from pysollib.util import ACE, KING -from pysollib.util import ANY_SUIT, ANY_RANK, NO_RANK -from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE -from pysollib.pysoltk import CURSOR_DRAG, CURSOR_DOWN_ARROW +from pysollib.mfxutil import Struct, SubclassResponsibility, kwdefault +from pysollib.mygettext import _ from pysollib.pysoltk import ANCHOR_NW, ANCHOR_SE +from pysollib.pysoltk import CURSOR_DOWN_ARROW, CURSOR_DRAG +from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE +from pysollib.pysoltk import MfxCanvasGroup, MfxCanvasImage +from pysollib.pysoltk import MfxCanvasRectangle, MfxCanvasText +from pysollib.pysoltk import after_cancel, after_idle from pysollib.pysoltk import bind, unbind_destroy -from pysollib.pysoltk import after_idle, after_cancel -from pysollib.pysoltk import MfxCanvasGroup, MfxCanvasImage, \ - MfxCanvasRectangle, MfxCanvasText from pysollib.pysoltk import get_text_width from pysollib.pysoltk import markImage -from pysollib.settings import TOOLKIT from pysollib.settings import DEBUG +from pysollib.settings import TOOLKIT +from pysollib.util import ACE, KING +from pysollib.util import ANY_RANK, ANY_SUIT, NO_RANK # ************************************************************************ # * Let's start with some test methods for cards. @@ -1605,7 +1604,7 @@ class Stack: return s def getNumCards(self): - from gettext import ungettext + from pysollib.mygettext import ungettext n = len(self.cards) if n == 0: return _('No cards') @@ -1939,7 +1938,7 @@ class TalonStack(Stack, return self.game.app.gimages.redeal def getHelp(self): - from gettext import ungettext + from pysollib.mygettext import ungettext if self.max_rounds == -2: nredeals = _('Variable redeals.') elif self.max_rounds == -1: diff --git a/pysollib/stats.py b/pysollib/stats.py index 567689e1..5daec02c 100644 --- a/pysollib/stats.py +++ b/pysollib/stats.py @@ -21,15 +21,14 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import range import time -# PySol imports -from pysollib.mfxutil import format_time from pysollib.gamedb import GI +from pysollib.mfxutil import format_time from pysollib.mygettext import _ +from six.moves import range + # ************************************************************************ # * # ************************************************************************ diff --git a/pysollib/tile/basetilemfxdialog.py b/pysollib/tile/basetilemfxdialog.py index fcef8a7e..6628fc1b 100644 --- a/pysollib/tile/basetilemfxdialog.py +++ b/pysollib/tile/basetilemfxdialog.py @@ -1,5 +1,4 @@ from . import ttk - from .tkwidget import MfxDialog diff --git a/pysollib/tile/colorsdialog.py b/pysollib/tile/colorsdialog.py index f09b9325..68cdafd7 100644 --- a/pysollib/tile/colorsdialog.py +++ b/pysollib/tile/colorsdialog.py @@ -21,8 +21,8 @@ # # ---------------------------------------------------------------------------## -from pysollib.ui.tktile.colorsdialog import BaseColorsDialog from pysollib.tile.basetilemfxdialog import BaseTileMfxDialog +from pysollib.ui.tktile.colorsdialog import BaseColorsDialog # ************************************************************************ # * diff --git a/pysollib/tile/fontsdialog.py b/pysollib/tile/fontsdialog.py index cd90964f..109b8ce4 100644 --- a/pysollib/tile/fontsdialog.py +++ b/pysollib/tile/fontsdialog.py @@ -21,18 +21,15 @@ # # --------------------------------------------------------------------------- -# imports -from six.moves import tkinter -from . import ttk -from six.moves import tkinter_font - -# PySol imports from pysollib.mfxutil import KwStruct from pysollib.mygettext import _ - -# Toolkit imports -from .tkwidget import MfxDialog from pysollib.ui.tktile.tkutil import bind + +from six.moves import tkinter +from six.moves import tkinter_font + +from . import ttk +from .tkwidget import MfxDialog from .tkwidget import PysolScale diff --git a/pysollib/tile/menubar.py b/pysollib/tile/menubar.py index e1b89d09..2bd45492 100644 --- a/pysollib/tile/menubar.py +++ b/pysollib/tile/menubar.py @@ -21,24 +21,20 @@ # # ---------------------------------------------------------------------------## -# imports -from . import ttk - -# PySol imports from pysollib.mygettext import _, n_ -from pysollib.util import CARDSET from pysollib.settings import TITLE - -# toolkit imports -from .tkwidget import MfxMessageDialog -from .selectgame import SelectGameDialog, SelectGameDialogWithPreview -from .soundoptionsdialog import SoundOptionsDialog -from .selecttile import SelectTileDialogWithPreview -from pysollib.ui.tktile.findcarddialog import connect_game_find_card_dialog, \ - destroy_find_card_dialog -from pysollib.ui.tktile.solverdialog import connect_game_solver_dialog - +from pysollib.ui.tktile.findcarddialog import connect_game_find_card_dialog +from pysollib.ui.tktile.findcarddialog import destroy_find_card_dialog from pysollib.ui.tktile.menubar import MfxMenu, PysolMenubarTkCommon +from pysollib.ui.tktile.solverdialog import connect_game_solver_dialog +from pysollib.util import CARDSET + +from . import ttk +from .selectgame import SelectGameDialog, SelectGameDialogWithPreview +from .selecttile import SelectTileDialogWithPreview +from .soundoptionsdialog import SoundOptionsDialog +from .tkwidget import MfxMessageDialog + # ************************************************************************ # * - create menubar # * - update menubar diff --git a/pysollib/tile/playeroptionsdialog.py b/pysollib/tile/playeroptionsdialog.py index 0426258a..ce4dd3ee 100644 --- a/pysollib/tile/playeroptionsdialog.py +++ b/pysollib/tile/playeroptionsdialog.py @@ -21,22 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import tkinter -from . import ttk - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ -# Toolkit imports +from six.moves import tkinter + +from . import ttk from .tkwidget import MfxDialog -# ************************************************************************ -# * -# ************************************************************************ - class PlayerOptionsDialog(MfxDialog): def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) diff --git a/pysollib/tile/progressbar.py b/pysollib/tile/progressbar.py index 3639dae2..6b3505fe 100644 --- a/pysollib/tile/progressbar.py +++ b/pysollib/tile/progressbar.py @@ -21,19 +21,18 @@ # # --------------------------------------------------------------------------- -# imports -from six.moves import tkinter -from . import ttk - -# Toolkit imports from pysollib.ui.tktile.tkconst import EVENT_HANDLED from pysollib.ui.tktile.tkutil import makeToplevel, setTransient +from six.moves import tkinter + +from . import ttk # ************************************************************************ # * a simple progress bar # ************************************************************************ + class PysolProgressBar: def __init__(self, app, parent, title=None, images=None, color="blue", width=300, height=25, show_text=1, norm=1): diff --git a/pysollib/tile/selectcardset.py b/pysollib/tile/selectcardset.py index 29edd4c6..de26dad8 100644 --- a/pysollib/tile/selectcardset.py +++ b/pysollib/tile/selectcardset.py @@ -21,24 +21,22 @@ # # ---------------------------------------------------------------------------## -# imports import os -from six.moves import tkinter -from . import ttk -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct, USE_PIL -from pysollib.util import CARDSET +from pysollib.mygettext import _ from pysollib.resource import CSI - -# Toolkit imports -from pysollib.ui.tktile.tkutil import loadImage -from .tkwidget import MfxDialog, MfxScrolledCanvas, PysolScale -from pysollib.ui.tktile.tkcanvas import MfxCanvasImage from pysollib.ui.tktile.selecttree import SelectDialogTreeData -from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from pysollib.ui.tktile.tkcanvas import MfxCanvasImage +from pysollib.ui.tktile.tkutil import loadImage +from pysollib.util import CARDSET + +from six.moves import tkinter + +from . import ttk from .selecttree import SelectDialogTreeCanvas +from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from .tkwidget import MfxDialog, MfxScrolledCanvas, PysolScale # ************************************************************************ diff --git a/pysollib/tile/selectgame.py b/pysollib/tile/selectgame.py index 8bc6d81e..6ebd61a2 100644 --- a/pysollib/tile/selectgame.py +++ b/pysollib/tile/selectgame.py @@ -22,30 +22,28 @@ # --------------------------------------------------------------------------- -# imports import os -from . import ttk + +from pysollib.gamedb import GI +from pysollib.mfxutil import KwStruct, Struct, destruct +from pysollib.mfxutil import format_time +from pysollib.mygettext import _ +from pysollib.resource import CSI +from pysollib.ui.tktile.selecttree import SelectDialogTreeData +from pysollib.ui.tktile.tkutil import unbind_destroy + from six.moves import UserList -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import destruct, Struct, KwStruct -from pysollib.mfxutil import format_time -from pysollib.gamedb import GI -from pysollib.resource import CSI - -# Toolkit imports -from pysollib.ui.tktile.tkutil import unbind_destroy -from pysollib.ui.tktile.selecttree import SelectDialogTreeData -from .tkwidget import MfxDialog, MfxScrolledCanvas -from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from . import ttk from .selecttree import SelectDialogTreeCanvas - +from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from .tkwidget import MfxDialog, MfxScrolledCanvas # ************************************************************************ # * Nodes # ************************************************************************ + class SelectGameLeaf(SelectDialogTreeLeaf): pass diff --git a/pysollib/tile/selecttile.py b/pysollib/tile/selecttile.py index 5480eb6f..59407032 100644 --- a/pysollib/tile/selecttile.py +++ b/pysollib/tile/selecttile.py @@ -21,22 +21,18 @@ # # ---------------------------------------------------------------------------## +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ +from pysollib.ui.tktile.selecttree import SelectDialogTreeData -# imports import six from six.moves import tkinter from six.moves import tkinter_colorchooser + from . import ttk - -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct - -# Toolkit imports -from pysollib.ui.tktile.selecttree import SelectDialogTreeData -from .tkwidget import MfxDialog, MfxScrolledCanvas -from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode from .selecttree import SelectDialogTreeCanvas +from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from .tkwidget import MfxDialog, MfxScrolledCanvas # ************************************************************************ diff --git a/pysollib/tile/selecttree.py b/pysollib/tile/selecttree.py index 19102225..bd2c6a08 100644 --- a/pysollib/tile/selecttree.py +++ b/pysollib/tile/selecttree.py @@ -21,11 +21,11 @@ # # ---------------------------------------------------------------------------## -# Toolkit imports -from .tktree import MfxTreeLeaf, MfxTreeNode, MfxTreeInCanvas +from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeCanvas +from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeLeaf +from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeNode -from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeLeaf, \ - BaseSelectDialogTreeNode, BaseSelectDialogTreeCanvas +from .tktree import MfxTreeInCanvas, MfxTreeLeaf, MfxTreeNode # ************************************************************************ # * Nodes diff --git a/pysollib/tile/solverdialog.py b/pysollib/tile/solverdialog.py index 364872e1..1841054f 100644 --- a/pysollib/tile/solverdialog.py +++ b/pysollib/tile/solverdialog.py @@ -21,17 +21,12 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct - -# Toolkit imports +from pysollib.mygettext import _ from pysollib.tile.basetilemfxdialog import BaseTileMfxDialog +from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog + from .tkwidget import PysolCombo -from pysollib.ui.tktile.solverdialog import BaseSolverDialog, \ - solver_dialog # ************************************************************************ diff --git a/pysollib/tile/soundoptionsdialog.py b/pysollib/tile/soundoptionsdialog.py index 0b7d87e5..ea1f8711 100644 --- a/pysollib/tile/soundoptionsdialog.py +++ b/pysollib/tile/soundoptionsdialog.py @@ -21,27 +21,21 @@ # # --------------------------------------------------------------------------- -# imports import os -from six.moves import tkinter -from . import ttk -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct -from pysollib.settings import TITLE +from pysollib.mygettext import _ from pysollib.pysolaudio import pysolsoundserver - -# Toolkit imports +from pysollib.settings import TITLE from pysollib.ui.tktile.tkconst import EVENT_HANDLED + +from six.moves import tkinter + +from . import ttk from .tkwidget import MfxDialog, MfxMessageDialog from .tkwidget import PysolScale -# ************************************************************************ -# * -# ************************************************************************ - class SoundOptionsDialog(MfxDialog): def __init__(self, parent, title, app, **kw): diff --git a/pysollib/tile/statusbar.py b/pysollib/tile/statusbar.py index c40616e6..14406bb7 100644 --- a/pysollib/tile/statusbar.py +++ b/pysollib/tile/statusbar.py @@ -24,14 +24,13 @@ # imports import os import sys -import six -from six.moves import tkinter -from . import ttk -# PySol imports from pysollib.mygettext import _ -# Toolkit imports +import six +from six.moves import tkinter + +from . import ttk from .tkwidget import MfxTooltip if __name__ == '__main__': diff --git a/pysollib/tile/timeoutsdialog.py b/pysollib/tile/timeoutsdialog.py index 205dca20..0b57bfd0 100644 --- a/pysollib/tile/timeoutsdialog.py +++ b/pysollib/tile/timeoutsdialog.py @@ -21,22 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import tkinter -from . import ttk - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ -# Toolkit imports +from six.moves import tkinter + +from . import ttk from .tkwidget import MfxDialog, PysolScale -# ************************************************************************ -# * -# ************************************************************************ - class TimeoutsDialog(MfxDialog): def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) diff --git a/pysollib/tile/tkhtml.py b/pysollib/tile/tkhtml.py index 715f3231..fbff7659 100644 --- a/pysollib/tile/tkhtml.py +++ b/pysollib/tile/tkhtml.py @@ -21,22 +21,19 @@ # # ---------------------------------------------------------------------------## -# imports import os import sys -from six.moves import tkinter -from . import ttk -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import Struct - -# Toolkit imports -from .tkwidget import MfxMessageDialog -from .statusbar import HtmlStatusbar - +from pysollib.mygettext import _ from pysollib.ui.tktile.tkhtml import Base_HTMLViewer +from six.moves import tkinter + +from . import ttk +from .statusbar import HtmlStatusbar +from .tkwidget import MfxMessageDialog + if __name__ == '__main__': d = os.path.abspath(os.path.join(sys.path[0], '..', '..')) sys.path.append(d) diff --git a/pysollib/tile/tkstats.py b/pysollib/tile/tkstats.py index 777f6d6d..c34357e0 100644 --- a/pysollib/tile/tkstats.py +++ b/pysollib/tile/tkstats.py @@ -21,23 +21,20 @@ # # ---------------------------------------------------------------------------## -# imports import os import time -from six.moves import tkinter -from . import ttk -from six.moves import tkinter_font -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct from pysollib.mfxutil import format_time -# from pysollib.util import * -from pysollib.stats import PysolStatsFormatter, ProgressionFormatter +from pysollib.mygettext import _ from pysollib.settings import TOP_TITLE - -# Toolkit imports +from pysollib.stats import ProgressionFormatter, PysolStatsFormatter from pysollib.ui.tktile.tkutil import bind, loadImage + +from six.moves import tkinter +from six.moves import tkinter_font + +from . import ttk from .tkwidget import MfxDialog, MfxMessageDialog diff --git a/pysollib/tile/tktree.py b/pysollib/tile/tktree.py index 634a450f..a55e6c85 100644 --- a/pysollib/tile/tktree.py +++ b/pysollib/tile/tktree.py @@ -21,19 +21,15 @@ # # --------------------------------------------------------------------------- -# imports import os + +from pysollib.ui.tktile.tkutil import bind + from six.moves import tkinter -# Toolkit imports -from pysollib.ui.tktile.tkutil import bind from .tkwidget import MfxScrolledCanvas -# ************************************************************************ -# * -# ************************************************************************ - class MfxTreeBaseNode: def __init__(self, tree, parent_node, text, key): self.tree = tree diff --git a/pysollib/tile/tkwidget.py b/pysollib/tile/tkwidget.py index f8689141..256396a2 100644 --- a/pysollib/tile/tkwidget.py +++ b/pysollib/tile/tkwidget.py @@ -21,27 +21,25 @@ # # --------------------------------------------------------------------------- -# imports +import locale import os import time -import locale -from six.moves import tkinter -from . import ttk -from six.moves import tkinter_font -from six import PY2 -import six import traceback -# PySol imports +from pysollib.mfxutil import KwStruct, destruct, kwdefault, openURL from pysollib.mygettext import _ -from pysollib.mfxutil import destruct, kwdefault, KwStruct, openURL from pysollib.settings import WIN_SYSTEM - -# Toolkit imports +from pysollib.ui.tktile.tkcanvas import MfxCanvas from pysollib.ui.tktile.tkutil import after, after_cancel from pysollib.ui.tktile.tkutil import bind, unbind_destroy from pysollib.ui.tktile.tkutil import makeToplevel, setTransient -from pysollib.ui.tktile.tkcanvas import MfxCanvas + +import six +from six import PY2 +from six.moves import tkinter +from six.moves import tkinter_font + +from . import ttk # ************************************************************************ # * abstract base class for the dialogs in this module diff --git a/pysollib/tile/toolbar.py b/pysollib/tile/toolbar.py index dab67a56..3f5f366d 100644 --- a/pysollib/tile/toolbar.py +++ b/pysollib/tile/toolbar.py @@ -21,29 +21,23 @@ # # ---------------------------------------------------------------------------## -# imports import os -from six.moves import tkinter -from . import ttk -# PySol imports +from pysollib.mfxutil import Image, ImageOps, ImageTk from pysollib.mygettext import _, n_ -from pysollib.mfxutil import Image, ImageTk, ImageOps -from pysollib.util import IMAGE_EXTENSIONS from pysollib.settings import TITLE +from pysollib.ui.tktile.menubar import MfxMenu, createToolbarMenu +from pysollib.ui.tktile.tkconst import EVENT_HANDLED +from pysollib.ui.tktile.tkutil import loadImage +from pysollib.util import IMAGE_EXTENSIONS from pysollib.winsystems import TkSettings -# Toolkit imports -from pysollib.ui.tktile.tkconst import EVENT_HANDLED +from six.moves import tkinter + +from . import ttk from .tkwidget import MfxTooltip -from pysollib.ui.tktile.menubar import createToolbarMenu, MfxMenu -from pysollib.ui.tktile.tkutil import loadImage -# ************************************************************************ -# * -# ************************************************************************ - class AbstractToolbarButton: def __init__(self, parent, toolbar, toolbar_name, position): self.toolbar = toolbar diff --git a/pysollib/tile/ttk.py b/pysollib/tile/ttk.py index e53e3806..aa290225 100644 --- a/pysollib/tile/ttk.py +++ b/pysollib/tile/ttk.py @@ -16,8 +16,8 @@ __version__ = "0.3" __author__ = "Guilherme Polo " -from six.moves import tkinter import six +from six.moves import tkinter _flatten = tkinter._flatten diff --git a/pysollib/tile/wizarddialog.py b/pysollib/tile/wizarddialog.py index f5b03107..4af0c4c0 100644 --- a/pysollib/tile/wizarddialog.py +++ b/pysollib/tile/wizarddialog.py @@ -21,25 +21,17 @@ # # --------------------------------------------------------------------------- -# imports +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ +from pysollib.wizardpresets import presets +from pysollib.wizardutil import WizardWidgets import six from six.moves import tkinter + from . import ttk - -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct -from pysollib.wizardutil import WizardWidgets -from pysollib.wizardpresets import presets - -# Toolkit imports from .tkwidget import MfxDialog -from .tkwidget import PysolScale, PysolCombo - -# ************************************************************************ -# * -# ************************************************************************ +from .tkwidget import PysolCombo, PysolScale class WizardDialog(MfxDialog): diff --git a/pysollib/tk/basetkmfxdialog.py b/pysollib/tk/basetkmfxdialog.py index ffcdecdb..bb9f0b7d 100644 --- a/pysollib/tk/basetkmfxdialog.py +++ b/pysollib/tk/basetkmfxdialog.py @@ -1,7 +1,7 @@ -from six.moves import tkinter - from pysollib.tk.tkwidget import MfxDialog +from six.moves import tkinter + class BaseTkMfxDialog(MfxDialog): def _calcToolkit(self): diff --git a/pysollib/tk/colorsdialog.py b/pysollib/tk/colorsdialog.py index 557dc77c..1d85a044 100644 --- a/pysollib/tk/colorsdialog.py +++ b/pysollib/tk/colorsdialog.py @@ -21,12 +21,8 @@ # # ---------------------------------------------------------------------------## -from pysollib.ui.tktile.colorsdialog import BaseColorsDialog from pysollib.tk.basetkmfxdialog import BaseTkMfxDialog - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.ui.tktile.colorsdialog import BaseColorsDialog class ColorsDialog(BaseColorsDialog, BaseTkMfxDialog): diff --git a/pysollib/tk/fontsdialog.py b/pysollib/tk/fontsdialog.py index dee6845f..1bb43414 100644 --- a/pysollib/tk/fontsdialog.py +++ b/pysollib/tk/fontsdialog.py @@ -21,21 +21,13 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import tkinter -from six.moves import tkinter_font - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct - -# Toolkit imports +from pysollib.mygettext import _ from pysollib.tk.tkwidget import MfxDialog from pysollib.ui.tktile.tkutil import bind -# ************************************************************************ -# * -# ************************************************************************ +from six.moves import tkinter +from six.moves import tkinter_font class FontChooserDialog(MfxDialog): diff --git a/pysollib/tk/menubar.py b/pysollib/tk/menubar.py index d6bdc73b..38113c7c 100644 --- a/pysollib/tk/menubar.py +++ b/pysollib/tk/menubar.py @@ -21,24 +21,21 @@ # # ---------------------------------------------------------------------------## -# imports - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import USE_PIL +from pysollib.mygettext import _ +from pysollib.ui.tktile.findcarddialog import \ + connect_game_find_card_dialog, \ + destroy_find_card_dialog +from pysollib.ui.tktile.menubar import PysolMenubarTkCommon +from pysollib.ui.tktile.solverdialog import connect_game_solver_dialog from pysollib.util import CARDSET -# toolkit imports -from .tkwidget import MfxMessageDialog -from .selectgame import SelectGameDialog, SelectGameDialogWithPreview -from .soundoptionsdialog import SoundOptionsDialog from .selectcardset import SelectCardsetDialogWithPreview +from .selectgame import SelectGameDialog, SelectGameDialogWithPreview from .selecttile import SelectTileDialogWithPreview -from pysollib.ui.tktile.findcarddialog import connect_game_find_card_dialog, \ - destroy_find_card_dialog -from pysollib.ui.tktile.solverdialog import connect_game_solver_dialog +from .soundoptionsdialog import SoundOptionsDialog +from .tkwidget import MfxMessageDialog -from pysollib.ui.tktile.menubar import PysolMenubarTkCommon # ************************************************************************ # * - create menubar # * - update menubar diff --git a/pysollib/tk/playeroptionsdialog.py b/pysollib/tk/playeroptionsdialog.py index e01957d6..cf3d06b0 100644 --- a/pysollib/tk/playeroptionsdialog.py +++ b/pysollib/tk/playeroptionsdialog.py @@ -21,21 +21,14 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import tkinter - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct, Struct - -# Toolkit imports -from .tkwidget import MfxDialog +from pysollib.mygettext import _ from pysollib.ui.tktile.tkutil import bind +from six.moves import tkinter + +from .tkwidget import MfxDialog -# ************************************************************************ -# * -# ************************************************************************ class SelectUserNameDialog(MfxDialog): def __init__(self, parent, title, usernames=[], **kw): diff --git a/pysollib/tk/progressbar.py b/pysollib/tk/progressbar.py index 8d8d8c13..4a1a191b 100644 --- a/pysollib/tk/progressbar.py +++ b/pysollib/tk/progressbar.py @@ -21,18 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import tkinter - -# Toolkit imports from pysollib.ui.tktile.tkconst import EVENT_HANDLED from pysollib.ui.tktile.tkutil import makeToplevel, setTransient +from six.moves import tkinter # ************************************************************************ # * a simple progress bar # ************************************************************************ + class PysolProgressBar: def __init__(self, app, parent, title=None, images=None, color="blue", width=300, height=25, show_text=1, norm=1): diff --git a/pysollib/tk/selectcardset.py b/pysollib/tk/selectcardset.py index 75fcaf23..623ed23d 100644 --- a/pysollib/tk/selectcardset.py +++ b/pysollib/tk/selectcardset.py @@ -21,23 +21,21 @@ # # ---------------------------------------------------------------------------## -# imports import os + +from pysollib.mfxutil import KwStruct, USE_PIL +from pysollib.mygettext import _ +from pysollib.resource import CSI +from pysollib.ui.tktile.selecttree import SelectDialogTreeData +from pysollib.ui.tktile.tkcanvas import MfxCanvasImage +from pysollib.ui.tktile.tkutil import loadImage +from pysollib.util import CARDSET + from six.moves import tkinter -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct, USE_PIL -from pysollib.util import CARDSET -from pysollib.resource import CSI - -# Toolkit imports -from pysollib.ui.tktile.tkutil import loadImage -from .tkwidget import MfxDialog, MfxScrolledCanvas -from pysollib.ui.tktile.tkcanvas import MfxCanvasImage -from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode -from pysollib.ui.tktile.selecttree import SelectDialogTreeData from .selecttree import SelectDialogTreeCanvas +from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from .tkwidget import MfxDialog, MfxScrolledCanvas # ************************************************************************ diff --git a/pysollib/tk/selectgame.py b/pysollib/tk/selectgame.py index dbfd12f0..393649f0 100644 --- a/pysollib/tk/selectgame.py +++ b/pysollib/tk/selectgame.py @@ -21,26 +21,23 @@ # # --------------------------------------------------------------------------- - -# imports import os -from six.moves import tkinter -from six.moves import UserList -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import destruct, Struct, KwStruct -from pysollib.mfxutil import format_time from pysollib.gamedb import GI from pysollib.help import help_html +from pysollib.mfxutil import KwStruct, Struct, destruct +from pysollib.mfxutil import format_time +from pysollib.mygettext import _ from pysollib.resource import CSI - -# Toolkit imports -from pysollib.ui.tktile.tkutil import unbind_destroy -from .tkwidget import MfxDialog, MfxScrolledCanvas -from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode -from .selecttree import SelectDialogTreeCanvas from pysollib.ui.tktile.selecttree import SelectDialogTreeData +from pysollib.ui.tktile.tkutil import unbind_destroy + +from six.moves import UserList +from six.moves import tkinter + +from .selecttree import SelectDialogTreeCanvas +from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from .tkwidget import MfxDialog, MfxScrolledCanvas # ************************************************************************ diff --git a/pysollib/tk/selecttile.py b/pysollib/tk/selecttile.py index ceef400c..9bed59a2 100644 --- a/pysollib/tk/selecttile.py +++ b/pysollib/tk/selecttile.py @@ -22,19 +22,16 @@ # ---------------------------------------------------------------------------## -# imports +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ +from pysollib.ui.tktile.selecttree import SelectDialogTreeData + import six from six.moves import tkinter, tkinter_colorchooser -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct - -# Toolkit imports -from .tkwidget import MfxDialog, MfxScrolledCanvas -from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode from .selecttree import SelectDialogTreeCanvas -from pysollib.ui.tktile.selecttree import SelectDialogTreeData +from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode +from .tkwidget import MfxDialog, MfxScrolledCanvas # ************************************************************************ diff --git a/pysollib/tk/selecttree.py b/pysollib/tk/selecttree.py index 79facf0f..0cb6ba2e 100644 --- a/pysollib/tk/selecttree.py +++ b/pysollib/tk/selecttree.py @@ -21,13 +21,13 @@ # # ---------------------------------------------------------------------------## -# imports -# Toolkit imports -from .tktree import MfxTreeLeaf, MfxTreeNode, MfxTreeInCanvas +from pysollib.ui.tktile.selecttree import \ + BaseSelectDialogTreeCanvas, \ + BaseSelectDialogTreeLeaf, \ + BaseSelectDialogTreeNode -from pysollib.ui.tktile.selecttree import BaseSelectDialogTreeLeaf, \ - BaseSelectDialogTreeNode, BaseSelectDialogTreeCanvas +from .tktree import MfxTreeInCanvas, MfxTreeLeaf, MfxTreeNode # ************************************************************************ # * Nodes diff --git a/pysollib/tk/solverdialog.py b/pysollib/tk/solverdialog.py index 1040e867..29f38069 100644 --- a/pysollib/tk/solverdialog.py +++ b/pysollib/tk/solverdialog.py @@ -21,17 +21,13 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import range, tkinter - -# PySol imports -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct - -# Toolkit imports +from pysollib.mygettext import _ from pysollib.tk.basetkmfxdialog import BaseTkMfxDialog from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog +from six.moves import range, tkinter + # ************************************************************************ # * # ************************************************************************ diff --git a/pysollib/tk/soundoptionsdialog.py b/pysollib/tk/soundoptionsdialog.py index b0b684bf..d9b0bf0d 100644 --- a/pysollib/tk/soundoptionsdialog.py +++ b/pysollib/tk/soundoptionsdialog.py @@ -21,18 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports import os + +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ +from pysollib.pysolaudio import pysolsoundserver +from pysollib.settings import TITLE +from pysollib.ui.tktile.tkconst import EVENT_HANDLED + from six.moves import tkinter -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct -from pysollib.settings import TITLE -from pysollib.pysolaudio import pysolsoundserver - -# Toolkit imports -from pysollib.ui.tktile.tkconst import EVENT_HANDLED from .tkwidget import MfxDialog, MfxMessageDialog # ************************************************************************ diff --git a/pysollib/tk/statusbar.py b/pysollib/tk/statusbar.py index 997a40bd..183af863 100644 --- a/pysollib/tk/statusbar.py +++ b/pysollib/tk/statusbar.py @@ -21,14 +21,16 @@ # # ---------------------------------------------------------------------------## -# imports import os import sys + +from pysollib.mygettext import _ +from pysollib.settings import WIN_SYSTEM + import six from six.moves import tkinter -from pysollib.mygettext import _ + from .tkwidget import MfxTooltip -from pysollib.settings import WIN_SYSTEM if __name__ == '__main__': d = os.path.abspath(os.path.join(sys.path[0], os.pardir, os.pardir)) diff --git a/pysollib/tk/timeoutsdialog.py b/pysollib/tk/timeoutsdialog.py index 1323b33c..4c4c9744 100644 --- a/pysollib/tk/timeoutsdialog.py +++ b/pysollib/tk/timeoutsdialog.py @@ -21,20 +21,14 @@ # # --------------------------------------------------------------------------- -# imports + +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ + from six.moves import tkinter -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct - -# Toolkit imports from .tkwidget import MfxDialog -# ************************************************************************ -# * -# ************************************************************************ - class TimeoutsDialog(MfxDialog): def __init__(self, parent, title, app, **kw): diff --git a/pysollib/tk/tkhtml.py b/pysollib/tk/tkhtml.py index f012c323..27eab441 100644 --- a/pysollib/tk/tkhtml.py +++ b/pysollib/tk/tkhtml.py @@ -21,20 +21,17 @@ # # --------------------------------------------------------------------------- -# imports import os import sys + +from pysollib.mfxutil import Struct +from pysollib.mygettext import _ +from pysollib.ui.tktile.tkhtml import Base_HTMLViewer + from six.moves import tkinter -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import Struct - -# Toolkit imports -from .tkwidget import MfxMessageDialog from .statusbar import HtmlStatusbar - -from pysollib.ui.tktile.tkhtml import Base_HTMLViewer +from .tkwidget import MfxMessageDialog if __name__ == '__main__': d = os.path.abspath(os.path.join(sys.path[0], '..', '..')) diff --git a/pysollib/tk/tkstats.py b/pysollib/tk/tkstats.py index 5f901691..709708c0 100644 --- a/pysollib/tk/tkstats.py +++ b/pysollib/tk/tkstats.py @@ -21,31 +21,24 @@ # # --------------------------------------------------------------------------- -# imports import os import time + +from pysollib.mfxutil import KwStruct, kwdefault +from pysollib.mfxutil import format_time +from pysollib.mygettext import _ +from pysollib.settings import TOP_TITLE +from pysollib.stats import ProgressionFormatter, PysolStatsFormatter +from pysollib.ui.tktile.tkutil import bind, loadImage + from six.moves import tkinter from six.moves import tkinter_font -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import kwdefault, KwStruct -from pysollib.mfxutil import format_time -# from pysollib.util import * -from pysollib.stats import PysolStatsFormatter, ProgressionFormatter -from pysollib.settings import TOP_TITLE - -# Toolkit imports -from pysollib.ui.tktile.tkutil import bind, loadImage from .tkwidget import MfxDialog, MfxMessageDialog from .tkwidget import MfxScrolledCanvas +# FIXME - this file is a quick hack and needs a rewrite -# FIXME - this file a quick hack and needs a rewrite - -# ************************************************************************ -# * -# ************************************************************************ class SingleGame_StatsDialog(MfxDialog): def __init__(self, parent, title, app, player, gameid, **kw): diff --git a/pysollib/tk/tktree.py b/pysollib/tk/tktree.py index 7fc9a2eb..8996f816 100644 --- a/pysollib/tk/tktree.py +++ b/pysollib/tk/tktree.py @@ -21,19 +21,15 @@ # # ---------------------------------------------------------------------------## -# imports import os + +from pysollib.ui.tktile.tkutil import bind + from six.moves import tkinter -# Toolkit imports -from pysollib.ui.tktile.tkutil import bind from .tkwidget import MfxScrolledCanvas -# ************************************************************************ -# * -# ************************************************************************ - class MfxTreeBaseNode: def __init__(self, tree, parent_node, text, key): self.tree = tree diff --git a/pysollib/tk/tkwidget.py b/pysollib/tk/tkwidget.py index 45b6f573..c8cb34ee 100644 --- a/pysollib/tk/tkwidget.py +++ b/pysollib/tk/tkwidget.py @@ -21,23 +21,20 @@ # # --------------------------------------------------------------------------- -# imports -import six import time -from six.moves import tkinter -from six.moves import tkinter_font import traceback -# PySol imports +from pysollib.mfxutil import KwStruct, destruct, kwdefault, openURL from pysollib.mygettext import _ -from pysollib.mfxutil import destruct, kwdefault, KwStruct, openURL from pysollib.settings import WIN_SYSTEM - -# Toolkit imports +from pysollib.ui.tktile.tkcanvas import MfxCanvas from pysollib.ui.tktile.tkutil import after, after_cancel from pysollib.ui.tktile.tkutil import bind, unbind_destroy from pysollib.ui.tktile.tkutil import makeToplevel, setTransient -from pysollib.ui.tktile.tkcanvas import MfxCanvas + +import six +from six.moves import tkinter +from six.moves import tkinter_font # ************************************************************************ # * abstract base class for the dialogs in this module diff --git a/pysollib/tk/toolbar.py b/pysollib/tk/toolbar.py index c304b7bd..08c2e11b 100644 --- a/pysollib/tk/toolbar.py +++ b/pysollib/tk/toolbar.py @@ -21,21 +21,19 @@ # # ---------------------------------------------------------------------------## -# imports import os -from six.moves import tkinter -# PySol imports -from pysollib.mygettext import _, n_ from pysollib.mfxutil import Image, ImageTk -from pysollib.util import IMAGE_EXTENSIONS +from pysollib.mygettext import _, n_ from pysollib.settings import TITLE +from pysollib.ui.tktile.menubar import MfxMenu, createToolbarMenu +from pysollib.ui.tktile.tkconst import EVENT_HANDLED +from pysollib.util import IMAGE_EXTENSIONS from pysollib.winsystems import TkSettings -# Toolkit imports -from pysollib.ui.tktile.tkconst import EVENT_HANDLED +from six.moves import tkinter + from .tkwidget import MfxTooltip -from pysollib.ui.tktile.menubar import createToolbarMenu, MfxMenu # ************************************************************************ diff --git a/pysollib/tk/wizarddialog.py b/pysollib/tk/wizarddialog.py index ff412e6d..24baa855 100644 --- a/pysollib/tk/wizarddialog.py +++ b/pysollib/tk/wizarddialog.py @@ -21,25 +21,18 @@ # # ---------------------------------------------------------------------------## -# imports +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ +from pysollib.wizardpresets import presets +from pysollib.wizardutil import WizardWidgets + import six from six.moves import tkinter + from .tabpage import TabPageSet - -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct -from pysollib.wizardutil import WizardWidgets -from pysollib.wizardpresets import presets - -# Toolkit imports from .tkwidget import MfxDialog -# ************************************************************************ -# * -# ************************************************************************ - class WizardDialog(MfxDialog): def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) diff --git a/pysollib/ui/tktile/card.py b/pysollib/ui/tktile/card.py index 961d3259..ee58deae 100644 --- a/pysollib/ui/tktile/card.py +++ b/pysollib/ui/tktile/card.py @@ -21,12 +21,7 @@ # # --------------------------------------------------------------------------- -# imports - -# PySol imports from pysollib.acard import AbstractCard - -# Toolkit imports from pysollib.ui.tktile.tkcanvas import MfxCanvasGroup, MfxCanvasImage diff --git a/pysollib/ui/tktile/colorsdialog.py b/pysollib/ui/tktile/colorsdialog.py index e7ffd594..5e845d09 100644 --- a/pysollib/ui/tktile/colorsdialog.py +++ b/pysollib/ui/tktile/colorsdialog.py @@ -21,18 +21,12 @@ # # --------------------------------------------------------------------------- -# imports +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ + from six.moves import tkinter from six.moves.tkinter_colorchooser import askcolor -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct - -# ************************************************************************ -# * -# ************************************************************************ - class BaseColorsDialog: def _calcFrame(self): diff --git a/pysollib/ui/tktile/edittextdialog.py b/pysollib/ui/tktile/edittextdialog.py index b1976967..860a42f4 100644 --- a/pysollib/ui/tktile/edittextdialog.py +++ b/pysollib/ui/tktile/edittextdialog.py @@ -1,7 +1,7 @@ -from six.moves import tkinter - -from pysollib.mygettext import _ from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ + +from six.moves import tkinter class BaseEditTextDialog: diff --git a/pysollib/ui/tktile/findcarddialog.py b/pysollib/ui/tktile/findcarddialog.py index 5f12ef78..40870e09 100644 --- a/pysollib/ui/tktile/findcarddialog.py +++ b/pysollib/ui/tktile/findcarddialog.py @@ -21,25 +21,17 @@ # # --------------------------------------------------------------------------- -# imports import os + +from pysollib.mygettext import _ +from pysollib.settings import TITLE +from pysollib.ui.tktile.tkcanvas import MfxCanvas, MfxCanvasGroup +from pysollib.ui.tktile.tkcanvas import MfxCanvasImage, MfxCanvasRectangle +from pysollib.ui.tktile.tkutil import after, after_cancel +from pysollib.ui.tktile.tkutil import bind, makeImage, unbind_destroy + from six.moves import tkinter -# PySol imports -from pysollib.mygettext import _ - -# Toolkit imports -from pysollib.ui.tktile.tkutil import after, after_cancel -from pysollib.ui.tktile.tkutil import bind, unbind_destroy, makeImage -from pysollib.ui.tktile.tkcanvas import MfxCanvas, MfxCanvasGroup, \ - MfxCanvasImage, MfxCanvasRectangle - -from pysollib.settings import TITLE - - -# ************************************************************************ -# * -# ************************************************************************ LARGE_EMBLEMS_SIZE = (38, 34) SMALL_EMBLEMS_SIZE = (31, 21) diff --git a/pysollib/ui/tktile/gameinfodialog.py b/pysollib/ui/tktile/gameinfodialog.py index 89d4cae0..055007cd 100644 --- a/pysollib/ui/tktile/gameinfodialog.py +++ b/pysollib/ui/tktile/gameinfodialog.py @@ -21,15 +21,9 @@ # # --------------------------------------------------------------------------- - -# PySol imports -from pysollib.mygettext import _ -from pysollib.mfxutil import KwStruct from pysollib.gamedb import GI - -# ************************************************************************ -# * -# ************************************************************************ +from pysollib.mfxutil import KwStruct +from pysollib.mygettext import _ class BaseGameInfoDialog: diff --git a/pysollib/ui/tktile/menubar.py b/pysollib/ui/tktile/menubar.py index 4e149de5..47a713b0 100644 --- a/pysollib/ui/tktile/menubar.py +++ b/pysollib/ui/tktile/menubar.py @@ -3,23 +3,22 @@ import os import re import sys +from pysollib.gamedb import GI +from pysollib.hint import PySolHintLayoutImportError +from pysollib.mfxutil import Image, USE_PIL +from pysollib.mfxutil import Struct, kwdefault +from pysollib.mygettext import _, n_ +from pysollib.settings import SELECT_GAME_MENU +from pysollib.settings import TITLE, WIN_SYSTEM +from pysollib.settings import USE_FREECELL_SOLVER +from pysollib.ui.tktile.tkconst import COMPOUNDS, CURSOR_WATCH, EVENT_HANDLED +from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE +from pysollib.ui.tktile.tkconst import TOOLBAR_BUTTONS +from pysollib.ui.tktile.tkutil import after_idle, bind + from six.moves import tkinter from six.moves import tkinter_tkfiledialog -from pysollib.mfxutil import Struct, kwdefault -from pysollib.mfxutil import Image, USE_PIL -from pysollib.mygettext import _, n_ -from pysollib.settings import TITLE, WIN_SYSTEM -from pysollib.settings import SELECT_GAME_MENU -from pysollib.gamedb import GI -from pysollib.settings import USE_FREECELL_SOLVER -from pysollib.hint import PySolHintLayoutImportError - -from pysollib.ui.tktile.tkconst import EVENT_HANDLED, EVENT_PROPAGATE, \ - CURSOR_WATCH, COMPOUNDS -from pysollib.ui.tktile.tkconst import TOOLBAR_BUTTONS -from pysollib.ui.tktile.tkutil import bind, after_idle - def createToolbarMenu(menubar, menu): tearoff = menu.cget('tearoff') diff --git a/pysollib/ui/tktile/solverdialog.py b/pysollib/ui/tktile/solverdialog.py index 9f324d0b..0a7c6a67 100644 --- a/pysollib/ui/tktile/solverdialog.py +++ b/pysollib/ui/tktile/solverdialog.py @@ -1,8 +1,8 @@ -from six.moves import tkinter - from pysollib.mygettext import _ -from pysollib.ui.tktile.tkconst import EVENT_HANDLED from pysollib.settings import TITLE +from pysollib.ui.tktile.tkconst import EVENT_HANDLED + +from six.moves import tkinter class BaseSolverDialog: @@ -162,7 +162,7 @@ class BaseSolverDialog: self.play_button.config(state='disabled') def startSolving(self): - from gettext import ungettext + from pysollib.mygettext import ungettext self._reset() game = self.app.game diff --git a/pysollib/ui/tktile/tkcanvas.py b/pysollib/ui/tktile/tkcanvas.py index 315fb78f..5cd85b6f 100644 --- a/pysollib/ui/tktile/tkcanvas.py +++ b/pysollib/ui/tktile/tkcanvas.py @@ -21,16 +21,12 @@ # # --------------------------------------------------------------------------- -# imports -from six.moves import tkinter +from pysollib.mfxutil import Image, ImageTk from pysollib.ui.tktile.Canvas2 import CanvasText, Group, Line, Rectangle from pysollib.ui.tktile.Canvas2 import ImageItem as ImageItem2 +from pysollib.ui.tktile.tkutil import loadImage, unbind_destroy -# PySol imports -from pysollib.mfxutil import Image, ImageTk - -# Toolkit imports -from pysollib.ui.tktile.tkutil import unbind_destroy, loadImage +from six.moves import tkinter # ************************************************************************ diff --git a/pysollib/ui/tktile/tkconst.py b/pysollib/ui/tktile/tkconst.py index a2bd30ad..28bbc963 100644 --- a/pysollib/ui/tktile/tkconst.py +++ b/pysollib/ui/tktile/tkconst.py @@ -21,11 +21,10 @@ # # ---------------------------------------------------------------------------## -# imports -from six.moves import tkinter - from pysollib.mygettext import n_ +from six.moves import tkinter + # ************************************************************************ # * constants # ************************************************************************ diff --git a/pysollib/ui/tktile/tkhtml.py b/pysollib/ui/tktile/tkhtml.py index 02d10350..8c030969 100644 --- a/pysollib/ui/tktile/tkhtml.py +++ b/pysollib/ui/tktile/tkhtml.py @@ -21,16 +21,17 @@ # # --------------------------------------------------------------------------- +import formatter import os import sys -import pysollib.htmllib2 as htmllib -import formatter -from six.moves import tkinter -from pysollib.ui.tktile.tkutil import bind, unbind_destroy +import pysollib.htmllib2 as htmllib +from pysollib.mfxutil import openURL from pysollib.mygettext import _ from pysollib.settings import TITLE -from pysollib.mfxutil import openURL +from pysollib.ui.tktile.tkutil import bind, unbind_destroy + +from six.moves import tkinter REMOTE_PROTOCOLS = ("ftp:", "gopher:", "http:", "mailto:", "news:", "telnet:") diff --git a/pysollib/ui/tktile/tkutil.py b/pysollib/ui/tktile/tkutil.py index ec6c86e8..af43130a 100644 --- a/pysollib/ui/tktile/tkutil.py +++ b/pysollib/ui/tktile/tkutil.py @@ -21,15 +21,14 @@ # # --------------------------------------------------------------------------- -# imports import re + +from pysollib.mfxutil import Image, ImageOps, ImageTk +from pysollib.settings import TITLE, WIN_SYSTEM + from six.moves import tkinter from six.moves import tkinter_font -# PySol imports -from pysollib.mfxutil import Image, ImageTk, ImageOps -from pysollib.settings import TITLE, WIN_SYSTEM - # ************************************************************************ # * window manager util diff --git a/pysollib/ui/tktile/tkwrap.py b/pysollib/ui/tktile/tkwrap.py index a52af25e..3c438ea8 100644 --- a/pysollib/ui/tktile/tkwrap.py +++ b/pysollib/ui/tktile/tkwrap.py @@ -21,12 +21,10 @@ # # --------------------------------------------------------------------------- -# imports -from six.moves import tkinter from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE -TclError = tkinter.TclError -# PySol imports +from six.moves import tkinter +TclError = tkinter.TclError # ************************************************************************ diff --git a/pysollib/util.py b/pysollib/util.py index bd70d8e0..84f18a4e 100644 --- a/pysollib/util.py +++ b/pysollib/util.py @@ -22,15 +22,14 @@ # ---------------------------------------------------------------------------## # imports -import sys import os import site +import sys # PySol imports -from pysollib.settings import DATA_DIRS, TOOLKIT from pysollib.mfxutil import Image - from pysollib.mygettext import _ +from pysollib.settings import DATA_DIRS, TOOLKIT # ************************************************************************ # * constants diff --git a/pysollib/winsystems/aqua.py b/pysollib/winsystems/aqua.py index 2df52a28..98583417 100644 --- a/pysollib/winsystems/aqua.py +++ b/pysollib/winsystems/aqua.py @@ -21,11 +21,12 @@ # # ---------------------------------------------------------------------------## +from pysollib.macosx.appSupport import hideTkConsole +from pysollib.settings import TOOLKIT, USE_TILE +from pysollib.winsystems.common import BaseTkSettings, base_init_root_window + from six.moves import tkinter -from pysollib.settings import TOOLKIT, USE_TILE -from pysollib.macosx.appSupport import hideTkConsole -from pysollib.winsystems.common import base_init_root_window, BaseTkSettings if USE_TILE: from pysollib.tile import ttk diff --git a/pysollib/winsystems/common.py b/pysollib/winsystems/common.py index 0ed2bbc1..815ddd54 100644 --- a/pysollib/winsystems/common.py +++ b/pysollib/winsystems/common.py @@ -24,12 +24,12 @@ import os import traceback -from pysollib.mygettext import _ -from pysollib.settings import TITLE -from pysollib.settings import VERSION -from pysollib.settings import TOOLKIT, USE_TILE -from pysollib.settings import DEBUG from pysollib.mfxutil import print_err +from pysollib.mygettext import _ +from pysollib.settings import DEBUG +from pysollib.settings import TITLE +from pysollib.settings import TOOLKIT, USE_TILE +from pysollib.settings import VERSION if TOOLKIT == 'tk': if USE_TILE: diff --git a/pysollib/winsystems/win32.py b/pysollib/winsystems/win32.py index ec5a1f26..4c436adc 100644 --- a/pysollib/winsystems/win32.py +++ b/pysollib/winsystems/win32.py @@ -22,7 +22,8 @@ # --------------------------------------------------------------------------- from pysollib.settings import TOOLKIT, USE_TILE -from pysollib.winsystems.common import base_init_root_window, BaseTkSettings +from pysollib.winsystems.common import BaseTkSettings, base_init_root_window + if USE_TILE: from pysollib.tile import ttk diff --git a/pysollib/winsystems/x11.py b/pysollib/winsystems/x11.py index 76fb1b9f..f755ab4e 100644 --- a/pysollib/winsystems/x11.py +++ b/pysollib/winsystems/x11.py @@ -26,8 +26,11 @@ import traceback from pysollib.settings import TITLE from pysollib.settings import TOOLKIT, USE_TILE -from pysollib.winsystems.common import base_init_root_window, \ - BaseTkSettings, get_font_name +from pysollib.winsystems.common import \ + BaseTkSettings, \ + base_init_root_window, \ + get_font_name + if TOOLKIT == 'tk': if USE_TILE: from pysollib.tile import ttk diff --git a/pysollib/wizardutil.py b/pysollib/wizardutil.py index 991d7308..84c65136 100644 --- a/pysollib/wizardutil.py +++ b/pysollib/wizardutil.py @@ -22,10 +22,10 @@ # --------------------------------------------------------------------------- import os -import six from pysollib.gamedb import GI, loadGame -from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, UNLIMITED_MOVES +from pysollib.layout import Layout +from pysollib.mygettext import _, n_ from pysollib.stack import AC_FoundationStack, \ AC_RowStack, \ BO_RowStack, \ @@ -35,16 +35,16 @@ from pysollib.stack import AC_FoundationStack, \ InitialDealTalonStack, \ RK_FoundationStack, \ RK_RowStack, \ + SC_FoundationStack, \ + SC_RowStack, \ + SS_FoundationStack, \ + SS_RowStack, \ + SpiderTalonStack, \ Spider_AC_Foundation, \ Spider_AC_RowStack, \ Spider_RK_Foundation, \ Spider_SS_Foundation, \ Spider_SS_RowStack, \ - SpiderTalonStack, \ - SC_FoundationStack, \ - SC_RowStack, \ - SS_FoundationStack, \ - SS_RowStack, \ UD_AC_RowStack, \ UD_RK_RowStack, \ UD_SC_RowStack, \ @@ -53,12 +53,10 @@ from pysollib.stack import AC_FoundationStack, \ Yukon_AC_RowStack, \ Yukon_RK_RowStack, \ Yukon_SS_RowStack - - -from pysollib.layout import Layout +from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, UNLIMITED_MOVES from pysollib.wizardpresets import presets -from pysollib.mygettext import _, n_ +import six # ************************************************************************ # * diff --git a/scripts/all_games.py b/scripts/all_games.py index 33c96e5b..a65fe33b 100755 --- a/scripts/all_games.py +++ b/scripts/all_games.py @@ -2,21 +2,22 @@ # -*- mode: python; coding: koi8-r; -*- # -import sys import os +import sys import time -# from pprint import pprint -from six.moves import builtins -from pysollib.mygettext import fix_gettext -import pysollib.games -import pysollib.games.special -import pysollib.games.ultra -import pysollib.games.mahjongg # noqa: F401 +# from pprint import pprint +import pysollib.games +import pysollib.games.mahjongg # noqa: F401 +import pysollib.games.special +import pysollib.games.ultra # noqa: F401 from pysollib.gamedb import GAME_DB from pysollib.gamedb import GI from pysollib.mfxutil import latin1_normalize +from pysollib.mygettext import fix_gettext from pysollib.resource import CSI + +from six.moves import builtins os.environ['LANG'] = 'C' builtins.__dict__['_'] = lambda x: x builtins.__dict__['n_'] = lambda x: x diff --git a/scripts/cardset_viewer.py b/scripts/cardset_viewer.py index ddf55ceb..1b288b5a 100755 --- a/scripts/cardset_viewer.py +++ b/scripts/cardset_viewer.py @@ -2,11 +2,13 @@ # -*- mode: python; coding: koi8-r; -*- # -import sys import os +import sys from glob import glob -from math import sqrt, sin, cos, pi +from math import cos, pi, sin, sqrt + from six.moves import tkinter + try: from PIL import Image, ImageTk except ImportError: diff --git a/scripts/create_iss.py b/scripts/create_iss.py index 2d32033c..2c1a2f8b 100755 --- a/scripts/create_iss.py +++ b/scripts/create_iss.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 import os -import pysollib.settings import sys +import pysollib.settings + if sys.version_info > (3,): def execfile(fn): return exec(open(fn).read()) diff --git a/scripts/gen_individual_importing_tests.py b/scripts/gen_individual_importing_tests.py index faed2f0b..a68df84b 100644 --- a/scripts/gen_individual_importing_tests.py +++ b/scripts/gen_individual_importing_tests.py @@ -229,8 +229,11 @@ for ver in [2, 3]: 'test__%s__v%d.py' % (mod, ver) ), 'w').write('''#!/usr/bin/env python%(ver)d import unittest -from %(mod)s import MyTests + from pycotap import TAPTestRunner + +from %(mod)s import MyTests + suite = unittest.TestLoader().loadTestsFromTestCase(MyTests) TAPTestRunner().run(suite) ''' % {'mod': mod, 'ver': ver}) diff --git a/scripts/mahjongg_utils.py b/scripts/mahjongg_utils.py index c2a11143..d291ae3f 100755 --- a/scripts/mahjongg_utils.py +++ b/scripts/mahjongg_utils.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- mode: python; coding: utf-8; -*- -import sys import os +import sys alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' diff --git a/scripts/pygettext.py b/scripts/pygettext.py index 6cfef1a5..be11a547 100755 --- a/scripts/pygettext.py +++ b/scripts/pygettext.py @@ -16,18 +16,18 @@ # Added very simple support for ngettext # -import os -import imp -import glob -import time +import functools import getopt +import glob +import imp +import operator +import os +import sys +import time import token import tokenize -import operator -import sys -import functools -from six import print_, PY2 +from six import PY2, print_ # for selftesting try: import fintl diff --git a/setup.py b/setup.py index f74c1d4c..5de31cec 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,9 @@ import os from distutils.core import setup -from pysollib.settings import VERSION + from pysollib.settings import PACKAGE_URL +from pysollib.settings import VERSION if os.name == 'nt': import py2exe # noqa: F401 diff --git a/setup_osx.py b/setup_osx.py index 00d8faf2..2ba2b796 100644 --- a/setup_osx.py +++ b/setup_osx.py @@ -4,12 +4,15 @@ Usage: """ import os -import sys import shutil +import sys from subprocess import call -from setuptools import setup + from pysollib.settings import PACKAGE, VERSION +from setuptools import setup + + # build the rule pages if not os.path.exists('data/html'): os.chdir('html-src') diff --git a/tests/lib/pysol_tests/acard_unit.py b/tests/lib/pysol_tests/acard_unit.py index e217ebca..60b5f73a 100644 --- a/tests/lib/pysol_tests/acard_unit.py +++ b/tests/lib/pysol_tests/acard_unit.py @@ -1,6 +1,7 @@ # Written by Shlomi Fish, under the MIT Expat License. import unittest + from pysollib.acard import AbstractCard diff --git a/tests/lib/pysol_tests/common_mocks1.py b/tests/lib/pysol_tests/common_mocks1.py index 5d94b252..23cfe633 100644 --- a/tests/lib/pysol_tests/common_mocks1.py +++ b/tests/lib/pysol_tests/common_mocks1.py @@ -6,8 +6,8 @@ # # Distributed under terms of the MIT license. -from pysollib.acard import AbstractCard import pysollib.stack +from pysollib.acard import AbstractCard """ diff --git a/tests/lib/pysol_tests/hint.py b/tests/lib/pysol_tests/hint.py index 5318c34f..4f24a3c9 100644 --- a/tests/lib/pysol_tests/hint.py +++ b/tests/lib/pysol_tests/hint.py @@ -1,6 +1,7 @@ # Written by Shlomi Fish, under the MIT Expat License. import unittest + from pysollib.acard import AbstractCard from pysollib.hint import Base_Solver_Hint diff --git a/tests/lib/pysol_tests/import_file1.py b/tests/lib/pysol_tests/import_file1.py index c1d1e959..f5f3c76f 100644 --- a/tests/lib/pysol_tests/import_file1.py +++ b/tests/lib/pysol_tests/import_file1.py @@ -1,10 +1,12 @@ # Written by Shlomi Fish, under the MIT Expat License. import unittest -from pysollib.hint import FreeCellSolver_Hint, PySolHintLayoutImportError -import pysollib.stack + from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockTalon +import pysollib.stack +from pysollib.hint import FreeCellSolver_Hint, PySolHintLayoutImportError + class MockGame: def __init__(self): diff --git a/tests/lib/pysol_tests/latin1_conv_unit.py b/tests/lib/pysol_tests/latin1_conv_unit.py index 70ac1d22..d949093c 100644 --- a/tests/lib/pysol_tests/latin1_conv_unit.py +++ b/tests/lib/pysol_tests/latin1_conv_unit.py @@ -1,6 +1,7 @@ # Written by Shlomi Fish, under the MIT Expat License. import unittest + from pysollib.mfxutil import latin1_normalize diff --git a/tests/lib/pysol_tests/ms_deals1/__init__.py b/tests/lib/pysol_tests/ms_deals1/__init__.py index dd2889d6..037b7e22 100644 --- a/tests/lib/pysol_tests/ms_deals1/__init__.py +++ b/tests/lib/pysol_tests/ms_deals1/__init__.py @@ -54,8 +54,8 @@ import unittest # So the localpaths will be overrided. -from pysollib.pysolrandom import constructRandom, LCRandom31, \ - random__str2long, random__long2str +from pysollib.pysolrandom import LCRandom31, constructRandom, \ + random__long2str, random__str2long # PySol imports diff --git a/tests/lib/pysol_tests/scorpion_canMove.py b/tests/lib/pysol_tests/scorpion_canMove.py index 8039af9c..bfb2057c 100644 --- a/tests/lib/pysol_tests/scorpion_canMove.py +++ b/tests/lib/pysol_tests/scorpion_canMove.py @@ -1,11 +1,13 @@ # Written by Shlomi Fish, under the MIT Expat License. import unittest -from pysollib.acard import AbstractCard -import pysollib.stack -from pysollib.games.spider import Scorpion_RowStack + from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockItem, MockTalon +import pysollib.stack +from pysollib.acard import AbstractCard +from pysollib.games.spider import Scorpion_RowStack + class MockGame: def __init__(self):