mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Compare commits
6 commits
1149d4fd4f
...
4478212d20
Author | SHA1 | Date | |
---|---|---|---|
|
4478212d20 | ||
|
dd16750d5f | ||
|
68d6b64fa2 | ||
|
679c9a74c1 | ||
|
4a3d6e7383 | ||
|
148f189a74 |
78 changed files with 146 additions and 174 deletions
|
@ -7,7 +7,7 @@ for general guidelines for contributing to open source.
|
||||||
|
|
||||||
- The [GitHub Actions CI build](https://github.com/shlomif/PySolFC/actions) and [AppVeyor build](https://ci.appveyor.com/project/shlomif/pysolfc) (which also run the test suite) should pass on each commit.
|
- The [GitHub Actions CI build](https://github.com/shlomif/PySolFC/actions) and [AppVeyor build](https://ci.appveyor.com/project/shlomif/pysolfc) (which also run the test suite) should pass on each commit.
|
||||||
- Your contributions should be under [GPLv3+](https://en.wikipedia.org/wiki/GNU_General_Public_License#Version_3) or a [compatible free software licence](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses), but please don't put them under the [AGPL](https://en.wikipedia.org/wiki/Affero_General_Public_License), which adds additional restrictions.
|
- Your contributions should be under [GPLv3+](https://en.wikipedia.org/wiki/GNU_General_Public_License#Version_3) or a [compatible free software licence](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses), but please don't put them under the [AGPL](https://en.wikipedia.org/wiki/Affero_General_Public_License), which adds additional restrictions.
|
||||||
- The code should be compatible with Python 3.4.x-and-above.
|
- The code should be compatible with Python 3.7 and above.
|
||||||
|
|
||||||
# How you can contribute
|
# How you can contribute
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ can be implemented.
|
||||||
|
|
||||||
## Requirements.
|
## Requirements.
|
||||||
|
|
||||||
- Python 3.x
|
- Python (3.7 or later)
|
||||||
- Tkinter (Tcl/Tk 8.4 or later)
|
- Tkinter (Tcl/Tk 8.4 or later)
|
||||||
|
|
||||||
- For sound support (optional)
|
- For sound support (optional)
|
||||||
|
|
BIN
data/images/buttons/bluecurve/apply.png
Normal file
BIN
data/images/buttons/bluecurve/apply.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
Binary file not shown.
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 724 B |
BIN
data/images/buttons/remix/apply.png
Normal file
BIN
data/images/buttons/remix/apply.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 295 B |
|
@ -542,6 +542,9 @@ class Application:
|
||||||
(_("&Hmm"), 'ok'),
|
(_("&Hmm"), 'ok'),
|
||||||
(_('&Cancel'), 'cancel'),
|
(_('&Cancel'), 'cancel'),
|
||||||
(_('&Close'), 'cancel'),
|
(_('&Close'), 'cancel'),
|
||||||
|
(_("&Apply"), 'apply'),
|
||||||
|
(_("&Start"), 'apply'),
|
||||||
|
(_('&New'), 'new'),
|
||||||
(_('&New game'), 'new'),
|
(_('&New game'), 'new'),
|
||||||
(_('&Back to game'), 'back'),
|
(_('&Back to game'), 'back'),
|
||||||
(_('&Reset...'), 'reset'),
|
(_('&Reset...'), 'reset'),
|
||||||
|
@ -550,6 +553,7 @@ class Application:
|
||||||
(_('&Info...'), 'help'),
|
(_('&Info...'), 'help'),
|
||||||
(_('&Credits'), 'help'),
|
(_('&Credits'), 'help'),
|
||||||
(_('&Next number'), 'next'),
|
(_('&Next number'), 'next'),
|
||||||
|
(_('&Play'), 'next'),
|
||||||
(_('&Play this game'), 'next'),
|
(_('&Play this game'), 'next'),
|
||||||
(_('&Solid color...'), 'color'),
|
(_('&Solid color...'), 'color'),
|
||||||
(_('&Save to file'), 'save'),
|
(_('&Save to file'), 'save'),
|
||||||
|
|
|
@ -72,6 +72,19 @@ class Statistics:
|
||||||
else:
|
else:
|
||||||
games[player] = [g for g in games[player] if g[0] != gameid]
|
games[player] = [g for g in games[player] if g[0] != gameid]
|
||||||
|
|
||||||
|
def deleteGameStats(self, gameid):
|
||||||
|
for player in self.games_stats:
|
||||||
|
try:
|
||||||
|
del self.games_stats[player][gameid]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
for player in self.prev_games:
|
||||||
|
self.prev_games[player] = \
|
||||||
|
[g for g in self.prev_games[player] if g[0] != gameid]
|
||||||
|
for player in self.session_games:
|
||||||
|
self.session_games[player] = \
|
||||||
|
[g for g in self.session_games[player] if g[0] != gameid]
|
||||||
|
|
||||||
def getStats(self, player, gameid):
|
def getStats(self, player, gameid):
|
||||||
# returned (won, lost)
|
# returned (won, lost)
|
||||||
return self.getFullStats(player, gameid)[:2]
|
return self.getFullStats(player, gameid)[:2]
|
||||||
|
|
|
@ -70,8 +70,6 @@ from pysollib.util import ACE, ANY_RANK, ANY_SUIT, \
|
||||||
UNLIMITED_MOVES
|
UNLIMITED_MOVES
|
||||||
from pysollib.wizardutil import WizardWidgets
|
from pysollib.wizardutil import WizardWidgets
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -80,7 +78,7 @@ import six
|
||||||
def get_settings(ss):
|
def get_settings(ss):
|
||||||
s = {}
|
s = {}
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
continue
|
continue
|
||||||
if w.var_name in ss:
|
if w.var_name in ss:
|
||||||
v = ss[w.var_name]
|
v = ss[w.var_name]
|
||||||
|
|
|
@ -26,6 +26,7 @@ import math
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
from io import BytesIO
|
||||||
from pickle import Pickler, Unpickler, UnpicklingError
|
from pickle import Pickler, Unpickler, UnpicklingError
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
@ -68,10 +69,6 @@ from pysollib.settings import PACKAGE, TITLE, TOOLKIT, TOP_SIZE
|
||||||
from pysollib.settings import VERSION, VERSION_TUPLE
|
from pysollib.settings import VERSION, VERSION_TUPLE
|
||||||
from pysollib.struct_new import NewStruct
|
from pysollib.struct_new import NewStruct
|
||||||
|
|
||||||
import six
|
|
||||||
from six import BytesIO
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
if TOOLKIT == 'tk':
|
if TOOLKIT == 'tk':
|
||||||
from pysollib.ui.tktile.solverdialog import reset_solver_dialog
|
from pysollib.ui.tktile.solverdialog import reset_solver_dialog
|
||||||
else:
|
else:
|
||||||
|
@ -104,7 +101,7 @@ def _updateStatus_process_key_val(tb, sb, k, v):
|
||||||
# self.top.wm_title("%s - %s"
|
# self.top.wm_title("%s - %s"
|
||||||
# % (TITLE, self.getTitleName()))
|
# % (TITLE, self.getTitleName()))
|
||||||
return
|
return
|
||||||
if isinstance(v, six.string_types):
|
if isinstance(v, str):
|
||||||
if sb:
|
if sb:
|
||||||
sb.updateText(gamenumber=v)
|
sb.updateText(gamenumber=v)
|
||||||
# self.top.wm_title("%s - %s %s" % (TITLE,
|
# self.top.wm_title("%s - %s %s" % (TITLE,
|
||||||
|
@ -146,7 +143,7 @@ def _updateStatus_process_key_val(tb, sb, k, v):
|
||||||
if tb:
|
if tb:
|
||||||
tb.updateText(player=_("Player\n"))
|
tb.updateText(player=_("Player\n"))
|
||||||
return
|
return
|
||||||
if isinstance(v, six.string_types):
|
if isinstance(v, str):
|
||||||
if tb:
|
if tb:
|
||||||
# if self.app.opt.toolbar_size:
|
# if self.app.opt.toolbar_size:
|
||||||
if tb.getSize():
|
if tb.getSize():
|
||||||
|
@ -168,7 +165,7 @@ def _updateStatus_process_key_val(tb, sb, k, v):
|
||||||
if v is None:
|
if v is None:
|
||||||
if sb:
|
if sb:
|
||||||
sb.updateText(time='')
|
sb.updateText(time='')
|
||||||
if isinstance(v, six.string_types):
|
if isinstance(v, str):
|
||||||
if sb:
|
if sb:
|
||||||
sb.updateText(time=v)
|
sb.updateText(time=v)
|
||||||
return
|
return
|
||||||
|
@ -1341,7 +1338,7 @@ class Game(object):
|
||||||
if self.preview:
|
if self.preview:
|
||||||
return
|
return
|
||||||
tb, sb = self.app.toolbar, self.app.statusbar
|
tb, sb = self.app.toolbar, self.app.statusbar
|
||||||
for k, v in six.iteritems(kw):
|
for k, v in kw.items():
|
||||||
_updateStatus_process_key_val(tb, sb, k, v)
|
_updateStatus_process_key_val(tb, sb, k, v)
|
||||||
|
|
||||||
def _unmapHandler(self, event):
|
def _unmapHandler(self, event):
|
||||||
|
|
|
@ -158,6 +158,7 @@ registerGame(GameInfo(557, GrandDuchess, "Grand Duchess",
|
||||||
altnames=('Duchess de Luynes')))
|
altnames=('Duchess de Luynes')))
|
||||||
registerGame(GameInfo(617, Parisienne, "Parisienne",
|
registerGame(GameInfo(617, Parisienne, "Parisienne",
|
||||||
GI.GT_NUMERICA, 2, 3,
|
GI.GT_NUMERICA, 2, 3,
|
||||||
altnames=('La Parisienne', 'Parisian')))
|
altnames=('La Parisienne', 'Parisian',
|
||||||
|
'Isle of Capri')))
|
||||||
registerGame(GameInfo(618, GrandDuchessPlus, "Grand Duchess +",
|
registerGame(GameInfo(618, GrandDuchessPlus, "Grand Duchess +",
|
||||||
GI.GT_NUMERICA, 2, 3))
|
GI.GT_NUMERICA, 2, 3))
|
||||||
|
|
|
@ -1055,7 +1055,8 @@ class AceOfHearts(Game):
|
||||||
|
|
||||||
# register the game
|
# register the game
|
||||||
registerGame(GameInfo(1, Gypsy, "Gypsy",
|
registerGame(GameInfo(1, Gypsy, "Gypsy",
|
||||||
GI.GT_GYPSY, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_GYPSY, 2, 0, GI.SL_MOSTLY_SKILL,
|
||||||
|
altnames=("Normandy",)))
|
||||||
registerGame(GameInfo(65, Giant, "Giant",
|
registerGame(GameInfo(65, Giant, "Giant",
|
||||||
GI.GT_GYPSY, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_GYPSY, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(3, Irmgard, "Irmgard",
|
registerGame(GameInfo(3, Irmgard, "Irmgard",
|
||||||
|
|
|
@ -1624,7 +1624,8 @@ registerGame(GameInfo(2, Klondike, "Klondike",
|
||||||
registerGame(GameInfo(61, CasinoKlondike, "Casino Klondike",
|
registerGame(GameInfo(61, CasinoKlondike, "Casino Klondike",
|
||||||
GI.GT_KLONDIKE | GI.GT_SCORE, 1, 2, GI.SL_BALANCED))
|
GI.GT_KLONDIKE | GI.GT_SCORE, 1, 2, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(129, VegasKlondike, "Vegas Klondike",
|
registerGame(GameInfo(129, VegasKlondike, "Vegas Klondike",
|
||||||
GI.GT_KLONDIKE | GI.GT_SCORE, 1, 0, GI.SL_BALANCED))
|
GI.GT_KLONDIKE | GI.GT_SCORE, 1, 0, GI.SL_BALANCED,
|
||||||
|
altnames=("Las Vegas",)))
|
||||||
registerGame(GameInfo(18, KlondikeByThrees, "Klondike (Draw 3)",
|
registerGame(GameInfo(18, KlondikeByThrees, "Klondike (Draw 3)",
|
||||||
GI.GT_KLONDIKE, 1, -1, GI.SL_MOSTLY_LUCK))
|
GI.GT_KLONDIKE, 1, -1, GI.SL_MOSTLY_LUCK))
|
||||||
registerGame(GameInfo(58, ThumbAndPouch, "Thumb and Pouch",
|
registerGame(GameInfo(58, ThumbAndPouch, "Thumb and Pouch",
|
||||||
|
|
|
@ -40,8 +40,6 @@ from pysollib.stack import \
|
||||||
OpenStack
|
OpenStack
|
||||||
from pysollib.util import ANY_SUIT, NO_RANK
|
from pysollib.util import ANY_SUIT, NO_RANK
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
|
|
||||||
def factorial(x):
|
def factorial(x):
|
||||||
if x <= 1:
|
if x <= 1:
|
||||||
|
|
|
@ -37,8 +37,6 @@ from pysollib.stack import \
|
||||||
InitialDealTalonStack
|
InitialDealTalonStack
|
||||||
from pysollib.util import ANY_SUIT
|
from pysollib.util import ANY_SUIT
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
|
|
||||||
class Shisen_Hint(AbstractHint):
|
class Shisen_Hint(AbstractHint):
|
||||||
TOP_MATCHING = False
|
TOP_MATCHING = False
|
||||||
|
|
|
@ -730,7 +730,7 @@ registerGame(GameInfo(399, Zeus, "Zeus",
|
||||||
GI.GT_PICTURE_GALLERY, 2, 0, GI.SL_BALANCED))
|
GI.GT_PICTURE_GALLERY, 2, 0, GI.SL_BALANCED))
|
||||||
registerGame(GameInfo(546, RoyalParade, "Royal Parade",
|
registerGame(GameInfo(546, RoyalParade, "Royal Parade",
|
||||||
GI.GT_PICTURE_GALLERY, 2, 0, GI.SL_MOSTLY_SKILL,
|
GI.GT_PICTURE_GALLERY, 2, 0, GI.SL_MOSTLY_SKILL,
|
||||||
altnames=("Hussars", "Financier")))
|
altnames=("Hussars", "Financier", "Cavalcade")))
|
||||||
registerGame(GameInfo(547, VirginiaReel, "Virginia Reel",
|
registerGame(GameInfo(547, VirginiaReel, "Virginia Reel",
|
||||||
GI.GT_PICTURE_GALLERY, 2, 0, GI.SL_MOSTLY_SKILL))
|
GI.GT_PICTURE_GALLERY, 2, 0, GI.SL_MOSTLY_SKILL))
|
||||||
registerGame(GameInfo(782, GreaterWheel, "Greater Wheel",
|
registerGame(GameInfo(782, GreaterWheel, "Greater Wheel",
|
||||||
|
|
|
@ -34,8 +34,6 @@ from pysollib.stack import \
|
||||||
OpenStack
|
OpenStack
|
||||||
from pysollib.util import ANY_SUIT
|
from pysollib.util import ANY_SUIT
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Samegame
|
# * Samegame
|
||||||
|
|
|
@ -33,8 +33,6 @@ from pysollib.pysolrandom import construct_random
|
||||||
from pysollib.settings import DEBUG, FCS_COMMAND
|
from pysollib.settings import DEBUG, FCS_COMMAND
|
||||||
from pysollib.util import KING
|
from pysollib.util import KING
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
FCS_VERSION = None
|
FCS_VERSION = None
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -819,7 +817,7 @@ class Base_Solver_Hint:
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
kw['close_fds'] = True
|
kw['close_fds'] = True
|
||||||
p = subprocess.Popen(command, **kw)
|
p = subprocess.Popen(command, **kw)
|
||||||
bytes_board = six.binary_type(board, 'utf-8')
|
bytes_board = bytes(board, 'utf-8')
|
||||||
pout, perr = p.communicate(bytes_board)
|
pout, perr = p.communicate(bytes_board)
|
||||||
if p.returncode in (127, 1):
|
if p.returncode in (127, 1):
|
||||||
# Linux and Windows return codes for "command not found" error
|
# Linux and Windows return codes for "command not found" error
|
||||||
|
@ -1018,7 +1016,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
FCS_VERSION = (5, 0, 0)
|
FCS_VERSION = (5, 0, 0)
|
||||||
else:
|
else:
|
||||||
pout, _ = self.run_solver(FCS_COMMAND + ' --version', '')
|
pout, _ = self.run_solver(FCS_COMMAND + ' --version', '')
|
||||||
s = six.text_type(pout.read(), encoding='utf-8')
|
s = str(pout.read(), encoding='utf-8')
|
||||||
m = re.search(r'version ([0-9]+)\.([0-9]+)\.([0-9]+)', s)
|
m = re.search(r'version ([0-9]+)\.([0-9]+)\.([0-9]+)', s)
|
||||||
if m:
|
if m:
|
||||||
FCS_VERSION = (int(m.group(1)), int(m.group(2)),
|
FCS_VERSION = (int(m.group(1)), int(m.group(2)),
|
||||||
|
@ -1082,7 +1080,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
states = 0
|
states = 0
|
||||||
|
|
||||||
for sbytes in pout:
|
for sbytes in pout:
|
||||||
s = six.text_type(sbytes, encoding='utf-8')
|
s = str(sbytes, encoding='utf-8')
|
||||||
if DEBUG >= 5:
|
if DEBUG >= 5:
|
||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
|
@ -1127,7 +1125,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
||||||
self.solver_state = 'unsolved'
|
self.solver_state = 'unsolved'
|
||||||
else:
|
else:
|
||||||
for sbytes in pout:
|
for sbytes in pout:
|
||||||
s = six.text_type(sbytes, encoding='utf-8')
|
s = str(sbytes, encoding='utf-8')
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(s)
|
print(s)
|
||||||
if self._determineIfSolverState(s):
|
if self._determineIfSolverState(s):
|
||||||
|
@ -1356,7 +1354,7 @@ class BlackHoleSolver_Hint(Base_Solver_Hint):
|
||||||
pout, perr = self.run_solver(command, board)
|
pout, perr = self.run_solver(command, board)
|
||||||
|
|
||||||
for sbytes in pout:
|
for sbytes in pout:
|
||||||
s = six.text_type(sbytes, encoding='utf-8')
|
s = str(sbytes, encoding='utf-8')
|
||||||
if DEBUG >= 5:
|
if DEBUG >= 5:
|
||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
|
@ -1390,7 +1388,7 @@ class BlackHoleSolver_Hint(Base_Solver_Hint):
|
||||||
else:
|
else:
|
||||||
self.solver_state = result.lower()
|
self.solver_state = result.lower()
|
||||||
for sbytes in pout:
|
for sbytes in pout:
|
||||||
s = six.text_type(sbytes, encoding='utf-8')
|
s = str(sbytes, encoding='utf-8')
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(s)
|
print(s)
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ def init():
|
||||||
sys.argv.remove('--kivy')
|
sys.argv.remove('--kivy')
|
||||||
|
|
||||||
if pysollib.settings.TOOLKIT == 'tk':
|
if pysollib.settings.TOOLKIT == 'tk':
|
||||||
from six.moves import tkinter
|
import tkinter
|
||||||
root = tkinter.Tk(className=pysollib.settings.TITLE)
|
root = tkinter.Tk(className=pysollib.settings.TITLE)
|
||||||
root.withdraw()
|
root.withdraw()
|
||||||
if tkinter.TkVersion < 8.4:
|
if tkinter.TkVersion < 8.4:
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------#
|
# ---------------------------------------------------------------------------#
|
||||||
|
|
||||||
|
from collections import UserList
|
||||||
|
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
from pysollib.gamedb import GI
|
from pysollib.gamedb import GI
|
||||||
|
@ -33,8 +35,6 @@ from pysollib.kivy.selecttree import SelectDialogTreeData
|
||||||
from pysollib.kivy.selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from pysollib.kivy.selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import UserList
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Nodes
|
# * Nodes
|
||||||
|
|
|
@ -31,9 +31,6 @@ from pickle import Pickler, Unpickler
|
||||||
|
|
||||||
from pysollib.settings import PACKAGE, TOOLKIT
|
from pysollib.settings import PACKAGE, TOOLKIT
|
||||||
|
|
||||||
import six
|
|
||||||
from six import print_
|
|
||||||
|
|
||||||
Image = ImageTk = ImageOps = ImageDraw = None
|
Image = ImageTk = ImageOps = ImageDraw = None
|
||||||
if TOOLKIT == 'tk':
|
if TOOLKIT == 'tk':
|
||||||
try: # PIL
|
try: # PIL
|
||||||
|
@ -125,9 +122,9 @@ def print_err(s, level=1):
|
||||||
elif level == 2:
|
elif level == 2:
|
||||||
ss = PACKAGE+': DEBUG WARNING:'
|
ss = PACKAGE+': DEBUG WARNING:'
|
||||||
try:
|
try:
|
||||||
print_(ss, s, file=sys.stderr)
|
print(ss, s, file=sys.stderr)
|
||||||
except Exception:
|
except Exception:
|
||||||
print_(ss, s.encode(locale.getpreferredencoding()), file=sys.stderr)
|
print(ss, s.encode(locale.getpreferredencoding()), file=sys.stderr)
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,7 +181,7 @@ if os.name == "posix":
|
||||||
def win32_getusername():
|
def win32_getusername():
|
||||||
user = os.environ.get('USERNAME', '').strip()
|
user = os.environ.get('USERNAME', '').strip()
|
||||||
try:
|
try:
|
||||||
user = six.text_type(user, locale.getpreferredencoding())
|
user = str(user, locale.getpreferredencoding())
|
||||||
except Exception:
|
except Exception:
|
||||||
user = ''
|
user = ''
|
||||||
return user
|
return user
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import gettext
|
import gettext
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class myLocalGettext:
|
||||||
class myLocalGettext(object):
|
|
||||||
def __init__(self, lang):
|
def __init__(self, lang):
|
||||||
self.language = lang
|
self.language = lang
|
||||||
|
|
||||||
|
@ -19,8 +17,8 @@ class myLocalGettext(object):
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def maketext(self, msg):
|
def maketext(self, msg):
|
||||||
if not isinstance(msg, six.text_type):
|
if not isinstance(msg, str):
|
||||||
return six.text_type(msg, 'utf-8')
|
return str(msg, 'utf-8')
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def ungettext(self, msgid1, msgid2, n):
|
def ungettext(self, msgid1, msgid2, n):
|
||||||
|
|
|
@ -35,9 +35,6 @@ from pysollib.mygettext import myGettext
|
||||||
from pysollib.pysoltk import STATUSBAR_ITEMS, TOOLBAR_BUTTONS, TOOLKIT
|
from pysollib.pysoltk import STATUSBAR_ITEMS, TOOLBAR_BUTTONS, TOOLKIT
|
||||||
from pysollib.resource import CSI
|
from pysollib.resource import CSI
|
||||||
|
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
import validate
|
import validate
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -663,7 +660,7 @@ class Options:
|
||||||
val = getattr(self, key)
|
val = getattr(self, key)
|
||||||
if isinstance(val, str):
|
if isinstance(val, str):
|
||||||
if sys.version_info < (3,):
|
if sys.version_info < (3,):
|
||||||
val = six.text_type(val, 'utf-8')
|
val = str(val, 'utf-8')
|
||||||
config['general'][key] = val
|
config['general'][key] = val
|
||||||
|
|
||||||
config['general']['recent_gameid'] = self.recent_gameid
|
config['general']['recent_gameid'] = self.recent_gameid
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
# import os
|
# import os
|
||||||
# from six.moves import tkinter
|
# import tkinter
|
||||||
# import traceback
|
# import traceback
|
||||||
|
|
||||||
# # PySol imports
|
# # PySol imports
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
# imports
|
# imports
|
||||||
# import os
|
# import os
|
||||||
# from six.moves import tkinter
|
# import tkinter
|
||||||
# import traceback
|
# import traceback
|
||||||
|
|
||||||
# # PySol imports
|
# # PySol imports
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
# # imports
|
# # imports
|
||||||
# import os, sys
|
# import os, sys
|
||||||
# from six.moves import tkinter
|
# import tkinter
|
||||||
|
|
||||||
# # PySol imports
|
# # PySol imports
|
||||||
# from pysollib.mfxutil import KwStruct
|
# from pysollib.mfxutil import KwStruct
|
||||||
|
|
|
@ -25,8 +25,6 @@ import gtk
|
||||||
|
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
class BasicStatusbar:
|
class BasicStatusbar:
|
||||||
def __init__(self, top, row, column, columnspan):
|
def __init__(self, top, row, column, columnspan):
|
||||||
|
@ -60,7 +58,7 @@ class BasicStatusbar:
|
||||||
for k, v in kw.items():
|
for k, v in kw.items():
|
||||||
label = getattr(self, k + "_label")
|
label = getattr(self, k + "_label")
|
||||||
label.pop(0)
|
label.pop(0)
|
||||||
label.push(0, six.text_type(v))
|
label.push(0, str(v))
|
||||||
|
|
||||||
def config(self, name, show):
|
def config(self, name, show):
|
||||||
# FIXME
|
# FIXME
|
||||||
|
@ -70,7 +68,7 @@ class BasicStatusbar:
|
||||||
label = getattr(self, name + "_label")
|
label = getattr(self, name + "_label")
|
||||||
# FIXME kw['fg']
|
# FIXME kw['fg']
|
||||||
label.pop(0)
|
label.pop(0)
|
||||||
label.push(0, six.text_type(kw['text']))
|
label.push(0, str(kw['text']))
|
||||||
|
|
||||||
def show(self, show=True, resize=False):
|
def show(self, show=True, resize=False):
|
||||||
if show:
|
if show:
|
||||||
|
|
|
@ -38,8 +38,6 @@ from pysollib.mfxutil import Struct, openURL
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from tkwidget import MfxMessageDialog
|
from tkwidget import MfxMessageDialog
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -71,7 +69,7 @@ class tkHTMLWriter(pysollib.formatter.NullWriter):
|
||||||
self.indent = ''
|
self.indent = ''
|
||||||
|
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
data = six.text_type(data)
|
data = str(data)
|
||||||
self.text.insert(self.text.get_end_iter(), data, len(data))
|
self.text.insert(self.text.get_end_iter(), data, len(data))
|
||||||
|
|
||||||
def anchor_bgn(self, href, name, type):
|
def anchor_bgn(self, href, name, type):
|
||||||
|
|
|
@ -29,8 +29,6 @@ from pysollib.mfxutil import Image, KwStruct, Struct, USE_PIL
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import DEBUG
|
from pysollib.settings import DEBUG
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * Abstract
|
# * Abstract
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -477,7 +475,7 @@ class Cardset(Resource):
|
||||||
|
|
||||||
def updateCardback(self, backname=None, backindex=None):
|
def updateCardback(self, backname=None, backindex=None):
|
||||||
# update default back
|
# update default back
|
||||||
if isinstance(backname, six.string_types):
|
if isinstance(backname, str):
|
||||||
if backname in self.backnames:
|
if backname in self.backnames:
|
||||||
backindex = self.backnames.index(backname)
|
backindex = self.backnames.index(backname)
|
||||||
if isinstance(backindex, int):
|
if isinstance(backindex, int):
|
||||||
|
|
|
@ -27,8 +27,6 @@ from pysollib.gamedb import GI
|
||||||
from pysollib.mfxutil import format_time
|
from pysollib.mfxutil import format_time
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import range
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .tkwidget import MfxDialog
|
from .tkwidget import MfxDialog
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, USE_PIL
|
from pysollib.mfxutil import KwStruct, USE_PIL
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -31,7 +32,6 @@ from pysollib.ui.tktile.tkcanvas import MfxCanvasImage
|
||||||
from pysollib.ui.tktile.tkutil import bind, loadImage
|
from pysollib.ui.tktile.tkutil import bind, loadImage
|
||||||
from pysollib.util import CARDSET
|
from pysollib.util import CARDSET
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .selecttree import SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeCanvas
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
from collections import UserList
|
||||||
|
|
||||||
from pysollib.gamedb import GI
|
from pysollib.gamedb import GI
|
||||||
from pysollib.mfxutil import KwStruct, Struct, destruct
|
from pysollib.mfxutil import KwStruct, Struct, destruct
|
||||||
|
@ -31,8 +33,6 @@ from pysollib.resource import CSI
|
||||||
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
||||||
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
||||||
|
|
||||||
from six.moves import UserList
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .selecttree import SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeCanvas
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, USE_PIL
|
from pysollib.mfxutil import KwStruct, USE_PIL
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -29,8 +30,6 @@ from pysollib.resource import TTI
|
||||||
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
import six
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_colorchooser
|
from six.moves import tkinter_colorchooser
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
|
@ -276,7 +275,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
|
|
||||||
def mDone(self, button):
|
def mDone(self, button):
|
||||||
if button == 0: # "OK" or double click
|
if button == 0: # "OK" or double click
|
||||||
if isinstance(self.tree.selection_key, six.string_types):
|
if isinstance(self.tree.selection_key, str):
|
||||||
self.key = str(self.tree.selection_key)
|
self.key = str(self.tree.selection_key)
|
||||||
else:
|
else:
|
||||||
self.key = self.tree.selection_key
|
self.key = self.tree.selection_key
|
||||||
|
@ -378,7 +377,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
canvas.deleteAllItems()
|
canvas.deleteAllItems()
|
||||||
|
|
||||||
self.preview_scaling = scaling
|
self.preview_scaling = scaling
|
||||||
if isinstance(key, six.string_types):
|
if isinstance(key, str):
|
||||||
if USE_PIL:
|
if USE_PIL:
|
||||||
self.textScale['state'] = 'disabled'
|
self.textScale['state'] = 'disabled'
|
||||||
# solid color
|
# solid color
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -29,7 +30,6 @@ from pysollib.pysolaudio import pysolsoundserver
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .tkwidget import MfxDialog, MfxMessageDialog
|
from .tkwidget import MfxDialog, MfxMessageDialog
|
||||||
|
|
|
@ -24,11 +24,10 @@
|
||||||
# imports
|
# imports
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
import six
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .tkwidget import MfxTooltip
|
from .tkwidget import MfxTooltip
|
||||||
|
@ -97,7 +96,7 @@ class MfxStatusbar:
|
||||||
def updateText(self, **kw):
|
def updateText(self, **kw):
|
||||||
for k, v in kw.items():
|
for k, v in kw.items():
|
||||||
label = getattr(self, k + '_label')
|
label = getattr(self, k + '_label')
|
||||||
text = six.text_type(v)
|
text = str(v)
|
||||||
width = label['width']
|
width = label['width']
|
||||||
if width and len(text) > width:
|
if width and len(text) > width:
|
||||||
label['width'] = len(text)
|
label['width'] = len(text)
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .tkwidget import MfxDialog, PysolScale
|
from .tkwidget import MfxDialog, PysolScale
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import Struct
|
from pysollib.mfxutil import Struct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.ui.tktile.tkhtml import Base_HTMLViewer
|
from pysollib.ui.tktile.tkhtml import Base_HTMLViewer
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .statusbar import HtmlStatusbar
|
from .statusbar import HtmlStatusbar
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mfxutil import format_time
|
from pysollib.mfxutil import format_time
|
||||||
|
@ -31,7 +32,6 @@ from pysollib.settings import TOP_TITLE
|
||||||
from pysollib.stats import ProgressionFormatter, PysolStatsFormatter
|
from pysollib.stats import ProgressionFormatter, PysolStatsFormatter
|
||||||
from pysollib.ui.tktile.tkutil import bind, loadImage
|
from pysollib.ui.tktile.tkutil import bind, loadImage
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,10 @@
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxScrolledCanvas
|
from .tkwidget import MfxScrolledCanvas
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import tkinter
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, destruct, kwdefault, openURL
|
from pysollib.mfxutil import KwStruct, destruct, kwdefault, openURL
|
||||||
|
@ -34,9 +35,6 @@ from pysollib.ui.tktile.tkutil import after, after_cancel
|
||||||
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
||||||
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
||||||
|
|
||||||
import six
|
|
||||||
from six import PY2
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
|
@ -121,9 +119,9 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
key = event.char
|
key = event.char
|
||||||
try:
|
try:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
key = six.text_type(key, locale.getpreferredencoding())
|
key = str(key, locale.getpreferredencoding())
|
||||||
else:
|
else:
|
||||||
key = six.text_type(key, 'utf-8')
|
key = str(key, 'utf-8')
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
@ -289,8 +287,6 @@ class MfxExceptionDialog(MfxMessageDialog):
|
||||||
(ex.errno, ex.strerror, repr(ex.filename))
|
(ex.errno, ex.strerror, repr(ex.filename))
|
||||||
else:
|
else:
|
||||||
t = str(ex)
|
t = str(ex)
|
||||||
if PY2:
|
|
||||||
t = six.text_type(t, errors='replace')
|
|
||||||
kw.text = text + t
|
kw.text = text + t
|
||||||
MfxMessageDialog.__init__(self, parent, title, **kw.getKw())
|
MfxMessageDialog.__init__(self, parent, title, **kw.getKw())
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import Image, ImageOps, ImageTk
|
from pysollib.mfxutil import Image, ImageOps, ImageTk
|
||||||
from pysollib.mygettext import _, n_
|
from pysollib.mygettext import _, n_
|
||||||
|
@ -32,7 +33,6 @@ from pysollib.ui.tktile.tkutil import loadImage
|
||||||
from pysollib.util import IMAGE_EXTENSIONS
|
from pysollib.util import IMAGE_EXTENSIONS
|
||||||
from pysollib.winsystems import TkSettings
|
from pysollib.winsystems import TkSettings
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .tkwidget import MfxTooltip
|
from .tkwidget import MfxTooltip
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.wizardpresets import presets
|
from pysollib.wizardpresets import presets
|
||||||
from pysollib.wizardutil import WizardWidgets
|
from pysollib.wizardutil import WizardWidgets
|
||||||
|
|
||||||
import six
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_ttk as ttk
|
from six.moves import tkinter_ttk as ttk
|
||||||
|
|
||||||
from .tkwidget import MfxDialog
|
from .tkwidget import MfxDialog
|
||||||
|
@ -49,7 +49,7 @@ class WizardDialog(MfxDialog):
|
||||||
notebook.pack(expand=True, fill='both')
|
notebook.pack(expand=True, fill='both')
|
||||||
|
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
frame = ttk.Frame(notebook)
|
frame = ttk.Frame(notebook)
|
||||||
notebook.add(frame, text=w, sticky='nsew', padding=5)
|
notebook.add(frame, text=w, sticky='nsew', padding=5)
|
||||||
frame.columnconfigure(1, weight=1)
|
frame.columnconfigure(1, weight=1)
|
||||||
|
@ -128,7 +128,7 @@ class WizardDialog(MfxDialog):
|
||||||
n = w.translation_map[n]
|
n = w.translation_map[n]
|
||||||
p = presets[n]
|
p = presets[n]
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
continue
|
continue
|
||||||
if w.var_name in p:
|
if w.var_name in p:
|
||||||
v = p[w.var_name]
|
v = p[w.var_name]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from pysollib.tk.tkwidget import MfxDialog
|
import tkinter
|
||||||
|
|
||||||
from six.moves import tkinter
|
from pysollib.tk.tkwidget import MfxDialog
|
||||||
|
|
||||||
|
|
||||||
class BaseTkMfxDialog(MfxDialog):
|
class BaseTkMfxDialog(MfxDialog):
|
||||||
|
|
|
@ -21,12 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.tk.tkwidget import MfxDialog
|
from pysollib.tk.tkwidget import MfxDialog
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, Struct
|
from pysollib.mfxutil import KwStruct, Struct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxDialog
|
from .tkwidget import MfxDialog
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * a simple progress bar
|
# * a simple progress bar
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, USE_PIL
|
from pysollib.mfxutil import KwStruct, USE_PIL
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -31,8 +32,6 @@ from pysollib.ui.tktile.tkcanvas import MfxCanvasImage
|
||||||
from pysollib.ui.tktile.tkutil import loadImage
|
from pysollib.ui.tktile.tkutil import loadImage
|
||||||
from pysollib.util import CARDSET
|
from pysollib.util import CARDSET
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .selecttree import SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeCanvas
|
||||||
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
from collections import UserList
|
||||||
|
|
||||||
from pysollib.gamedb import GI
|
from pysollib.gamedb import GI
|
||||||
from pysollib.mfxutil import KwStruct, Struct, destruct
|
from pysollib.mfxutil import KwStruct, Struct, destruct
|
||||||
|
@ -31,9 +33,6 @@ from pysollib.resource import CSI
|
||||||
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
||||||
from pysollib.ui.tktile.tkutil import unbind_destroy
|
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 SelectDialogTreeCanvas
|
||||||
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
from .tkwidget import MfxDialog, MfxScrolledCanvas
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
from pysollib.ui.tktile.selecttree import SelectDialogTreeData
|
||||||
|
|
||||||
import six
|
from six.moves import tkinter_colorchooser
|
||||||
from six.moves import tkinter, tkinter_colorchooser
|
|
||||||
|
|
||||||
from .selecttree import SelectDialogTreeCanvas
|
from .selecttree import SelectDialogTreeCanvas
|
||||||
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
from .selecttree import SelectDialogTreeLeaf, SelectDialogTreeNode
|
||||||
|
@ -172,10 +172,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
|
|
||||||
def mDone(self, button):
|
def mDone(self, button):
|
||||||
if button == 0: # "OK" or double click
|
if button == 0: # "OK" or double click
|
||||||
if isinstance(self.tree.selection_key, six.string_types):
|
self.key = self.tree.selection_key
|
||||||
self.key = str(self.tree.selection_key)
|
|
||||||
else:
|
|
||||||
self.key = self.tree.selection_key
|
|
||||||
self.tree.n_expansions = 1 # save xyview in any case
|
self.tree.n_expansions = 1 # save xyview in any case
|
||||||
if button == 1: # "Solid color..."
|
if button == 1: # "Solid color..."
|
||||||
try:
|
try:
|
||||||
|
@ -201,7 +198,7 @@ class SelectTileDialogWithPreview(MfxDialog):
|
||||||
return
|
return
|
||||||
canvas = self.preview.canvas
|
canvas = self.preview.canvas
|
||||||
canvas.deleteAllItems()
|
canvas.deleteAllItems()
|
||||||
if isinstance(key, six.string_types):
|
if isinstance(key, str):
|
||||||
# solid color
|
# solid color
|
||||||
canvas.config(bg=key)
|
canvas.config(bg=key)
|
||||||
canvas.setTile(None)
|
canvas.setTile(None)
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.tk.basetkmfxdialog import BaseTkMfxDialog
|
from pysollib.tk.basetkmfxdialog import BaseTkMfxDialog
|
||||||
from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog
|
from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog
|
||||||
|
|
||||||
from six.moves import range, tkinter
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
@ -29,8 +30,6 @@ from pysollib.pysolaudio import pysolsoundserver
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxDialog, MfxMessageDialog
|
from .tkwidget import MfxDialog, MfxMessageDialog
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
|
@ -23,13 +23,11 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import WIN_SYSTEM
|
from pysollib.settings import WIN_SYSTEM
|
||||||
|
|
||||||
import six
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxTooltip
|
from .tkwidget import MfxTooltip
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -96,7 +94,7 @@ class MfxStatusbar:
|
||||||
def updateText(self, **kw):
|
def updateText(self, **kw):
|
||||||
for k, v in kw.items():
|
for k, v in kw.items():
|
||||||
label = getattr(self, k + '_label')
|
label = getattr(self, k + '_label')
|
||||||
text = six.text_type(v)
|
text = str(v)
|
||||||
width = label['width']
|
width = label['width']
|
||||||
if width and len(text) > width:
|
if width and len(text) > width:
|
||||||
label['width'] = len(text)
|
label['width'] = len(text)
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
a couple of classes for implementing partial tabbed-page like behaviour
|
a couple of classes for implementing partial tabbed-page like behaviour
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from six.moves import tkinter
|
import tkinter
|
||||||
|
|
||||||
MYRIDGE, MYRAISED = tkinter.RAISED, tkinter.RIDGE
|
MYRIDGE, MYRAISED = tkinter.RAISED, tkinter.RIDGE
|
||||||
# MYRIDGE, MYRAISED = tkinter.RIDGE, tkinter.RAISED
|
# MYRIDGE, MYRAISED = tkinter.RIDGE, tkinter.RAISED
|
||||||
|
|
|
@ -21,12 +21,11 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxDialog
|
from .tkwidget import MfxDialog
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import Struct
|
from pysollib.mfxutil import Struct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.ui.tktile.tkhtml import Base_HTMLViewer
|
from pysollib.ui.tktile.tkhtml import Base_HTMLViewer
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .statusbar import HtmlStatusbar
|
from .statusbar import HtmlStatusbar
|
||||||
from .tkwidget import MfxMessageDialog
|
from .tkwidget import MfxMessageDialog
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, kwdefault
|
from pysollib.mfxutil import KwStruct, kwdefault
|
||||||
from pysollib.mfxutil import format_time
|
from pysollib.mfxutil import format_time
|
||||||
|
@ -31,7 +32,6 @@ from pysollib.settings import TOP_TITLE
|
||||||
from pysollib.stats import ProgressionFormatter, PysolStatsFormatter
|
from pysollib.stats import ProgressionFormatter, PysolStatsFormatter
|
||||||
from pysollib.ui.tktile.tkutil import bind, loadImage
|
from pysollib.ui.tktile.tkutil import bind, loadImage
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
|
|
||||||
from .tkwidget import MfxDialog, MfxMessageDialog
|
from .tkwidget import MfxDialog, MfxMessageDialog
|
||||||
|
|
|
@ -22,11 +22,10 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.ui.tktile.tkutil import bind
|
from pysollib.ui.tktile.tkutil import bind
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxScrolledCanvas
|
from .tkwidget import MfxScrolledCanvas
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
import tkinter
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct, destruct, kwdefault, openURL
|
from pysollib.mfxutil import KwStruct, destruct, kwdefault, openURL
|
||||||
|
@ -32,8 +33,6 @@ from pysollib.ui.tktile.tkutil import after, after_cancel
|
||||||
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
||||||
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
from pysollib.ui.tktile.tkutil import makeToplevel, setTransient
|
||||||
|
|
||||||
import six
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -130,7 +129,7 @@ class MfxDialog: # ex. _ToplevelDialog
|
||||||
|
|
||||||
def altKeyEvent(self, event):
|
def altKeyEvent(self, event):
|
||||||
key = event.char
|
key = event.char
|
||||||
key = six.text_type(key, 'utf-8')
|
key = str(key, 'utf-8')
|
||||||
key = key.lower()
|
key = key.lower()
|
||||||
button = self.accel_keys.get(key)
|
button = self.accel_keys.get(key)
|
||||||
if button is not None:
|
if button is not None:
|
||||||
|
@ -285,7 +284,7 @@ class MfxExceptionDialog(MfxMessageDialog):
|
||||||
(ex.errno, ex.strerror, repr(ex.filename))
|
(ex.errno, ex.strerror, repr(ex.filename))
|
||||||
else:
|
else:
|
||||||
t = str(ex)
|
t = str(ex)
|
||||||
kw.text = text + six.text_type(t, errors='replace')
|
kw.text = text + str(t, errors='replace')
|
||||||
MfxMessageDialog.__init__(self, parent, title, **kw.getKw())
|
MfxMessageDialog.__init__(self, parent, title, **kw.getKw())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import Image, ImageTk
|
from pysollib.mfxutil import Image, ImageTk
|
||||||
from pysollib.mygettext import _, n_
|
from pysollib.mygettext import _, n_
|
||||||
|
@ -31,8 +32,6 @@ from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
from pysollib.util import IMAGE_EXTENSIONS
|
from pysollib.util import IMAGE_EXTENSIONS
|
||||||
from pysollib.winsystems import TkSettings
|
from pysollib.winsystems import TkSettings
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tkwidget import MfxTooltip
|
from .tkwidget import MfxTooltip
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.wizardpresets import presets
|
from pysollib.wizardpresets import presets
|
||||||
from pysollib.wizardutil import WizardWidgets
|
from pysollib.wizardutil import WizardWidgets
|
||||||
|
|
||||||
import six
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
from .tabpage import TabPageSet
|
from .tabpage import TabPageSet
|
||||||
from .tkwidget import MfxDialog
|
from .tkwidget import MfxDialog
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ class WizardDialog(MfxDialog):
|
||||||
notebook.pack(expand=True, fill='both')
|
notebook.pack(expand=True, fill='both')
|
||||||
|
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
notebook.AddPage(w)
|
notebook.AddPage(w)
|
||||||
frame = tkinter.Frame(notebook.pages[w]['page'])
|
frame = tkinter.Frame(notebook.pages[w]['page'])
|
||||||
frame.pack(expand=True, fill='both', padx=2, pady=4)
|
frame.pack(expand=True, fill='both', padx=2, pady=4)
|
||||||
|
@ -117,7 +116,7 @@ class WizardDialog(MfxDialog):
|
||||||
n = w.translation_map[v]
|
n = w.translation_map[v]
|
||||||
p = presets[n]
|
p = presets[n]
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
continue
|
continue
|
||||||
if w.var_name in p:
|
if w.var_name in p:
|
||||||
v = p[w.var_name]
|
v = p[w.var_name]
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# This module exports classes for the various canvas item types
|
# This module exports classes for the various canvas item types
|
||||||
|
|
||||||
# NOTE: This module was an experiment and is now obsolete.
|
# NOTE: This module was an experiment and is now obsolete.
|
||||||
# It's best to use the Tkinter.Canvas class directly.
|
# It's best to use the tkinter.Canvas class directly.
|
||||||
|
|
||||||
from six.moves.tkinter import Canvas, _cnfmerge, _flatten # noqa: F401
|
from tkinter import Canvas, _cnfmerge, _flatten # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class CanvasItem:
|
class CanvasItem:
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves.tkinter_colorchooser import askcolor
|
from six.moves.tkinter_colorchooser import askcolor
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import KwStruct
|
from pysollib.mfxutil import KwStruct
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
|
|
||||||
class BaseEditTextDialog:
|
class BaseEditTextDialog:
|
||||||
def __init__(self, parent, title, text, **kw):
|
def __init__(self, parent, title, text, **kw):
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.resource import CSI
|
from pysollib.resource import CSI
|
||||||
|
@ -31,8 +32,6 @@ from pysollib.ui.tktile.tkcanvas import MfxCanvasImage, MfxCanvasRectangle
|
||||||
from pysollib.ui.tktile.tkutil import after, after_cancel
|
from pysollib.ui.tktile.tkutil import after, after_cancel
|
||||||
from pysollib.ui.tktile.tkutil import bind, makeImage, unbind_destroy
|
from pysollib.ui.tktile.tkutil import bind, makeImage, unbind_destroy
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
|
|
||||||
LARGE_EMBLEMS_SIZE = (38, 34)
|
LARGE_EMBLEMS_SIZE = (38, 34)
|
||||||
SMALL_EMBLEMS_SIZE = (31, 21)
|
SMALL_EMBLEMS_SIZE = (31, 21)
|
||||||
|
|
|
@ -21,14 +21,14 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.ui.tktile.tkcanvas import MfxCanvas, MfxCanvasGroup
|
from pysollib.ui.tktile.tkcanvas import MfxCanvas, MfxCanvasGroup
|
||||||
from pysollib.ui.tktile.tkcanvas import MfxCanvasImage
|
from pysollib.ui.tktile.tkcanvas import MfxCanvasImage
|
||||||
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
|
|
||||||
class FullPictureDialog(tkinter.Toplevel):
|
class FullPictureDialog(tkinter.Toplevel):
|
||||||
CARD_IMAGES = {} # key: (type, rank, suit)
|
CARD_IMAGES = {} # key: (type, rank, suit)
|
||||||
|
|
|
@ -3,6 +3,7 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.gamedb import GI
|
from pysollib.gamedb import GI
|
||||||
from pysollib.hint import PySolHintLayoutImportError
|
from pysollib.hint import PySolHintLayoutImportError
|
||||||
|
@ -17,7 +18,6 @@ from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE
|
||||||
from pysollib.ui.tktile.tkconst import STATUSBAR_ITEMS, TOOLBAR_BUTTONS
|
from pysollib.ui.tktile.tkconst import STATUSBAR_ITEMS, TOOLBAR_BUTTONS
|
||||||
from pysollib.ui.tktile.tkutil import after_idle, bind
|
from pysollib.ui.tktile.tkutil import after_idle, bind
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_tkfiledialog
|
from six.moves import tkinter_tkfiledialog
|
||||||
|
|
||||||
|
|
||||||
|
@ -2190,7 +2190,7 @@ Error while saving game.
|
||||||
% self.game.gameinfo.name):
|
% self.game.gameinfo.name):
|
||||||
return
|
return
|
||||||
from pysollib.wizardutil import delete_game
|
from pysollib.wizardutil import delete_game
|
||||||
delete_game(self.game)
|
delete_game(self.app, self.game)
|
||||||
self.game.endGame()
|
self.game.endGame()
|
||||||
self.game.quitGame(2)
|
self.game.quitGame(2)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
from pysollib.ui.tktile.tkconst import EVENT_HANDLED
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
|
|
||||||
class BaseSolverDialog:
|
class BaseSolverDialog:
|
||||||
def _ToggleShowProgressButton(self, *args):
|
def _ToggleShowProgressButton(self, *args):
|
||||||
|
|
|
@ -21,13 +21,13 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import Image, ImageTk
|
from pysollib.mfxutil import Image, ImageTk
|
||||||
from pysollib.ui.tktile.Canvas2 import CanvasText, Group, Line, Rectangle
|
from pysollib.ui.tktile.Canvas2 import CanvasText, Group, Line, Rectangle
|
||||||
from pysollib.ui.tktile.Canvas2 import ImageItem as ImageItem2
|
from pysollib.ui.tktile.Canvas2 import ImageItem as ImageItem2
|
||||||
from pysollib.ui.tktile.tkutil import loadImage, unbind_destroy
|
from pysollib.ui.tktile.tkutil import loadImage, unbind_destroy
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * canvas items
|
# * canvas items
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------##
|
# ---------------------------------------------------------------------------##
|
||||||
|
|
||||||
from pysollib.mygettext import n_
|
import tkinter
|
||||||
|
|
||||||
from six.moves import tkinter
|
from pysollib.mygettext import n_
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * constants
|
# * constants
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tkinter
|
||||||
|
|
||||||
import pysollib.formatter
|
import pysollib.formatter
|
||||||
import pysollib.htmllib2 as htmllib
|
import pysollib.htmllib2 as htmllib
|
||||||
|
@ -31,8 +32,6 @@ from pysollib.mygettext import _
|
||||||
from pysollib.settings import TITLE
|
from pysollib.settings import TITLE
|
||||||
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
from pysollib.ui.tktile.tkutil import bind, unbind_destroy
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
|
|
||||||
REMOTE_PROTOCOLS = ("ftp:", "gopher:", "http:", "https:", "mailto:", "news:",
|
REMOTE_PROTOCOLS = ("ftp:", "gopher:", "http:", "https:", "mailto:", "news:",
|
||||||
"telnet:")
|
"telnet:")
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.mfxutil import Image, ImageDraw, ImageOps, ImageTk, \
|
from pysollib.mfxutil import Image, ImageDraw, ImageOps, ImageTk, \
|
||||||
get_default_resampling
|
get_default_resampling
|
||||||
from pysollib.settings import TITLE, WIN_SYSTEM
|
from pysollib.settings import TITLE, WIN_SYSTEM
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_font
|
from six.moves import tkinter_font
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,9 +21,10 @@
|
||||||
#
|
#
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
|
||||||
from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE
|
from pysollib.ui.tktile.tkconst import EVENT_PROPAGATE
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
TclError = tkinter.TclError
|
TclError = tkinter.TclError
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,6 @@ from pysollib.mfxutil import Image
|
||||||
from pysollib.mygettext import _
|
from pysollib.mygettext import _
|
||||||
from pysollib.settings import DATA_DIRS, TOOLKIT
|
from pysollib.settings import DATA_DIRS, TOOLKIT
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# * constants
|
# * constants
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -152,8 +150,8 @@ class DataLoader:
|
||||||
def __findFile(self, func, filename, subdirs=None, do_raise=1):
|
def __findFile(self, func, filename, subdirs=None, do_raise=1):
|
||||||
if subdirs is None:
|
if subdirs is None:
|
||||||
subdirs = ("",)
|
subdirs = ("",)
|
||||||
elif isinstance(subdirs, six.string_types):
|
elif isinstance(subdirs, str):
|
||||||
subdirs = (str(subdirs),)
|
subdirs = (subdirs,)
|
||||||
for dir in subdirs:
|
for dir in subdirs:
|
||||||
f = os.path.join(self.dir, dir, filename)
|
f = os.path.join(self.dir, dir, filename)
|
||||||
f = os.path.normpath(f)
|
f = os.path.normpath(f)
|
||||||
|
|
|
@ -66,8 +66,6 @@ from pysollib.stack import AC_FoundationStack, \
|
||||||
from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, UNLIMITED_MOVES
|
from pysollib.util import ACE, ANY_RANK, KING, NO_RANK, UNLIMITED_MOVES
|
||||||
from pysollib.wizardpresets import presets
|
from pysollib.wizardpresets import presets
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
# *
|
# *
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
@ -436,7 +434,7 @@ class MyCustomGame(CustomGame):
|
||||||
''')
|
''')
|
||||||
|
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
continue
|
continue
|
||||||
v = w.variable.get()
|
v = w.variable.get()
|
||||||
if w.widget in ('menu', 'preset'):
|
if w.widget in ('menu', 'preset'):
|
||||||
|
@ -455,7 +453,7 @@ class MyCustomGame(CustomGame):
|
||||||
v = v.replace("\r", "\\r")
|
v = v.replace("\r", "\\r")
|
||||||
v = v.replace("\t", "\\t")
|
v = v.replace("\t", "\\t")
|
||||||
# See: https://github.com/shlomif/PySolFC/issues/177
|
# See: https://github.com/shlomif/PySolFC/issues/177
|
||||||
# if isinstance(v, six.text_type):
|
# if isinstance(v, str):
|
||||||
# v = v.encode('utf-8')
|
# v = v.encode('utf-8')
|
||||||
if not v:
|
if not v:
|
||||||
v = 'Invalid Game Name'
|
v = 'Invalid Game Name'
|
||||||
|
@ -473,15 +471,16 @@ registerCustomGame(MyCustomGame)
|
||||||
return gameid
|
return gameid
|
||||||
|
|
||||||
|
|
||||||
def delete_game(game):
|
def delete_game(app, game):
|
||||||
hideGame(game)
|
hideGame(game)
|
||||||
|
app.stats.deleteGameStats(game.id)
|
||||||
fn = game.MODULE_FILENAME
|
fn = game.MODULE_FILENAME
|
||||||
os.remove(fn)
|
os.remove(fn)
|
||||||
|
|
||||||
|
|
||||||
def reset_wizard(game):
|
def reset_wizard(game):
|
||||||
for w in WizardWidgets:
|
for w in WizardWidgets:
|
||||||
if isinstance(w, six.string_types):
|
if isinstance(w, str):
|
||||||
continue
|
continue
|
||||||
if game is None:
|
if game is None:
|
||||||
# set to default
|
# set to default
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# -*- mode: python; coding: koi8-r; -*-
|
# -*- mode: python; coding: koi8-r; -*-
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import builtins
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -16,7 +17,6 @@ from pysollib.mfxutil import latin1_normalize
|
||||||
from pysollib.mygettext import fix_gettext
|
from pysollib.mygettext import fix_gettext
|
||||||
from pysollib.resource import CSI
|
from pysollib.resource import CSI
|
||||||
|
|
||||||
from six.moves import builtins
|
|
||||||
os.environ['LANG'] = 'C'
|
os.environ['LANG'] = 'C'
|
||||||
builtins.__dict__['_'] = lambda x: x
|
builtins.__dict__['_'] = lambda x: x
|
||||||
builtins.__dict__['n_'] = lambda x: x
|
builtins.__dict__['n_'] = lambda x: x
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
# Arrow up/down flip through the sets
|
# Arrow up/down flip through the sets
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tkinter
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from PIL import Image, ImageTk
|
from PIL import Image, ImageTk
|
||||||
|
|
||||||
from six.moves import tkinter
|
|
||||||
from six.moves import tkinter_tkfiledialog as filedialog # messagebox
|
from six.moves import tkinter_tkfiledialog as filedialog # messagebox
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue