fowode / pychess

Automatically exported from code.google.com/p/pychess
GNU General Public License v3.0
0 stars 0 forks source link

Red arrow stays on screen after opponent has been in check #905

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
White puts black in check and a red arrow appears on the screen. The arrow 
stays on the screen even after more moves have been made. 

It will get removed when the King is next in check. I can also remove it by 
pressing ctrl+Y twice to enable and then disable spy mode. If I do this I don't 
get any red arrows at all.

I have pychess.py as spy analyser in preferences but spy mode is off in the 
actions menu.

May be connected to revision 2778 which selectively turns off arrows instead of 
turning them all off.

I attached screenshots.

Original issue reported on code.google.com by jcheetham19 on 14 Aug 2014 at 7:12

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by gbtami on 14 Aug 2014 at 8:35

GoogleCodeExporter commented 9 years ago
jcheetham19, thx for reporting this!
The revision link seems broken, the correct is:
https://code.google.com/p/pychess/source/detail?r=94f837b6b25b
Unfortunately I wasn't able to reproduce the bug yet.

Original comment by gbtami on 14 Aug 2014 at 8:53

GoogleCodeExporter commented 9 years ago
I can reproduce using that move sequence, e4 f6 Qh5+ . I never use spy mode or 
test it so I guess it was inevitable I caused a regression in it.

Original comment by mattgatto on 16 Aug 2014 at 12:28

GoogleCodeExporter commented 9 years ago
I've thought for awhile now that we should remove spy mode as I (and most 
others I'm guessing) don't use or test it, it complicates the already confusing 
{CECP,UCI}Engine code, and its UI design can be confusing to the user 
(especially in situations like this where a king is in check) and could be 
designed better, but for lack of a replacement, here's what I found:

After adding this test code:
[gatto@fedora-20 pychess]$ hg diff lib/pychess/widgets/gamewidget.py 
diff -r 37e547244456 lib/pychess/widgets/gamewidget.py
--- a/lib/pychess/widgets/gamewidget.py Wed Aug 13 14:00:46 2014 +0200
+++ b/lib/pychess/widgets/gamewidget.py Fri Aug 15 23:47:42 2014 -0700
@@ -372,6 +372,8 @@
             self.board.view._set_greenarrow(coordinates)
         else:
             self.board.view._set_redarrow(coordinates)
+            if coordinates is not None:
+                print analyzer_type, coordinates, 
"".join(traceback.format_stack())

     def _on_analyze (self, analyzer, analysis, analyzer_type):
         if len(analysis) >= 1 and analysis[0] is not None:

I got this output after reproducing as specified in my comment 3:

File "/usr/lib64/python2.7/threading.py", line 784, in __bootstrap
    self.__bootstrap_inner()
  File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
    self.run()
  File "/home/gatto/code/hg/pychess/lib/pychess/Utils/GameModel.py", line 613, in run
    self.emit("game_changed")
  File "/home/gatto/code/hg/pychess/lib/pychess/System/glock.py", line 71, in handler
    function(emitter, *extra)
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/BoardView.py", line 212, in game_changed
    self.shown = model.ply
  File "/usr/lib64/python2.7/site-packages/gobject/propertyhelper.py", line 172, in __set__
    instance.set_property(self.name, value)
  File "/usr/lib64/python2.7/site-packages/gobject/__init__.py", line 101, in obj_set_property
    prop.setter(self, value)
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/BoardView.py", line 405, in _set_shown
    self.emit("shown_changed", self.shown)
  File "/home/gatto/code/hg/pychess/sidepanel/bookPanel.py", line 548, in shown_changed
    advisor.shown_changed(boardview, shown)
  File "/home/gatto/code/hg/pychess/sidepanel/bookPanel.py", line 165, in shown_changed
    self.engine.setBoard(boardview.model.getBoardAtPly(shown, boardview.shownVariationIdx))
  File "/home/gatto/code/hg/pychess/lib/pychess/Players/CECPEngine.py", line 321, in setBoard
    self.__sendAnalyze(self.mode == INVERSE_ANALYZING)
  File "/home/gatto/code/hg/pychess/lib/pychess/Players/CECPEngine.py", line 640, in __sendAnalyze
    self.emit("analyze", [([getMoveKillingKing(self.board)], MATE_VALUE-1, "")])
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/gamewidget.py", line 391, in _on_analyze
    self._set_arrow(analyzer_type, moves[0].cords)
  File "/home/gatto/code/hg/pychess/lib/pychess/widgets/gamewidget.py", line 376, in _set_arrow
    print analyzer_type, coordinates, "".join(traceback.format_stack())

An obvious way to fix this is in the attach patch which I will commit unless 
anyone can see a better way to fix it.

Original comment by mattgatto on 16 Aug 2014 at 7:01

Attachments:

GoogleCodeExporter commented 9 years ago
That patch works for me.

When first installed the 'Use inverted analyser' checkbox is on by default. 
Maybe the default should be off if you're thinking of removing it.  

Original comment by jcheetham19 on 16 Aug 2014 at 9:59

GoogleCodeExporter commented 9 years ago
Spy mode is useful in my opinion, but I agree to turn it off by default (and 
other analyzing checkboxes too).

Original comment by gbtami on 16 Aug 2014 at 12:44

GoogleCodeExporter commented 9 years ago
This issue was closed by revision da827ed52750.

Original comment by mattgatto on 20 Aug 2014 at 7:19

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 1ad24055a5ab.

Original comment by mattgatto on 12 Sep 2014 at 6:12