gnome-games r7990 - in trunk/glchess/src/lib: . chess chess/fics ggz gtkui scene



Author: rancell
Date: Thu Oct  9 04:20:35 2008
New Revision: 7990
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7990&view=rev

Log:
Fix errors detected by pychecker

Modified:
   trunk/glchess/src/lib/ai.py
   trunk/glchess/src/lib/cecp.py
   trunk/glchess/src/lib/chess/board.py
   trunk/glchess/src/lib/chess/fics/server.py
   trunk/glchess/src/lib/config.py
   trunk/glchess/src/lib/defaults.py.in
   trunk/glchess/src/lib/ggz/client.py
   trunk/glchess/src/lib/ggz/protocol.py
   trunk/glchess/src/lib/gtkui/network.py
   trunk/glchess/src/lib/scene/__init__.py
   trunk/glchess/src/lib/scene/human.py

Modified: trunk/glchess/src/lib/ai.py
==============================================================================
--- trunk/glchess/src/lib/ai.py	(original)
+++ trunk/glchess/src/lib/ai.py	Thu Oct  9 04:20:35 2008
@@ -7,6 +7,7 @@
 import select
 import signal
 import xml.dom.minidom
+import xml.parsers.expat
 
 import game
 import cecp

Modified: trunk/glchess/src/lib/cecp.py
==============================================================================
--- trunk/glchess/src/lib/cecp.py	(original)
+++ trunk/glchess/src/lib/cecp.py	Thu Oct  9 04:20:35 2008
@@ -58,6 +58,9 @@
         """Called when the AI resigns"""
         print 'CECP AI resigns'
         
+    def logText(self, text, style):
+        print 'LOG: %s' % text
+        
     # Public methods
     
     def sendSetSearchDepth(self, searchDepth):
@@ -227,8 +230,3 @@
     def onIllegalMove(self, move):
         """Called by CECPProtocol"""
         print 'CECP illegal move: ' + move
-
-if __name__ == '__main__':
-    c = CECPConnection('gnuchess')
-    while True:
-        c.read()

Modified: trunk/glchess/src/lib/chess/board.py
==============================================================================
--- trunk/glchess/src/lib/chess/board.py	(original)
+++ trunk/glchess/src/lib/chess/board.py	Thu Oct  9 04:20:35 2008
@@ -411,6 +411,7 @@
                     return True
 
             # Bishops on different colours can check
+            bishopSquareColour = None
             if pieceType == BISHOP:
                 bishopCount += 1 
                 colour = self._getSquareColour(coord)

Modified: trunk/glchess/src/lib/chess/fics/server.py
==============================================================================
--- trunk/glchess/src/lib/chess/fics/server.py	(original)
+++ trunk/glchess/src/lib/chess/fics/server.py	Thu Oct  9 04:20:35 2008
@@ -411,12 +411,14 @@
                 self.send('%i ads displayed.\n' % len(self.server.adverts))
         
         elif command == 'match' and len(args) == 1:
+            user = args[0]
             try:
                 client = self.server.clientsByUserName[user]
             except KeyError:
                 pass
             else:
                 advert = Challenge(self)
+                advertLine = '?' # FIXME
                 self.send('Issuing: %s.' % advertLine)
                 client.send('\n')
                 client.send('Challenge: %s.\n' % advertLine)

Modified: trunk/glchess/src/lib/config.py
==============================================================================
--- trunk/glchess/src/lib/config.py	(original)
+++ trunk/glchess/src/lib/config.py	Thu Oct  9 04:20:35 2008
@@ -195,8 +195,6 @@
     if haveGConfSupport:
         return
     
-    import xml.dom.minidom
-    
     document = xml.dom.minidom.Document()
     
     e = document.createComment('Automatically generated by glChess, do not edit!')

Modified: trunk/glchess/src/lib/defaults.py.in
==============================================================================
--- trunk/glchess/src/lib/defaults.py.in	(original)
+++ trunk/glchess/src/lib/defaults.py.in	Thu Oct  9 04:20:35 2008
@@ -5,7 +5,7 @@
 # automake to set prefix paths etc. Please keep defaults.py.in
 # in sync between glchess and gnome-sudoku. 
 
-import sys, os, os.path
+import os, os.path
 import errno
 import gettext 
 

Modified: trunk/glchess/src/lib/ggz/client.py
==============================================================================
--- trunk/glchess/src/lib/ggz/client.py	(original)
+++ trunk/glchess/src/lib/ggz/client.py	Thu Oct  9 04:20:35 2008
@@ -35,7 +35,7 @@
     
 class ClientFeedback:
     
-    def setBusy(self):
+    def setBusy(self, isBusy):
         """Called when the client is busy (unable to take requests)"""
         pass
     

Modified: trunk/glchess/src/lib/ggz/protocol.py
==============================================================================
--- trunk/glchess/src/lib/ggz/protocol.py	(original)
+++ trunk/glchess/src/lib/ggz/protocol.py	Thu Oct  9 04:20:35 2008
@@ -657,6 +657,8 @@
         return data[index+1:]
 
 if __name__ == '__main__':
+    import chess
+    
     class F:
         
         def onSeat(self, seatNum, version):
@@ -678,7 +680,7 @@
             print ('onMove', move)    
 
     f = F()
-    d = GGZChess(f);
+    d = chess.Chess(f);
 
     for c in '\x01\x01\x06': # Seat seat=1 version=6
         d.decode(c)

Modified: trunk/glchess/src/lib/gtkui/network.py
==============================================================================
--- trunk/glchess/src/lib/gtkui/network.py	(original)
+++ trunk/glchess/src/lib/gtkui/network.py	Thu Oct  9 04:20:35 2008
@@ -217,7 +217,7 @@
         """Called by glchess.ui.UIController"""
         iter = self.roomModel.get_iter_first()
         while iter is not None:
-            if table is self.roomModel.get_value(iter, 0):
+            if room is self.roomModel.get_value(iter, 0):
                 self.roomModel.remove(iter)
                 return
             iter = self.roomModel.iter_next(iter)
@@ -421,7 +421,7 @@
         
         # Get the players
         game.white.type  = self.__getComboData(self.__gui.get_widget('white_type_combo'), 0)
-        if game.white.type is '':
+        if game.white.type == '':
             game.white.name = _('White')
         else:
             game.white.name = self.__getComboData(self.__gui.get_widget('white_type_combo'), 2)
@@ -435,7 +435,7 @@
 
         game.duration = self.__getComboData(self.__gui.get_widget('time_combo'), 1)
         if game.duration < 0:
-            multplier = self.__getComboData(self.__gui.get_widget('custom_time_units_combo'), 1)
+            multiplier = self.__getComboData(self.__gui.get_widget('custom_time_units_combo'), 1)
             game.duration = self.__getComboData(self.__gui.get_widget('custom_time_spin'), 1) * multiplier
             
         # Save properties
@@ -459,7 +459,7 @@
         widget = self.__gui.get_widget('table_join_button')
         widget.set_sensitive(isSensitive)
         
-    def _on_table_list_activated():
+    def _on_table_list_activated(self):
         pass
     
     def _on_server_combo_changed(self, widget):

Modified: trunk/glchess/src/lib/scene/__init__.py
==============================================================================
--- trunk/glchess/src/lib/scene/__init__.py	(original)
+++ trunk/glchess/src/lib/scene/__init__.py	Thu Oct  9 04:20:35 2008
@@ -96,10 +96,11 @@
         """
         pass
     
-    def setBoardRotation(self, angle):
+    def setBoardRotation(self, angle, animate):
         """Set the rotation on the board.
         
         'angle' is the angle the board should be drawn at in degress (float, [0.0, 360.0]).
+        'animate' is True if the rotation shoule be animated.
         """
         pass
     

Modified: trunk/glchess/src/lib/scene/human.py
==============================================================================
--- trunk/glchess/src/lib/scene/human.py	(original)
+++ trunk/glchess/src/lib/scene/human.py	Thu Oct  9 04:20:35 2008
@@ -79,7 +79,6 @@
         if inputEnabled is False:
             self.__selectSquare(None)
         self.__inputEnabled = inputEnabled
-        self.selectSquare(None)
         
     def select(self, x, y):
         """



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]