mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
- removed app.debug variable
git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@95 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
parent
7cd1031851
commit
7c17688df7
12 changed files with 51 additions and 69 deletions
|
@ -43,6 +43,7 @@ from mfxutil import Struct, destruct, openURL
|
|||
from pysolrandom import constructRandom
|
||||
from settings import PACKAGE, PACKAGE_URL
|
||||
from settings import TOP_TITLE
|
||||
from settings import DEBUG
|
||||
from gamedb import GI
|
||||
|
||||
# stats imports
|
||||
|
@ -804,7 +805,7 @@ class PysolMenubarActions:
|
|||
if self._cancelDrag(break_pause=False): return
|
||||
if self.app.audio and self.app.opt.sound_music_volume > 0:
|
||||
self.app.audio.playNextMusic()
|
||||
if 1 and self.app.debug:
|
||||
if 1 and DEBUG:
|
||||
index = self.app.audio.getMusicInfo()
|
||||
music = self.app.music_manager.get(index)
|
||||
if music:
|
||||
|
|
|
@ -55,6 +55,7 @@ from pysolrandom import PysolRandom
|
|||
from game import Game
|
||||
from gamedb import GI, GAME_DB, loadGame
|
||||
from settings import TOP_SIZE, TOP_TITLE, TOOLKIT
|
||||
from settings import DEBUG
|
||||
|
||||
# Toolkit imports
|
||||
from pysoltk import wm_withdraw, loadImage
|
||||
|
@ -499,7 +500,6 @@ class Application:
|
|||
self.stats = Statistics()
|
||||
self.comments = Comments()
|
||||
self.splashscreen = 1
|
||||
self.debug = 0
|
||||
# visual components
|
||||
self.top = None # the root toplevel window
|
||||
self.top_bg = None # default background
|
||||
|
@ -1509,7 +1509,7 @@ Please select a %s type %s.
|
|||
manager = self.cardset_manager
|
||||
# find all available cardsets
|
||||
dirs = manager.getSearchDirs(self, ("cardsets", ""), "PYSOL_CARDSETS")
|
||||
if self.debug:
|
||||
if DEBUG:
|
||||
dirs = dirs + manager.getSearchDirs(self, "cardsets-*")
|
||||
##print dirs
|
||||
found, t = [], {}
|
||||
|
|
|
@ -46,6 +46,7 @@ from mfxutil import format_time
|
|||
from util import get_version_tuple, Timer
|
||||
from util import ACE, QUEEN, KING
|
||||
from settings import PACKAGE, TOOLKIT, TOP_TITLE, VERSION, VERSION_TUPLE
|
||||
from settings import DEBUG
|
||||
from gamedb import GI
|
||||
from resource import CSI
|
||||
from pysolrandom import PysolRandom, LCRandom31
|
||||
|
@ -178,7 +179,7 @@ class Game:
|
|||
if self.s.talon:
|
||||
assert hasattr(self.s.talon, "round")
|
||||
assert hasattr(self.s.talon, "max_rounds")
|
||||
if self.app.debug:
|
||||
if DEBUG:
|
||||
self._checkGame()
|
||||
# optimize regions
|
||||
self.optimizeRegions()
|
||||
|
@ -193,7 +194,7 @@ class Game:
|
|||
# update display properties
|
||||
self.top.wm_geometry("") # cancel user-specified geometry
|
||||
self.canvas.setInitialSize(self.width, self.height)
|
||||
if self.app.debug >= 4:
|
||||
if DEBUG >= 4:
|
||||
MfxCanvasRectangle(self.canvas, 0, 0, self.width, self.height,
|
||||
width=2, fill=None, outline='green')
|
||||
# restore game geometry
|
||||
|
@ -941,8 +942,6 @@ class Game:
|
|||
def animatedMoveTo(self, from_stack, to_stack, cards, x, y, tkraise=1, frames=-1, shadow=-1):
|
||||
if self.app.opt.animations == 0 or frames == 0:
|
||||
return
|
||||
if self.app.debug and not self.top.winfo_ismapped():
|
||||
return
|
||||
# init timer - need a high resolution for this to work
|
||||
clock, delay, skip = None, 1, 1
|
||||
if self.app.opt.animations >= 2:
|
||||
|
@ -1016,8 +1015,6 @@ class Game:
|
|||
### return
|
||||
if not self.app.opt.animations:
|
||||
return
|
||||
if self.app.debug and not self.top.winfo_ismapped():
|
||||
return
|
||||
self.top.busyUpdate()
|
||||
self.canvas.update_idletasks()
|
||||
old_a = self.app.opt.animations
|
||||
|
@ -1108,7 +1105,7 @@ class Game:
|
|||
def setRegion(self, stacks, rect, priority=0):
|
||||
assert len(stacks) > 0
|
||||
assert len(rect) == 4 and rect[0] < rect[2] and rect[1] < rect[3]
|
||||
if self.app.debug >= 2:
|
||||
if DEBUG >= 2:
|
||||
MfxCanvasRectangle(self.canvas, rect[0], rect[1], rect[2], rect[3],
|
||||
width=2, fill=None, outline='red')
|
||||
for s in stacks:
|
||||
|
@ -1751,7 +1748,7 @@ for %d moves.
|
|||
assert to_stack.acceptsCards(from_stack, from_stack.cards[-ncards:])
|
||||
if sleep <= 0.0:
|
||||
return h
|
||||
info = (level == 1) or (level > 1 and self.app.debug >= 3)
|
||||
info = (level == 1) or (level > 1 and DEBUG >= 3)
|
||||
if info and self.app.statusbar and self.app.opt.statusbar:
|
||||
self.app.statusbar.configLabel("info", text=_("Score %6d") % (score), fg=text_color)
|
||||
else:
|
||||
|
@ -1843,8 +1840,8 @@ for %d moves.
|
|||
timeout = 10000
|
||||
if player_moves == 0:
|
||||
timeout = 5000
|
||||
if 0 and self.app.debug and self.demo.mixed:
|
||||
timeout = 1000
|
||||
## if 0 and DEBUG and self.demo.mixed:
|
||||
## timeout = 1000
|
||||
if self.isGameWon():
|
||||
finished = 1
|
||||
self.stopPlayTimer()
|
||||
|
@ -1863,7 +1860,7 @@ for %d moves.
|
|||
##s = self.app.miscrandom.choice((_("&OK"), _("&OK")))
|
||||
s = _("&OK")
|
||||
text = _("\nGame finished\n")
|
||||
if self.app.debug:
|
||||
if DEBUG:
|
||||
text += "\nplayer_moves: %d\ndemo_moves: %d\n" % (self.stats.player_moves, self.stats.demo_moves)
|
||||
d = MfxMessageDialog(self.top, title=PACKAGE+_(" Autopilot"),
|
||||
text=text, bitmap=bitmap, strings=(s,),
|
||||
|
@ -1885,7 +1882,7 @@ for %d moves.
|
|||
status = d.status
|
||||
if finished:
|
||||
self.updateStats(demo=1)
|
||||
if self.demo and status == 2 and not self.app.debug:
|
||||
if self.demo and status == 2:
|
||||
# timeout in dialog
|
||||
if self.stats.demo_moves > self.demo.start_demo_moves:
|
||||
# we only increase the splash-screen counter if the last
|
||||
|
@ -1898,7 +1895,7 @@ for %d moves.
|
|||
# timeout in dialog - start another demo
|
||||
demo = self.demo
|
||||
id = self.id
|
||||
if 1 and demo.mixed and self.app.debug:
|
||||
if 1 and demo.mixed and DEBUG:
|
||||
# debug - advance game id to make sure we hit all games
|
||||
gl = self.app.gdb.getGamesIdSortedById()
|
||||
##gl = self.app.gdb.getGamesIdSortedByName()
|
||||
|
@ -1922,7 +1919,7 @@ for %d moves.
|
|||
self.quitGame(id, startdemo=1)
|
||||
else:
|
||||
self.stopDemo()
|
||||
if 0 and self.app.debug:
|
||||
if DEBUG >= 10:
|
||||
# debug - only for testing winAnimation()
|
||||
self.endGame()
|
||||
self.winAnimation()
|
||||
|
@ -1939,9 +1936,6 @@ for %d moves.
|
|||
# we're probably looping because of some bug in the hint code
|
||||
return 1
|
||||
sleep = demo.sleep
|
||||
if self.app.debug:
|
||||
if not self.top.winfo_ismapped():
|
||||
sleep = -1.0
|
||||
# first try to deal cards to the Waste (unless there was a forced move)
|
||||
if not demo.hint or not demo.hint[6]:
|
||||
if self._autoDeal(sound=0):
|
||||
|
|
|
@ -109,10 +109,7 @@ class VegasKlondike(Klondike):
|
|||
b1, b2 = self.app.stats.gameid_balance, 0
|
||||
if self.shallUpdateBalance():
|
||||
b2 = self.getGameBalance()
|
||||
if 0 and self.app.debug:
|
||||
t = "Balance %d/%d" % (b1, b2)
|
||||
else:
|
||||
t = _("Balance $%d") % (b1 + b2)
|
||||
t = _("Balance $%d") % (b1 + b2)
|
||||
self.texts.score.config(text=t)
|
||||
|
||||
def getDemoInfoTextAttr(self, tinfo):
|
||||
|
|
|
@ -48,8 +48,7 @@ from app import Application
|
|||
from pysolaudio import thread, pysolsoundserver
|
||||
from pysolaudio import AbstractAudioClient, PysolSoundServerModuleClient
|
||||
from pysolaudio import Win32AudioClient, OSSAudioClient, PyGameAudioClient
|
||||
import settings
|
||||
PACKAGE, SOUND_MOD = settings.PACKAGE, settings.SOUND_MOD
|
||||
from settings import PACKAGE, SOUND_MOD
|
||||
|
||||
# Toolkit imports
|
||||
from pysoltk import wm_withdraw, loadImage
|
||||
|
@ -92,7 +91,6 @@ def parse_option(argv):
|
|||
"french-only",
|
||||
"noplugins",
|
||||
"nosound",
|
||||
"debug=",
|
||||
"sound-mod=",
|
||||
"help"])
|
||||
except getopt.GetoptError, err:
|
||||
|
@ -110,7 +108,6 @@ def parse_option(argv):
|
|||
"noplugins" : False,
|
||||
"nosound" : False,
|
||||
"sound-mod" : None,
|
||||
"debug" : None,
|
||||
}
|
||||
for i in optlist:
|
||||
if i[0] in ("-h", "--help"):
|
||||
|
@ -136,11 +133,6 @@ def parse_option(argv):
|
|||
elif i[0] == "--sound-mod":
|
||||
assert i[1] in ('pss', 'pygame', 'oss', 'win')
|
||||
opts["sound-mod"] = i[1]
|
||||
elif i[0] in ("-D", "--debug"):
|
||||
try:
|
||||
opts["debug"] = int(i[1])
|
||||
except:
|
||||
print >> sys.stderr, 'WARNING: invalid argument for debug'
|
||||
|
||||
if opts["help"]:
|
||||
print _("""Usage: %s [OPTIONS] [FILE]
|
||||
|
@ -206,9 +198,6 @@ def pysol_init(app, args):
|
|||
app.commandline.gameid = int(opts['gameid'])
|
||||
except:
|
||||
print >> sys.stderr, 'WARNING: invalid game id:', opts['gameid']
|
||||
if not opts['debug'] is None:
|
||||
settings.DEBUG = opts['debug']
|
||||
app.debug = settings.DEBUG
|
||||
|
||||
# init games database
|
||||
import games
|
||||
|
@ -341,7 +330,7 @@ Please check your %s installation.
|
|||
if music:
|
||||
app.music_playlist = list(music)[:]
|
||||
app.miscrandom.shuffle(app.music_playlist)
|
||||
if 1: ## and not app.debug:
|
||||
if 1:
|
||||
for m in app.music_playlist:
|
||||
if m.name.lower() == "bye_for_now":
|
||||
app.music_playlist.remove(m)
|
||||
|
|
|
@ -209,8 +209,7 @@ class PysolSoundServerModuleClient(AbstractAudioClient):
|
|||
r = self.cmd("protocol 6")
|
||||
if r != 0:
|
||||
return 0
|
||||
if 0 and self.app.debug:
|
||||
self.cmd("debug 1")
|
||||
##self.cmd("debug 1")
|
||||
return 1
|
||||
|
||||
# disconnect and stop server
|
||||
|
|
|
@ -407,7 +407,6 @@ class SelectGameDialogWithPreview(MfxDialog):
|
|||
canvas = canvas,
|
||||
cardset = self.app.cardset.copy(),
|
||||
comments = self.app.comments.new(),
|
||||
debug = 0,
|
||||
gamerandom = self.app.gamerandom,
|
||||
gdb = self.app.gdb,
|
||||
gimages = self.app.gimages,
|
||||
|
|
|
@ -41,6 +41,7 @@ import sys, os, glob, operator, types
|
|||
# PySol imports
|
||||
from mfxutil import Struct, KwStruct, EnvError, latin1_to_ascii
|
||||
from settings import PACKAGE, VERSION
|
||||
from settings import DEBUG
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
@ -159,7 +160,7 @@ class ResourceManager:
|
|||
self._addDir(result, os.path.join(dir, s))
|
||||
except EnvError, ex:
|
||||
pass
|
||||
if app.debug >= 5:
|
||||
if DEBUG >= 5:
|
||||
print "getSearchDirs", env, search, "->", result
|
||||
return result
|
||||
|
||||
|
@ -289,18 +290,6 @@ class CSI:
|
|||
22: "2200 - 2299",
|
||||
}
|
||||
|
||||
## #
|
||||
## TYPE_NAME = {}
|
||||
## def create_csi_type_name():
|
||||
## for id, type in CSI.TYPE.items():
|
||||
## i = type.find('type')
|
||||
## if i > 0:
|
||||
## CSI.TYPE_NAME[id] = type[:i-1]
|
||||
## else:
|
||||
## CSI.TYPE_NAME[id] = type
|
||||
## if not CSI.TYPE_NAME:
|
||||
## create_csi_type_name()
|
||||
|
||||
|
||||
class CardsetConfig(Struct):
|
||||
# see config.txt and _readCardsetConfig()
|
||||
|
|
|
@ -29,15 +29,29 @@ PACKAGE = 'PySol'
|
|||
PACKAGE_URL = 'http://sourceforge.net/projects/pysolfc/'
|
||||
|
||||
VERSION = '4.82'
|
||||
FC_VERSION = '0.9.4'
|
||||
FC_VERSION = '0.9.5'
|
||||
VERSION_TUPLE = (4, 82)
|
||||
|
||||
# toolkit
|
||||
TOOLKIT = 'tk' # or 'gtk'
|
||||
USE_TILE = 'auto' # or True or False
|
||||
TILE_THEME = 'default' # name of tile's theme
|
||||
# name of tile's theme
|
||||
# available values:
|
||||
# 'default', 'alt', 'classic', 'clam', 'step', 'blue' (all)
|
||||
# 'winnative', 'xpnative' (windows)
|
||||
# 'aqua' (macosx)
|
||||
TILE_THEME = 'default'
|
||||
if os.name == 'nt':
|
||||
TILE_THEME = 'winnative'
|
||||
SOUND_MOD = 'auto' # or 'pss', 'pygame', 'oss', 'win', 'none'
|
||||
|
||||
# sound
|
||||
# available values:
|
||||
# 'pss' - PySol-Sound-Server (all)
|
||||
# 'pygame' - PyGame (all)
|
||||
# 'oss' (*nix)
|
||||
# 'win' (windows)
|
||||
# 'none' - disable
|
||||
SOUND_MOD = 'auto'
|
||||
|
||||
# data dirs
|
||||
DATA_DIRS = []
|
||||
|
@ -57,5 +71,6 @@ if os.name == 'mac':
|
|||
TOP_SIZE = 10
|
||||
TOP_TITLE = n_('Top 10')
|
||||
|
||||
# debug
|
||||
DEBUG = 0 # must be integer
|
||||
CHECK_GAMES = False
|
||||
CHECK_GAMES = False # check duplicated names and classes
|
||||
|
|
|
@ -107,6 +107,7 @@ from pysoltk import MfxCanvasGroup, MfxCanvasImage, MfxCanvasRectangle, MfxCanva
|
|||
from pysoltk import Card
|
||||
from pysoltk import get_text_width
|
||||
from settings import TOOLKIT
|
||||
from settings import DEBUG
|
||||
|
||||
|
||||
# /***********************************************************************
|
||||
|
@ -777,15 +778,15 @@ class Stack:
|
|||
format = "%d"
|
||||
if format:
|
||||
t = format % len(self.cards)
|
||||
if 0 and self.game.app.debug >= 4:
|
||||
visible = 0
|
||||
for c in self.cards:
|
||||
if c.isHidden():
|
||||
assert c.hide_stack is not None
|
||||
else:
|
||||
visible = visible + 1
|
||||
assert c.hide_stack is None
|
||||
t = t + " (%d)" % visible
|
||||
## if 0:
|
||||
## visible = 0
|
||||
## for c in self.cards:
|
||||
## if c.isHidden():
|
||||
## assert c.hide_stack is not None
|
||||
## else:
|
||||
## visible = visible + 1
|
||||
## assert c.hide_stack is None
|
||||
## t = t + " (%d)" % visible
|
||||
self.texts.ncards.config(text=t)
|
||||
|
||||
def basicShallHighlightSameRank(self, card):
|
||||
|
@ -1412,7 +1413,7 @@ class Stack:
|
|||
return s
|
||||
|
||||
def getNumCards(self):
|
||||
if self.game.app.debug >= 5:
|
||||
if DEBUG >= 5:
|
||||
t = repr(self)+' '
|
||||
else:
|
||||
t = ''
|
||||
|
|
|
@ -454,7 +454,6 @@ class SelectGameDialogWithPreview(SelectGameDialog):
|
|||
canvas = canvas,
|
||||
cardset = self.app.cardset.copy(),
|
||||
comments = self.app.comments.new(),
|
||||
debug = 0,
|
||||
gamerandom = self.app.gamerandom,
|
||||
gdb = self.app.gdb,
|
||||
gimages = self.app.gimages,
|
||||
|
|
|
@ -455,7 +455,6 @@ class SelectGameDialogWithPreview(SelectGameDialog):
|
|||
canvas = canvas,
|
||||
cardset = self.app.cardset.copy(),
|
||||
comments = self.app.comments.new(),
|
||||
debug = 0,
|
||||
gamerandom = self.app.gamerandom,
|
||||
gdb = self.app.gdb,
|
||||
gimages = self.app.gimages,
|
||||
|
|
Loading…
Add table
Reference in a new issue