WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit ec3472d

Browse files
committed
Fix resetting cached all_cells in Player/solver. v2.1.1
1 parent b09a670 commit ec3472d

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from __future__ import division, print_function
2020

21-
__version__ = '2.1'
21+
__version__ = '2.1.1'
2222

2323
import sys
2424
import os.path

player.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def drawForeground(self, g, rect):
208208
poly = poly.intersected(QPolygonF(rect))
209209
g.drawConvexPolygon(poly)
210210

211-
212211
@cached_property
213212
def all_cells(self):
214213
return list(self.all(Cell))
@@ -217,6 +216,11 @@ def all_cells(self):
217216
def all_columns(self):
218217
return list(self.all(Column))
219218

219+
def reset_cache(self):
220+
for attr in ['all_cells', 'all_columns']:
221+
try:
222+
delattr(self, attr)
223+
except AttributeError: pass
220224

221225
def solve_step(self):
222226
"""Derive everything that can be concluded from the current state.
@@ -431,20 +435,14 @@ def save_geometry_qt(self):
431435
def restore_geometry_qt(self, value):
432436
self.restoreGeometry(QByteArray.fromBase64(value.encode('ascii')))
433437

434-
def reset_cache(self):
435-
for attr in ['all_cells', 'all_columns']:
436-
try:
437-
delattr(self, attr)
438-
except AttributeError: pass
439-
440438
def close_file(self):
441439
self.current_file = None
442440
self.scene.clear()
443441
self.scene.remaining = 0
444442
self.scene.mistakes = 0
443+
self.scene.reset_cache()
445444
for it in [self.title_label, self.author_align_label, self.author_label, self.information_label]:
446445
it.hide()
447-
self.reset_cache()
448446
self.copy_action.setEnabled(False)
449447
return True
450448

0 commit comments

Comments
 (0)