mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Merge branch 'solver_dialog_remove_so_called_solving_method' into deal_ms_cards
Conflicts: pysollib/actions.py pysollib/app.py pysollib/game.py pysollib/help.py pysollib/images.py pysollib/init.py pysollib/layout.py pysollib/main.py pysollib/stack.py
This commit is contained in:
commit
ce7a34ba5a
120 changed files with 740 additions and 266 deletions
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
tests/individually-importing/*.py
|
||||
build/*
|
||||
data/cardsets/*
|
||||
data/html/*
|
||||
dist/*
|
||||
docs/all_games.html
|
||||
html-src/html/*
|
||||
locale/*
|
||||
po/pl.po
|
||||
po/ru.po
|
||||
*.pyc
|
5
Makefile
5
Makefile
|
@ -58,3 +58,8 @@ mo:
|
|||
done
|
||||
cp -f locale/pl/LC_MESSAGES/pysol.mo locale/pl_PL/LC_MESSAGES/pysol.mo
|
||||
cp -f locale/it/LC_MESSAGES/pysol.mo locale/it_IT/LC_MESSAGES/pysol.mo
|
||||
|
||||
test:
|
||||
@rm -f tests/individually-importing/*.py # To avoid stray files
|
||||
python scripts/gen_individual_importing_tests.py
|
||||
runprove tests/individually-importing/*.py
|
||||
|
|
14
html-src/rules/daddylonglegs.html
Normal file
14
html-src/rules/daddylonglegs.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<h1>Daddy Longlegs</h1>
|
||||
<p>Spider type. 1 deck. No redeal.</p>
|
||||
<h3>Object</h3>
|
||||
<p>Group all the cards into four sets of 13 cards by suit in ascending sequence from Ace to King.</p>
|
||||
<h3>Rules</h3>
|
||||
<p>Cards are dealt four at a time, one card into each of four piles. A card can be moved onto the end of another pile, if it is the same suit and follows in sequence. The rest of the pile moves with the card. Only an Ace (with the rest of its pile) can move to an empty space.</p>
|
||||
<p>At any time, you can deal more cards by clicking on the talon. One card will be added to each of the playing piles.</p>
|
||||
<h3>History</h3>
|
||||
<p>I created Daddy Longlegs in the early 1980's to amuse myself with a different solitaire variant. Over the years, I have implemented this game many times under the name of "Deal Four" as an exercise when learning new programming languages.</p>
|
||||
<p>I learned of pysol in 2006 and almost immediately realized that it is a perfect platform for Daddy Longlegs. Thank you, Markus Oberhumer!</p>
|
||||
<h3>Author</h3>
|
||||
<p>Jim Sizelove</p>
|
||||
<p>sizelji@comcast.net</p>
|
||||
<p>March 8, 2007</p>
|
|
@ -26,7 +26,7 @@
|
|||
from random import randint
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import SubclassResponsibility
|
||||
from pysollib.mfxutil import SubclassResponsibility
|
||||
|
||||
# ************************************************************************
|
||||
# *
|
||||
|
|
|
@ -26,17 +26,17 @@
|
|||
import os, locale
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import SubclassResponsibility
|
||||
from mfxutil import Struct, openURL
|
||||
from mfxutil import print_err
|
||||
from pysolrandom import constructRandom
|
||||
from settings import TITLE, PACKAGE_URL
|
||||
from settings import TOP_TITLE
|
||||
from settings import DEBUG
|
||||
from gamedb import GI
|
||||
from pysollib.mfxutil import SubclassResponsibility
|
||||
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 stats import FileStatsFormatter
|
||||
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
|
||||
|
@ -44,6 +44,7 @@ from pysollib.pysoltk import ProgressionDialog
|
|||
from pysollib.pysoltk import GameInfoDialog
|
||||
|
||||
# toolkit imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.pysoltk import MfxMessageDialog, MfxSimpleEntry
|
||||
from pysollib.pysoltk import MfxExceptionDialog
|
||||
from pysollib.pysoltk import PlayerOptionsDialog
|
||||
|
@ -54,7 +55,7 @@ from pysollib.pysoltk import EditTextDialog
|
|||
from pysollib.pysoltk import create_find_card_dialog
|
||||
from pysollib.pysoltk import create_solver_dialog
|
||||
from pysollib.pysoltk import PysolMenubarTk, PysolToolbarTk
|
||||
from help import help_about, help_html
|
||||
from pysollib.help import help_about, help_html
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
|
|
@ -27,26 +27,27 @@ import os, re
|
|||
import traceback
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import destruct, Struct
|
||||
from mfxutil import pickle, unpickle, UnpicklingError
|
||||
from mfxutil import getusername, getprefdir
|
||||
from mfxutil import latin1_to_ascii, print_err
|
||||
from mfxutil import USE_PIL
|
||||
from util import CARDSET, IMAGE_EXTENSIONS
|
||||
from settings import PACKAGE, VERSION_TUPLE, WIN_SYSTEM
|
||||
from resource import CSI, CardsetConfig, Cardset, CardsetManager
|
||||
from resource import Tile, TileManager
|
||||
from resource import Sample, SampleManager
|
||||
from resource import Music, MusicManager
|
||||
from pysollib.mfxutil import destruct, Struct
|
||||
from pysollib.mfxutil import pickle, unpickle, UnpicklingError
|
||||
from pysollib.mfxutil import getusername, getprefdir
|
||||
from pysollib.mfxutil import latin1_to_ascii, 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.images import Images, SubsampledImages
|
||||
from pysolrandom import PysolRandom
|
||||
from gamedb import GI, GAME_DB, loadGame
|
||||
from options import Options
|
||||
from settings import TOP_SIZE, TOOLKIT
|
||||
from settings import DEBUG
|
||||
from winsystems import TkSettings
|
||||
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.mygettext import _, n_
|
||||
from pysollib.pysoltk import wm_withdraw, loadImage
|
||||
from pysollib.pysoltk import MfxDialog, MfxMessageDialog, MfxExceptionDialog
|
||||
from pysollib.pysoltk import TclError, MfxScrolledCanvas
|
||||
|
@ -58,10 +59,9 @@ from pysollib.pysoltk import HTMLViewer
|
|||
from pysollib.pysoltk import destroy_find_card_dialog
|
||||
from pysollib.pysoltk import destroy_solver_dialog
|
||||
|
||||
from actions import PysolMenubar
|
||||
from actions import PysolToolbar
|
||||
from help import help_about, destroy_help_html
|
||||
|
||||
from pysollib.actions import PysolMenubar
|
||||
from pysollib.actions import PysolToolbar
|
||||
from pysollib.help import help_about, destroy_help_html
|
||||
|
||||
# ************************************************************************
|
||||
# * Statistics
|
||||
|
@ -516,7 +516,7 @@ class Application:
|
|||
self.nextgame.id, self.nextgame.random = 0, None
|
||||
try:
|
||||
self.runGame(id, random)
|
||||
except:
|
||||
except Exception:
|
||||
# try Klondike if current game fails
|
||||
if id == 2:
|
||||
raise # internal error?
|
||||
|
|
|
@ -21,15 +21,14 @@
|
|||
##
|
||||
##---------------------------------------------------------------------------##
|
||||
|
||||
from gamedb import registerGame, GameInfo, GI
|
||||
from util import *
|
||||
from stack import *
|
||||
from game import Game
|
||||
from layout import Layout
|
||||
from hint import AbstractHint, DefaultHint, CautiousDefaultHint, Yukon_Hint
|
||||
|
||||
from wizardutil import WizardWidgets
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
from pysollib.game import Game
|
||||
from pysollib.layout import Layout
|
||||
from pysollib.hint import AbstractHint, DefaultHint, CautiousDefaultHint, Yukon_Hint
|
||||
|
||||
from pysollib.wizardutil import WizardWidgets
|
||||
|
||||
# ************************************************************************
|
||||
# *
|
||||
|
|
|
@ -26,20 +26,23 @@
|
|||
import time
|
||||
import math
|
||||
import traceback
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
from gettext import ungettext
|
||||
from cStringIO import StringIO
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import Pickler, Unpickler, UnpicklingError
|
||||
from mfxutil import Image, ImageTk, USE_PIL
|
||||
from mfxutil import destruct, Struct, SubclassResponsibility
|
||||
from mfxutil import uclock, usleep
|
||||
from mfxutil import format_time, print_err
|
||||
from settings import PACKAGE, TITLE, TOOLKIT, TOP_TITLE
|
||||
from settings import VERSION, VERSION_TUPLE
|
||||
from settings import DEBUG
|
||||
from gamedb import GI
|
||||
from pysolrandom import PysolRandom, LCRandom31
|
||||
from pysollib.mfxutil import Pickler, Unpickler, UnpicklingError
|
||||
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 format_time, print_err
|
||||
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
|
||||
from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from pysollib.pysoltk import CURSOR_WATCH
|
||||
from pysollib.pysoltk import bind, wm_map
|
||||
|
@ -48,13 +51,13 @@ from pysollib.pysoltk import MfxMessageDialog, MfxExceptionDialog
|
|||
from pysollib.pysoltk import MfxCanvasText, MfxCanvasLine, MfxCanvasRectangle
|
||||
from pysollib.pysoltk import Card
|
||||
from pysollib.pysoltk import reset_solver_dialog
|
||||
from move import AMoveMove, AFlipMove, AFlipAndMoveMove
|
||||
from move import ASingleFlipMove, ATurnStackMove
|
||||
from move import ANextRoundMove, ASaveSeedMove, AShuffleStackMove
|
||||
from move import AUpdateStackMove, AFlipAllMove, ASaveStateMove
|
||||
from move import ASingleCardMove
|
||||
from hint import DefaultHint
|
||||
from help import help_about
|
||||
from pysollib.move import AMoveMove, AFlipMove, AFlipAndMoveMove
|
||||
from pysollib.move import ASingleFlipMove, ATurnStackMove
|
||||
from pysollib.move import ANextRoundMove, ASaveSeedMove, AShuffleStackMove
|
||||
from pysollib.move import AUpdateStackMove, AFlipAllMove, ASaveStateMove
|
||||
from pysollib.move import ASingleCardMove
|
||||
from pysollib.hint import DefaultHint
|
||||
from pysollib.help import help_about
|
||||
|
||||
PLAY_TIME_TIMEOUT = 200
|
||||
|
||||
|
@ -254,7 +257,7 @@ class Game:
|
|||
'%s: %s %s' % (class_name, ncards, self.gameinfo.ncards),
|
||||
2)
|
||||
if self.s.rows:
|
||||
from stack import AC_RowStack, UD_AC_RowStack, \
|
||||
from pysollib.stack import AC_RowStack, UD_AC_RowStack, \
|
||||
SS_RowStack, UD_SS_RowStack, \
|
||||
RK_RowStack, UD_RK_RowStack, \
|
||||
Spider_AC_RowStack, Spider_SS_RowStack
|
||||
|
@ -3303,8 +3306,8 @@ in the current implementation.''') % version)
|
|||
#
|
||||
|
||||
def showStackDesc(self):
|
||||
from pysoltk import StackDesc
|
||||
from stack import InitialDealTalonStack
|
||||
from pysollib.pysoltk import StackDesc
|
||||
from pysollib.stack import InitialDealTalonStack
|
||||
sd_list = []
|
||||
for s in self.allstacks:
|
||||
sd = (s.__class__.__name__, s.cap.base_rank, s.cap.dir)
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
import imp
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import Struct, print_err
|
||||
from resource import CSI
|
||||
import settings
|
||||
from pysollib.mfxutil import Struct, print_err
|
||||
from pysollib.resource import CSI
|
||||
import pysollib.settings
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# ************************************************************************
|
||||
# * constants
|
||||
|
@ -420,18 +421,18 @@ class GameInfo(Struct):
|
|||
game_type = game_type & 1023
|
||||
name = to_unicode(name)
|
||||
en_name = name # for app.getGameRulesFilename
|
||||
if settings.TRANSLATE_GAME_NAMES:
|
||||
if pysollib.settings.TRANSLATE_GAME_NAMES:
|
||||
name = _(name)
|
||||
if not short_name:
|
||||
short_name = name
|
||||
else:
|
||||
short_name = to_unicode(short_name)
|
||||
if settings.TRANSLATE_GAME_NAMES:
|
||||
if pysollib.settings.TRANSLATE_GAME_NAMES:
|
||||
short_name = _(short_name)
|
||||
if isinstance(altnames, basestring):
|
||||
altnames = (altnames,)
|
||||
altnames = [to_unicode(n) for n in altnames]
|
||||
if settings.TRANSLATE_GAME_NAMES:
|
||||
if pysollib.settings.TRANSLATE_GAME_NAMES:
|
||||
altnames = [_(n) for n in altnames]
|
||||
#
|
||||
if not (1 <= category <= 9):
|
||||
|
@ -545,7 +546,7 @@ class GameManager:
|
|||
##print gi.id, gi.short_name.encode('utf-8')
|
||||
if not isinstance(gi, GameInfo):
|
||||
raise GameInfoException("wrong GameInfo class")
|
||||
if self.check_game and settings.CHECK_GAMES:
|
||||
if self.check_game and pysollib.settings.CHECK_GAMES:
|
||||
self._check_game(gi)
|
||||
##if 0 and gi.si.game_flags & GI.GT_XORIGINAL:
|
||||
## return
|
||||
|
|
|
@ -35,6 +35,7 @@ import camelot
|
|||
import canfield
|
||||
import capricieuse
|
||||
import curdsandwhey
|
||||
import daddylonglegs
|
||||
import dieboesesieben
|
||||
import diplomat
|
||||
import doublets
|
||||
|
|
|
@ -26,6 +26,7 @@ __all__ = []
|
|||
# imports
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys, math
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -1,32 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
##---------------------------------------------------------------------------##
|
||||
##
|
||||
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
||||
## Copyright (C) 2003 Mt. Hood Playing Card Co.
|
||||
## Copyright (C) 2005-2009 Skomoroh
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
##---------------------------------------------------------------------------##
|
||||
|
||||
__all__ = []
|
||||
|
||||
# imports
|
||||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -26,6 +26,7 @@ __all__ = []
|
|||
# imports
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -1,32 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
##---------------------------------------------------------------------------##
|
||||
##
|
||||
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
|
||||
## Copyright (C) 2003 Mt. Hood Playing Card Co.
|
||||
## Copyright (C) 2005-2009 Skomoroh
|
||||
##
|
||||
## This program is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
##---------------------------------------------------------------------------##
|
||||
|
||||
__all__ = []
|
||||
|
||||
# imports
|
||||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
57
pysollib/games/daddylonglegs.py
Normal file
57
pysollib/games/daddylonglegs.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
## vim:ts=4:et:nowrap:fileencoding=utf-8
|
||||
##
|
||||
|
||||
# imports
|
||||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
from pysollib.game import Game
|
||||
from pysollib.layout import Layout
|
||||
|
||||
|
||||
#***********************************************************************
|
||||
# Daddy Longlegs (by Jim Sizelove)
|
||||
#***********************************************************************
|
||||
|
||||
class DaddyLonglegs(Game):
|
||||
Talon_Class = DealRowTalonStack
|
||||
RowStack_Class = StackWrapper(Yukon_SS_RowStack, dir=1, base_rank=ACE)
|
||||
|
||||
def createGame(self, **layout):
|
||||
# create layout
|
||||
l, s = Layout(self), self.s
|
||||
|
||||
# set window
|
||||
self.setSize(l.XM + 6*l.XS, l.YM + 7*l.YS)
|
||||
|
||||
# create stacks
|
||||
x, y, = l.XM, l.YM
|
||||
s.talon = self.Talon_Class(x, y, self)
|
||||
l.createText(s.talon, "ss")
|
||||
x = x + 3*l.XS/2
|
||||
for i in range(4):
|
||||
s.rows.append(self.RowStack_Class(x, y, self))
|
||||
x = x + l.XS
|
||||
|
||||
# define stack-groups
|
||||
l.defaultStackGroups()
|
||||
|
||||
def startGame(self):
|
||||
self.s.talon.dealRow()
|
||||
|
||||
def isGameWon(self):
|
||||
if self.s.talon.cards:
|
||||
return 0
|
||||
for row in self.s.rows:
|
||||
if not isSameSuitSequence(row.cards, dir=1):
|
||||
return 0
|
||||
return 1
|
||||
|
||||
|
||||
# register the game
|
||||
registerGame(GameInfo(555001, DaddyLonglegs, "Daddy Longlegs",
|
||||
GI.GT_SPIDER, 1, 0, GI.SL_MOSTLY_SKILL,
|
||||
rules_filename="daddylonglegs.html"))
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys, types
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault, Struct
|
||||
|
|
|
@ -26,6 +26,7 @@ __all__ = []
|
|||
# imports
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -30,6 +30,7 @@ import time
|
|||
from gettext import ungettext
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault, Struct, Image
|
||||
|
|
|
@ -29,6 +29,7 @@ import sys
|
|||
from gettext import ungettext
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys, time
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -26,6 +26,7 @@ __all__ = []
|
|||
# imports
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -26,6 +26,7 @@ __all__ = []
|
|||
# Imports
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -26,7 +26,9 @@ __all__ = []
|
|||
# Imports
|
||||
import sys, math, time
|
||||
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys, math
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -52,6 +52,7 @@ __all__ = [
|
|||
|
||||
import sys, math
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
from pysollib.stack import *
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys, math
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys, math
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = []
|
|||
import sys
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import registerGame, GameInfo, GI
|
||||
from pysollib.util import *
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
# imports
|
||||
|
||||
# PySol imports
|
||||
from settings import TITLE, PACKAGE_URL, TOOLKIT, VERSION
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.settings import TITLE, PACKAGE_URL, TOOLKIT, VERSION
|
||||
from pysollib.pysoltk import make_help_toplevel
|
||||
from pysollib.pysoltk import MfxMessageDialog
|
||||
from pysollib.pysoltk import PysolAboutDialog
|
||||
|
|
|
@ -29,10 +29,9 @@ import subprocess
|
|||
import re
|
||||
|
||||
# PySol imports
|
||||
from settings import DEBUG, FCS_COMMAND
|
||||
from mfxutil import destruct
|
||||
from util import KING
|
||||
|
||||
from pysollib.settings import DEBUG, FCS_COMMAND
|
||||
from pysollib.mfxutil import destruct
|
||||
from pysollib.util import KING
|
||||
|
||||
# ************************************************************************
|
||||
# * HintInterface is an abstract class that defines the public
|
||||
|
@ -717,7 +716,6 @@ class FreeCellSolver_Hint:
|
|||
self.dialog = dialog
|
||||
self.game_type = game_type
|
||||
self.options = {
|
||||
'method': 'soft-dfs',
|
||||
'max_iters': 10000,
|
||||
'max_depth': 1000,
|
||||
'progress': False,
|
||||
|
@ -824,7 +822,6 @@ class FreeCellSolver_Hint:
|
|||
args += ['--load-config', self.options['preset']]
|
||||
args += ['--max-iters', self.options['max_iters'],
|
||||
'--max-depth', self.options['max_depth'],
|
||||
'--method', self.options['method'],
|
||||
'--decks-num', game.gameinfo.decks,
|
||||
'--stacks-num', len(game.s.rows),
|
||||
'--freecells-num', len(game.s.reserves),
|
||||
|
|
|
@ -34,7 +34,6 @@ from pysollib.mfxutil import Image, ImageTk, USE_PIL
|
|||
# Toolkit imports
|
||||
from pysollib.pysoltk import loadImage, copyImage, createImage, shadowImage, createBottom, resizeBottom
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
# * Images
|
||||
# ************************************************************************
|
||||
|
|
|
@ -23,48 +23,17 @@
|
|||
|
||||
import sys, os, locale, subprocess
|
||||
import traceback
|
||||
import gettext
|
||||
|
||||
import settings
|
||||
from pysollib.mygettext import _, n_
|
||||
import gettext
|
||||
import pysollib.settings
|
||||
|
||||
# ************************************************************************
|
||||
# * init
|
||||
# ************************************************************************
|
||||
|
||||
def fix_gettext():
|
||||
def ugettext(message):
|
||||
# unicoded gettext
|
||||
if not isinstance(message, unicode):
|
||||
message = unicode(message, 'utf-8')
|
||||
domain = gettext._current_domain
|
||||
try:
|
||||
t = gettext.translation(domain,
|
||||
gettext._localedirs.get(domain, None))
|
||||
except IOError:
|
||||
return message
|
||||
return t.ugettext(message)
|
||||
gettext.ugettext = ugettext
|
||||
def ungettext(msgid1, msgid2, n):
|
||||
# unicoded ngettext
|
||||
if not isinstance(msgid1, unicode):
|
||||
msgid1 = unicode(msgid1, 'utf-8')
|
||||
if not isinstance(msgid2, unicode):
|
||||
msgid2 = unicode(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
|
||||
return t.ungettext(msgid1, msgid2, n)
|
||||
gettext.ungettext = ungettext
|
||||
|
||||
|
||||
def init():
|
||||
fix_gettext()
|
||||
|
||||
if os.name == 'nt' and 'LANG' not in os.environ:
|
||||
try:
|
||||
|
@ -88,69 +57,66 @@ def init():
|
|||
#gettext.install('pysol', locale_dir, unicode=True) # ngettext don't work
|
||||
gettext.bindtextdomain('pysol', locale_dir)
|
||||
gettext.textdomain('pysol')
|
||||
import __builtin__
|
||||
__builtin__._ = gettext.ugettext # use unicode
|
||||
__builtin__.n_ = lambda x: x
|
||||
|
||||
## debug
|
||||
if 'PYSOL_CHECK_GAMES' in os.environ or 'PYSOL_DEBUG' in os.environ:
|
||||
settings.CHECK_GAMES = True
|
||||
pysollib.settings.CHECK_GAMES = True
|
||||
print 'PySol debugging: set CHECK_GAMES to True'
|
||||
if 'PYSOL_DEBUG' in os.environ:
|
||||
try:
|
||||
settings.DEBUG = int(os.environ['PYSOL_DEBUG'])
|
||||
pysollib.settings.DEBUG = int(os.environ['PYSOL_DEBUG'])
|
||||
except:
|
||||
settings.DEBUG = 1
|
||||
print 'PySol debugging: set DEBUG to', settings.DEBUG
|
||||
pysollib.settings.DEBUG = 1
|
||||
print 'PySol debugging: set DEBUG to', pysollib.settings.DEBUG
|
||||
|
||||
## init toolkit
|
||||
if '--gtk' in sys.argv:
|
||||
settings.TOOLKIT = 'gtk'
|
||||
pysollib.settings.TOOLKIT = 'gtk'
|
||||
sys.argv.remove('--gtk')
|
||||
elif '--tk' in sys.argv:
|
||||
settings.TOOLKIT = 'tk'
|
||||
settings.USE_TILE = False
|
||||
pysollib.settings.TOOLKIT = 'tk'
|
||||
pysollib.settings.USE_TILE = False
|
||||
sys.argv.remove('--tk')
|
||||
elif '--tile' in sys.argv:
|
||||
settings.TOOLKIT = 'tk'
|
||||
settings.USE_TILE = True
|
||||
pysollib.settings.TOOLKIT = 'tk'
|
||||
pysollib.settings.USE_TILE = True
|
||||
sys.argv.remove('--tile')
|
||||
if settings.TOOLKIT == 'tk':
|
||||
if pysollib.settings.TOOLKIT == 'tk':
|
||||
import Tkinter
|
||||
root = Tkinter.Tk(className=settings.TITLE)
|
||||
root = Tkinter.Tk(className=pysollib.settings.TITLE)
|
||||
root.withdraw()
|
||||
if Tkinter.TkVersion < 8.4:
|
||||
# we need unicode support
|
||||
sys.exit("%s needs Tcl/Tk 8.4 or better (you have %s)" %
|
||||
(settings.TITLE, str(Tkinter.TkVersion)))
|
||||
settings.WIN_SYSTEM = root.tk.call('tk', 'windowingsystem')
|
||||
if settings.WIN_SYSTEM == 'aqua':
|
||||
(pysollib.settings.TITLE, str(Tkinter.TkVersion)))
|
||||
pysollib.settings.WIN_SYSTEM = root.tk.call('tk', 'windowingsystem')
|
||||
if pysollib.settings.WIN_SYSTEM == 'aqua':
|
||||
# TkAqua displays the console automatically in application
|
||||
# bundles, so we hide it here.
|
||||
from macosx.appSupport import hideTkConsole
|
||||
from pysollib.macosx.appSupport import hideTkConsole
|
||||
hideTkConsole(root)
|
||||
#
|
||||
if settings.USE_TILE == 'auto':
|
||||
if pysollib.settings.USE_TILE == 'auto':
|
||||
# check Tile
|
||||
settings.USE_TILE = False
|
||||
pysollib.settings.USE_TILE = False
|
||||
try:
|
||||
root.tk.eval('package require tile 0.7.8')
|
||||
except Tkinter.TclError:
|
||||
pass
|
||||
else:
|
||||
settings.USE_TILE = True
|
||||
pysollib.settings.USE_TILE = True
|
||||
# "can't invoke event <<ThemeChanged>>: application has been destroyed"
|
||||
#root.destroy()
|
||||
Tkinter._default_root = None
|
||||
|
||||
# check FreeCell-Solver
|
||||
settings.USE_FREECELL_SOLVER = False
|
||||
pysollib.settings.USE_FREECELL_SOLVER = False
|
||||
if os.name == 'nt':
|
||||
if sys.path[0] and not os.path.isdir(sys.path[0]): # i.e. library.zip
|
||||
d = os.path.dirname(sys.path[0])
|
||||
os.chdir(d) # for read presets
|
||||
fcs_command = os.path.join('freecell-solver', 'bin', 'fc-solve.exe')
|
||||
settings.FCS_COMMAND = fcs_command
|
||||
pysollib.settings.FCS_COMMAND = fcs_command
|
||||
f = os.path.join('freecell-solver', 'presetrc')
|
||||
os.environ['FREECELL_SOLVER_PRESETRC'] = f
|
||||
if os.name in ('posix', 'nt'):
|
||||
|
@ -161,10 +127,10 @@ def init():
|
|||
'stdin': subprocess.PIPE,}
|
||||
if os.name != 'nt':
|
||||
kw['close_fds'] = True
|
||||
p = subprocess.Popen(settings.FCS_COMMAND+' --help', **kw)
|
||||
p = subprocess.Popen(pysollib.settings.FCS_COMMAND+' --help', **kw)
|
||||
p.stdin.close()
|
||||
if p.stdout.readline().startswith('fc-solve'):
|
||||
settings.USE_FREECELL_SOLVER = True
|
||||
pysollib.settings.USE_FREECELL_SOLVER = True
|
||||
if os.name == 'posix':
|
||||
os.wait() # kill zombi
|
||||
except:
|
||||
|
@ -175,5 +141,5 @@ def init():
|
|||
# run app without games menus (more fast start)
|
||||
if '--no-games-menu' in sys.argv:
|
||||
sys.argv.remove('--no-games-menu')
|
||||
settings.SELECT_GAME_MENU = False
|
||||
pysollib.settings.SELECT_GAME_MENU = False
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
# imports
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import Struct
|
||||
from pysollib.mfxutil import Struct
|
||||
from pysollib.pysoltk import MfxCanvasText
|
||||
from resource import CSI
|
||||
from pysollib.resource import CSI
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
|
|
@ -28,22 +28,26 @@ import traceback
|
|||
import getopt
|
||||
|
||||
# PySol imports
|
||||
from util import DataLoader
|
||||
from mfxutil import print_err
|
||||
from resource import Tile
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.util import DataLoader
|
||||
from pysollib.mfxutil import print_err
|
||||
from pysollib.resource import Tile
|
||||
from pysollib.app import Application
|
||||
from gamedb import GAME_DB
|
||||
from pysolaudio import AbstractAudioClient, PysolSoundServerModuleClient
|
||||
from pysolaudio import Win32AudioClient, OSSAudioClient, PyGameAudioClient
|
||||
from settings import TITLE, SOUND_MOD
|
||||
from winsystems import init_root_window
|
||||
from pysollib.gamedb import GAME_DB
|
||||
from pysollib.pysolaudio import AbstractAudioClient, PysolSoundServerModuleClient
|
||||
from pysollib.pysolaudio import Win32AudioClient, OSSAudioClient, PyGameAudioClient
|
||||
from pysollib.settings import TITLE, SOUND_MOD
|
||||
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
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> solver_dialog_remove_so_called_solving_method
|
||||
|
||||
# ************************************************************************
|
||||
# *
|
||||
|
@ -212,11 +216,11 @@ def pysol_init(app, args):
|
|||
def progressCallback(*args):
|
||||
app.intro.progress.update(step=1)
|
||||
GAME_DB.setCallback(progressCallback)
|
||||
import games
|
||||
import pysollib.games
|
||||
if not opts['french-only']:
|
||||
import games.ultra
|
||||
import games.mahjongg
|
||||
import games.special
|
||||
import pysollib.games.ultra
|
||||
import pysollib.games.mahjongg
|
||||
import pysollib.games.special
|
||||
|
||||
# try to load plugins
|
||||
if not opts["noplugins"]:
|
||||
|
|
|
@ -36,7 +36,7 @@ try:
|
|||
except:
|
||||
thread = None
|
||||
|
||||
from settings import PACKAGE, TOOLKIT, USE_TILE
|
||||
from pysollib.settings import PACKAGE, TOOLKIT, USE_TILE
|
||||
|
||||
Image = ImageTk = ImageOps = None
|
||||
if TOOLKIT == 'tk':
|
||||
|
|
41
pysollib/mygettext.py
Normal file
41
pysollib/mygettext.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- mode: python; coding: utf-8; -*-
|
||||
|
||||
import gettext
|
||||
|
||||
def n_(x):
|
||||
return x
|
||||
|
||||
def fix_gettext():
|
||||
def ugettext(message):
|
||||
# unicoded gettext
|
||||
if not isinstance(message, unicode):
|
||||
message = unicode(message, 'utf-8')
|
||||
domain = gettext._current_domain
|
||||
try:
|
||||
t = gettext.translation(domain,
|
||||
gettext._localedirs.get(domain, None))
|
||||
except IOError:
|
||||
return message
|
||||
return t.ugettext(message)
|
||||
gettext.ugettext = ugettext
|
||||
def ungettext(msgid1, msgid2, n):
|
||||
# unicoded ngettext
|
||||
if not isinstance(msgid1, unicode):
|
||||
msgid1 = unicode(msgid1, 'utf-8')
|
||||
if not isinstance(msgid2, unicode):
|
||||
msgid2 = unicode(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
|
||||
return t.ungettext(msgid1, msgid2, n)
|
||||
gettext.ungettext = ungettext
|
||||
|
||||
fix_gettext()
|
||||
_ = gettext.ugettext
|
|
@ -34,6 +34,7 @@ import pysollib.settings
|
|||
# Toolkit imports
|
||||
from pysollib.pysoltk import TOOLBAR_BUTTONS
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# ************************************************************************
|
||||
# * Options
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
__all__ = ['ColorsDialog']
|
||||
|
||||
# imports
|
||||
from pysollib.mygettext import _, n_
|
||||
## import os, sys
|
||||
import gtk, gobject, pango
|
||||
import gtk.glade
|
||||
|
|
|
@ -30,6 +30,7 @@ import gtk, gobject, pango
|
|||
import gtk.glade
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from tkutil import create_pango_font_desc
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import gtk
|
|||
from gtk import gdk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.gamedb import GI
|
||||
from pysollib.settings import TITLE
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = ['PlayerOptionsDialog']
|
|||
import gobject, gtk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkwidget import MfxDialog
|
||||
|
|
|
@ -27,6 +27,7 @@ import os, re, sys, types
|
|||
import gtk, gobject
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.resource import CSI
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import gtk, gobject
|
|||
#from UserList import UserList
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import destruct, Struct, KwStruct
|
||||
from pysollib.mfxutil import kwdefault
|
||||
from pysollib.mfxutil import format_time
|
||||
|
|
|
@ -30,6 +30,7 @@ from gtk import gdk
|
|||
|
||||
# PySol imports
|
||||
## from pysollib.mfxutil import destruct, Struct, KwStruct
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.resource import CSI
|
||||
from pysollib.mfxutil import kwdefault
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import gtk
|
|||
from gtk import glade
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkwidget import MfxDialog
|
||||
|
|
|
@ -27,6 +27,7 @@ import os, sys
|
|||
import gtk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
|
|
@ -25,6 +25,7 @@ __all__ = ['TimeoutsDialog']
|
|||
|
||||
# imports
|
||||
## import os, sys
|
||||
from pysollib.mygettext import _, n_
|
||||
import gtk, gobject, pango
|
||||
import gtk.glade
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = ['HTMLViewer']
|
|||
import os, sys, re, types
|
||||
import htmllib, formatter
|
||||
import traceback
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
import gtk, pango, gobject
|
||||
from gtk import gdk
|
||||
|
|
|
@ -28,6 +28,7 @@ import gtk, gobject, pango
|
|||
import gtk.glade
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import format_time
|
||||
from pysollib.settings import TOP_TITLE, TITLE
|
||||
from pysollib.stats import PysolStatsFormatter
|
||||
|
|
|
@ -29,6 +29,7 @@ import gtk
|
|||
gdk = gtk.gdk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkutil import makeToplevel, setTransient, wm_withdraw
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
# imports
|
||||
import sys, re, time
|
||||
import random
|
||||
from mfxutil import SubclassResponsibility
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import SubclassResponsibility
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
|
|
@ -26,9 +26,10 @@
|
|||
import os, glob, traceback
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import Struct, KwStruct
|
||||
from settings import DEBUG
|
||||
from pysollib.mfxutil import Struct, KwStruct
|
||||
from pysollib.settings import DEBUG
|
||||
|
||||
from pysollib.mygettext import _
|
||||
|
||||
# ************************************************************************
|
||||
# * Abstract
|
||||
|
|
|
@ -95,11 +95,12 @@ __all__ = ['cardsFaceUp',
|
|||
# imports
|
||||
import types
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
# PySol imports
|
||||
from mfxutil import Struct, kwdefault, SubclassResponsibility
|
||||
from mfxutil import Image, ImageTk, USE_PIL
|
||||
from util import ACE, KING
|
||||
from util import ANY_SUIT, ANY_COLOR, ANY_RANK, NO_RANK
|
||||
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_COLOR, ANY_RANK, NO_RANK
|
||||
from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
from pysollib.pysoltk import CURSOR_DRAG, CURSOR_DOWN_ARROW
|
||||
from pysollib.pysoltk import ANCHOR_NW, ANCHOR_SE
|
||||
|
@ -108,9 +109,14 @@ from pysollib.pysoltk import after, after_idle, after_cancel
|
|||
from pysollib.pysoltk import MfxCanvasGroup, MfxCanvasImage, MfxCanvasRectangle, MfxCanvasText, MfxCanvasLine
|
||||
from pysollib.pysoltk import get_text_width
|
||||
from pysollib.pysoltk import markImage
|
||||
<<<<<<< HEAD
|
||||
from settings import TOOLKIT
|
||||
from settings import DEBUG
|
||||
|
||||
=======
|
||||
from pysollib.settings import TOOLKIT
|
||||
from pysollib.settings import DEBUG
|
||||
>>>>>>> solver_dialog_remove_so_called_solving_method
|
||||
|
||||
# ************************************************************************
|
||||
# * Let's start with some test methods for cards.
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
import time
|
||||
|
||||
# PySol imports
|
||||
from mfxutil import format_time
|
||||
from gamedb import GI
|
||||
from pysollib.mfxutil import format_time
|
||||
from pysollib.gamedb import GI
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
|
||||
# ************************************************************************
|
||||
|
|
|
@ -30,6 +30,7 @@ from tkColorChooser import askcolor
|
|||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkwidget import MfxDialog
|
||||
|
|
|
@ -29,6 +29,7 @@ import ttk
|
|||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkwidget import MfxDialog
|
||||
|
|
|
@ -29,6 +29,7 @@ __all__ = ['create_find_card_dialog',
|
|||
# imports
|
||||
import os
|
||||
import Tkinter
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkutil import after, after_cancel
|
||||
|
|
|
@ -30,6 +30,7 @@ import tkFont
|
|||
|
||||
# PySol imports
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkwidget import MfxDialog
|
||||
|
|
|
@ -28,6 +28,7 @@ __all__ = ['GameInfoDialog']
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.gamedb import GI
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import ttk
|
|||
import tkFileDialog
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import Struct, kwdefault
|
||||
from pysollib.mfxutil import Image, USE_PIL
|
||||
from pysollib.util import CARDSET
|
||||
|
|
|
@ -28,6 +28,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -30,6 +30,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct, USE_PIL
|
||||
from pysollib.util import CARDSET
|
||||
from pysollib.resource import CSI
|
||||
|
|
|
@ -28,10 +28,10 @@ import ttk
|
|||
from UserList import UserList
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
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.resource import CSI
|
||||
|
||||
# Toolkit imports
|
||||
|
@ -309,6 +309,7 @@ class SelectGameDialog(MfxDialog):
|
|||
if not doc:
|
||||
return
|
||||
dir = os.path.join("html", "rules")
|
||||
from pysollib.help import help_html
|
||||
help_html(self.app, doc, dir, self.top)
|
||||
return
|
||||
MfxDialog.mDone(self, button)
|
||||
|
|
|
@ -28,6 +28,7 @@ import ttk
|
|||
import tkColorChooser
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -34,6 +34,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.settings import TITLE
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
|
@ -90,23 +91,6 @@ class SolverDialog(MfxDialog):
|
|||
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
self.games_var = cb
|
||||
|
||||
#
|
||||
row += 1
|
||||
ttk.Label(frame, text=_('Solving method:'), anchor='w'
|
||||
).grid(row=row, column=0, sticky='ew', padx=2, pady=2)
|
||||
##sm = self.solving_methods.values()
|
||||
##sm.sort()
|
||||
sm = ['A*',
|
||||
'Breadth-First Search',
|
||||
'Depth-First Search',
|
||||
'A randomized DFS',
|
||||
##'"Soft" DFS'
|
||||
]
|
||||
cb = PysolCombo(frame, values=tuple(sm), state='readonly')
|
||||
cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2)
|
||||
cb.current(sm.index('Depth-First Search'))
|
||||
self.solving_method_var = cb
|
||||
|
||||
#
|
||||
row += 1
|
||||
ttk.Label(frame, text=_('Preset:'), anchor='w'
|
||||
|
@ -246,13 +230,11 @@ class SolverDialog(MfxDialog):
|
|||
game = self.app.game
|
||||
solver = game.Solver_Class(game, self) # create solver instance
|
||||
game.solver = solver
|
||||
method = self.solving_method_var.get()
|
||||
method = self.solving_methods[method]
|
||||
preset = self.preset_var.get()
|
||||
max_iters = self.max_iters_var.get()
|
||||
max_depth = self.max_depth_var.get()
|
||||
progress = self.progress_var.get()
|
||||
solver.config(method=method, preset=preset, max_iters=max_iters,
|
||||
solver.config(preset=preset, max_iters=max_iters,
|
||||
max_depth=max_depth, progress=progress)
|
||||
solver.computeHints()
|
||||
hints_len = len(solver.hints)-1
|
||||
|
|
|
@ -29,6 +29,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.settings import TITLE
|
||||
from pysollib.pysolaudio import pysolsoundserver
|
||||
|
|
|
@ -29,6 +29,7 @@ import os, sys
|
|||
import Tkinter
|
||||
import ttk
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
if __name__ == '__main__':
|
||||
d = os.path.abspath(os.path.join(sys.path[0], os.pardir, os.pardir))
|
||||
sys.path.append(d)
|
||||
|
|
|
@ -28,6 +28,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -41,6 +41,7 @@ __all__ = ['EVENT_HANDLED',
|
|||
# imports
|
||||
import Tkinter
|
||||
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# ************************************************************************
|
||||
# * constants
|
||||
|
|
|
@ -36,6 +36,7 @@ if __name__ == '__main__':
|
|||
gettext.install('pysol', d, unicode=True)
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import Struct, openURL
|
||||
from pysollib.settings import TITLE
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import ttk
|
|||
import tkFont
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.mfxutil import format_time
|
||||
##from pysollib.util import *
|
||||
|
|
|
@ -39,6 +39,7 @@ import tkFont
|
|||
import traceback
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import destruct, kwdefault, KwStruct, openURL
|
||||
from pysollib.settings import WIN_SYSTEM
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import destruct
|
||||
from pysollib.mfxutil import Image, ImageTk, ImageOps
|
||||
from pysollib.util import IMAGE_EXTENSIONS
|
||||
|
|
|
@ -26,6 +26,7 @@ __all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
|
|||
"tclobjs_to_py"]
|
||||
|
||||
import Tkinter
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
_flatten = Tkinter._flatten
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import Tkinter
|
|||
import ttk
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.wizardutil import WizardWidgets
|
||||
from pysollib.wizardpresets import presets
|
||||
|
|
|
@ -28,6 +28,7 @@ import Tkinter
|
|||
from tkColorChooser import askcolor
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = ['EditTextDialog']
|
|||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -32,6 +32,7 @@ import Tkinter
|
|||
##import traceback
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
|
||||
# Toolkit imports
|
||||
from tkutil import after, after_cancel
|
||||
|
|
|
@ -28,6 +28,7 @@ import Tkinter
|
|||
import tkFont
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -28,6 +28,7 @@ __all__ = ['GameInfoDialog']
|
|||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct
|
||||
from pysollib.gamedb import GI
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import traceback
|
|||
import Tkinter, tkFileDialog
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import Struct, kwdefault
|
||||
from pysollib.mfxutil import Image, USE_PIL
|
||||
from pysollib.util import CARDSET
|
||||
|
|
|
@ -27,6 +27,7 @@ __all__ = ['PlayerOptionsDialog']
|
|||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct, Struct
|
||||
|
||||
# Toolkit imports
|
||||
|
|
|
@ -28,6 +28,7 @@ import os
|
|||
import Tkinter
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import KwStruct, USE_PIL
|
||||
from pysollib.util import CARDSET
|
||||
from pysollib.resource import CSI
|
||||
|
|
|
@ -28,6 +28,7 @@ import Tkinter
|
|||
from UserList import UserList
|
||||
|
||||
# PySol imports
|
||||
from pysollib.mygettext import _, n_
|
||||
from pysollib.mfxutil import destruct, Struct, KwStruct
|
||||
from pysollib.mfxutil import format_time
|
||||
from pysollib.gamedb import GI
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue