mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-22 03:04:09 -04:00
Simplify loops (#448)
This commit is contained in:
parent
5bd941a5a4
commit
8434ca1d22
3 changed files with 5 additions and 8 deletions
|
@ -885,7 +885,7 @@ class Game(object):
|
|||
assert len(self.allstacks) == len(game.loadinfo.stacks)
|
||||
old_state = game.moves.state
|
||||
game.moves.state = self.S_RESTORE
|
||||
for i in range(len(self.allstacks)):
|
||||
for i, cur_stack in enumerate(self.allstacks):
|
||||
for t in game.loadinfo.stacks[i]:
|
||||
card_id, face_up = t
|
||||
card = self.cards[card_id]
|
||||
|
@ -893,7 +893,7 @@ class Game(object):
|
|||
card.showFace()
|
||||
else:
|
||||
card.showBack()
|
||||
self.allstacks[i].addCard(card)
|
||||
cur_stack.addCard(card)
|
||||
game.moves.state = old_state
|
||||
# 4) update settings
|
||||
for stack_id, cap in self.saveinfo.stack_caps:
|
||||
|
@ -1106,9 +1106,8 @@ class Game(object):
|
|||
x, y = int(round((init_coord[0] + cw) * xf)), \
|
||||
int(round((init_coord[1] + ch) * yf))
|
||||
self.canvas.coords(item, x, y)
|
||||
for i in range(len(self.texts.list)):
|
||||
for i, item in enumerate(self.texts.list):
|
||||
init_coord = self.init_texts.list[i]
|
||||
item = self.texts.list[i]
|
||||
x, y = int(round((init_coord[0] + cw) * xf)), \
|
||||
int(round((init_coord[1] + ch) * yf))
|
||||
self.canvas.coords(item, x, y)
|
||||
|
|
|
@ -1880,8 +1880,7 @@ class PysolMenubarTk:
|
|||
short_name=False):
|
||||
|
||||
# cb = self.__cb_max
|
||||
for i in range(len(games)):
|
||||
gi = games[i]
|
||||
for gi in games:
|
||||
# columnbreak = i > 0 and (i % cb) == 0
|
||||
if short_name:
|
||||
label = gi.short_name
|
||||
|
|
|
@ -493,8 +493,7 @@ class Stack:
|
|||
images = self.game.app.images
|
||||
cw, ch = images.getSize()
|
||||
index = -1
|
||||
for i in range(len(cards)):
|
||||
c = cards[i]
|
||||
for i, c in enumerate(cards):
|
||||
r = (c.x, c.y, c.x + cw, c.y + ch)
|
||||
if r[0] <= x < r[2] and r[1] <= y < r[3]:
|
||||
index = i
|
||||
|
|
Loading…
Add table
Reference in a new issue