PyChess - Chess client¶
PyChess is a chess client for playing and analyzing chess games. It is intended to be usable both for those totally new to chess as well as advanced users who want to use a computer to further enhance their play.
PyChess has a builtin python chess engine and auto-detects most popular chess engines (Stockfish, Rybka, Houdini, Shredder, GNU Chess, Crafty, Fruit, and many more). These engines are available as opponents, and are used to provide hints and analysis. PyChess also shows analysis from opening books and Gaviota end-game tablebases.
When you get sick of playing computer players you can login to FICS (the Free Internet Chess Server) and play against people all over the world. PyChess has a built-in Timeseal client, so you won’t lose clock time during a game due to lag. PyChess also has pre-move support, which means you can make (or start making) a move before your opponent has made their move.
Project homepage: | |
---|---|
http://pychess.org/ | |
Download page: | http://pychess.org/download/ |
Development page: | |
https://github.com/pychess/pychess | |
Translations: | https://www.transifex.com/projects/p/pychess/ |
Mailing list: | http://groups.google.com/group/pychess-people |
Chat: | http://webchat.freenode.net/?channels=pychess&uio=d4 |
Features¶
- Play on FICS (freechess.org)
- Play on ICC (chessclub.com)
- CECP and UCI chess engine support with customizable engine configurations
- Polyglot opening book support
- Gaviota end-game tablebase support
- Hint and Spy move arrows
- Hint, Score, and Annotation panels
- Play and analyze games in separate game tabs
- Countless chess variants including Chess960, Suicide, Crazyhouse, Shuffle, Wildcastle, Losers, Atomic, Three-check, King of the hill, Horde, Makruk, Sittuyin, Cambodian
- Reads and writes PGN, EPD and FEN chess file formats
- Undo and pause chess games
- Move animation in games
- Drag and drop chess files
- Optional game move and event sounds
- Chess piece themes with 42 built-in piece themes
- Legal move highlighting
- Direct copy+paste pgn game input via Enter Game Notation open-game dialog
- Internationalised text and Figurine Algebraic Notation (FAN) support
- Translated into 38 languages (languages with +5% strings translated)
- Easy to use and intuitive look and feel
pychess API¶
pychess package¶
Subpackages¶
pychess.Database package¶
Submodules¶
pychess.Database.JvR module¶
pychess.Database.PgnImport module¶
-
class
pychess.Database.PgnImport.
PgnImport
(chessfile, append_pgn=False)¶ Bases:
object
-
do_cancel
()¶
-
do_import
(filename, info=None, progressbar=None)¶
-
get_id
(name, name_table, field, info=None)¶
-
ini_names
(name_table, field)¶
-
initialize
()¶
-
-
pychess.Database.PgnImport.
read_games
(handle)¶ Based on chess.pgn.scan_headers() from Niklas Fiekas python-chess
pychess.Database.dbwalk module¶
-
pychess.Database.dbwalk.
walk
(node, arr, txt)¶ Prepares a game data for databse. Recursively walks the node tree to collect moves and comments. Arguments: node - list (a tree of lboards created by the pgn parser) arr - array(“H”) (2 byte unsigned ints representing lmove objects
or COMMENT, VARI_START, VARI_END, NAG+nag)txt - list (comment strings)
pychess.Database.model module¶
-
pychess.Database.model.
create_indexes
(engine)¶
-
pychess.Database.model.
drop_indexes
(engine)¶
-
pychess.Database.model.
get_engine
(path=None, dialect='sqlite', echo=False)¶
-
pychess.Database.model.
get_schema_version
(engine)¶
-
pychess.Database.model.
ini_schema_version
(engine)¶
-
pychess.Database.model.
insert_or_ignore
(engine, stmt)¶
Module contents¶
pychess.Players package¶
Submodules¶
pychess.Players.CECPEngine module¶
-
class
pychess.Players.CECPEngine.
CECPEngine
(subprocess, color, protover, md5)¶ Bases:
pychess.Players.ProtocolEngine.ProtocolEngine
-
canAnalyze
()¶
-
end
(status, reason)¶ Called when the game ends in a normal way. Use this for shutting down engines etc.
-
getAnalysisLines
()¶
-
hurry
()¶ Forces engines to move now, and sends a hurry message to nonlocal human players
-
kill
(reason)¶ Kills the engine, starting with the ‘quit’ command, then sigterm and eventually sigkill. Returns the exitcode, or if engine have already been killed, returns None
-
makeMove
(board1, move, board2)¶ Gets a move from the engine (for player engines). @param board1: The current board @param move: The last move made @param board2: The board before the last move was made @return: The move the engine decided to make
-
maxAnalysisLines
()¶
-
minAnalysisLines
()¶
-
offer
(offer)¶ The players opponent has offered the player offer. If the player accepts, it should respond by mirroring the offer with emit(“accept”, offer). If it should either ignore the offer or emit “decline”.
-
offerError
(offer, error)¶ An offer, accept or action made by the player has been refused by the game model.
-
parseLine
(proc)¶
-
pause
()¶ Pauses engine using the “pause” command if available. Otherwise put engine in force mode. By the specs the engine shouldn’t ponder in force mode, but some of them do so anyways.
-
playerUndoMoves
(moves, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
prestart
()¶
-
putMove
(board1, move, board2)¶ Sends the engine the last move made (for spectator engines). @param board1: The current board @param move: The last move made @param board2: The board before the last move was made
-
requestMultiPV
(setting)¶ Set the number of analysis lines the engine will give, if possible.
If setting is too high, the engine’s maximum will be used. The setting will last until the next call to requestMultiPV. Return value: the setting used.
-
resume
()¶ Should resume player to think if he’s paused
-
setBoard
(board, search=True)¶
-
setBoardList
(boards, moves)¶
-
setOption
(key, value)¶ Set an option, which will be sent to the engine, after the ‘readyForOptions’ signal has passed. If you want to know the possible options, you should go to engineDiscoverer or use the hasOption method while you are in your ‘readyForOptions’ signal handler
-
setOptionAnalyzing
(mode)¶
-
setOptionInitialBoard
(model)¶ If the game starts at a board other than FEN_START, it should be sent here. We sends a gamemodel, so the engine can load the entire list of moves, if any
-
setOptionStrength
(strength, forcePonderOff)¶ Strength is a number [1,8] inclusive. Higher is better.
-
setOptionTime
(secs, gain, moves)¶ Seconds is the initial clock of the game. Gain is the amount of seconds a player gets after each move. If the engine doesn’t support playing with time, this will fail.
-
setOptionVariant
(variant)¶ Inform the engine of any special variant. If the engine doesn’t understand the variant, this will raise an error.
-
set_board
(board)¶
-
spectatorUndoMoves
(moves, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
start
(event, is_dead)¶
-
updateTime
(secs, opsecs)¶ Updates the player with the current remaining time as a float of seconds
-
pychess.Players.Engine module¶
-
class
pychess.Players.Engine.
Engine
(md5=None)¶ Bases:
pychess.Players.Player.Player
-
canAnalyze
()¶
-
getAnalysis
()¶ Returns a list of moves, or None if there haven’t yet been made an analysis
-
maxAnalysisLines
()¶
-
minAnalysisLines
()¶
-
offer
(offer)¶ The players opponent has offered the player offer. If the player accepts, it should respond by mirroring the offer with emit(“accept”, offer). If it should either ignore the offer or emit “decline”.
-
offerDeclined
(offer)¶ An offer sent by the player was responded negative by the opponent
-
offerError
(offer, error)¶ An offer, accept or action made by the player has been refused by the game model.
-
offerWithdrawn
(offer)¶ An offer earlier offered to the player has been withdrawn
-
on_analysis
(engine, analysis)¶
-
putMessage
(message)¶ Sends the player a chatmessage
-
requestMultiPV
(setting)¶ Set the number of analysis lines the engine will give, if possible.
If setting is too high, the engine’s maximum will be used. The setting will last until the next call to requestMultiPV. Return value: the setting used.
-
setOptionAnalyzing
(mode)¶
-
setOptionInitialBoard
(model)¶ If the game starts at a board other than FEN_START, it should be sent here. We sends a gamemodel, so the engine can load the entire list of moves, if any
-
setOptionStrength
(strength)¶ Strength is a number [1,8] inclusive. Higher is better.
-
setOptionTime
(secs, gain)¶ Seconds is the initial clock of the game. Gain is the amount of seconds a player gets after each move. If the engine doesn’t support playing with time, this will fail.
-
setOptionVariant
(variant)¶ Inform the engine of any special variant. If the engine doesn’t understand the variant, this will raise an error.
-
pychess.Players.Human module¶
-
class
pychess.Players.Human.
Human
(gmwidg, color, name, ichandle=None, icrating=None)¶ Bases:
pychess.Players.Player.Player
-
emit_action
(board, action, player, param)¶
-
end
(status, reason)¶ Called when the game ends in a normal way. Use this for shutting down engines etc.
-
hurry
()¶ Forces engines to move now, and sends a hurry message to nonlocal human players
-
kill
(reason)¶ Called when game has too die fast and ugly. Mostly used in case of errors and stuff. Use for closing connections etc.
-
makeMove
(board1, move, board2)¶ Takes a board object, and if ply>lowply the latest move object and second latest board object as well. Otherwise these two are None. Retruns: A new move object, witch the player wants to do.
-
offer
(offer)¶ The players opponent has offered the player offer. If the player accepts, it should respond by mirroring the offer with emit(“accept”, offer). If it should either ignore the offer or emit “decline”.
-
offerDeclined
(offer)¶ An offer sent by the player was responded negative by the opponent
-
offerError
(offer, error)¶ An offer, accept or action made by the player has been refused by the game model.
-
offerWithdrawn
(offer)¶ An offer earlier offered to the player has been withdrawn
-
on_game_terminated
(model)¶
-
pause
()¶ Should stop the player from thinking until resume is called
-
piece_moved
(board, move, color)¶
-
playerUndoMoves
(movecount, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
putMessage
(text)¶ Sends the player a chatmessage
-
resume
()¶ Should resume player to think if he’s paused
-
sendMessage
(text)¶
-
zero_reached
(timemodel, color)¶
-
pychess.Players.ICPlayer module¶
-
class
pychess.Players.ICPlayer.
ICPlayer
(gamemodel, ichandle, gameno, color, name, icrating=None)¶ Bases:
pychess.Players.Player.Player
-
end
(status=None, reason=None)¶ Called when the game ends in a normal way. Use this for shutting down engines etc.
-
getICHandle
()¶
-
kill
(reason)¶ Called when game has too die fast and ugly. Mostly used in case of errors and stuff. Use for closing connections etc.
-
makeMove
(board1, move, board2)¶ Takes a board object, and if ply>lowply the latest move object and second latest board object as well. Otherwise these two are None. Retruns: A new move object, witch the player wants to do.
-
observe
()¶
-
offer
(offer)¶ The players opponent has offered the player offer. If the player accepts, it should respond by mirroring the offer with emit(“accept”, offer). If it should either ignore the offer or emit “decline”.
-
offerDeclined
(offer)¶ An offer sent by the player was responded negative by the opponent
-
offerError
(offer, error)¶ An offer, accept or action made by the player has been refused by the game model.
-
offerRematch
()¶
-
offerWithdrawn
(offer)¶ An offer earlier offered to the player has been withdrawn
-
on_game_terminated
(model)¶
-
pause
()¶ Should stop the player from thinking until resume is called
-
playerUndoMoves
(movecount, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
putMessage
(text)¶ Sends the player a chatmessage
-
resetPosition
()¶ Used in observed examined games f.e. when LectureBot starts another example
-
resume
()¶ Should resume player to think if he’s paused
-
setBoard
(fen)¶
-
move_queue
¶
-
time
¶
-
pychess.Players.Player module¶
-
exception
pychess.Players.Player.
GameEnded
¶ Bases:
Exception
Used instead of returning a move on game end
-
exception
pychess.Players.Player.
InvalidMove
¶ Bases:
Exception
Used instead of returning a move, when an engine plays an invalid move
-
exception
pychess.Players.Player.
PassInterrupt
¶ Bases:
Exception
Used instead of returning a move, when a players turn is interrupted but not changed. This may happen when undoMoves doesn’t changes the current player
-
exception
pychess.Players.Player.
PlayerIsDead
¶ Bases:
Exception
Used instead of returning a move, when an engine crashes, or a nonlocal player disconnects
-
exception
pychess.Players.Player.
TurnInterrupt
¶ Bases:
Exception
Used instead of returning a move, when a players turn is interrupted. This may happen when undoMoves changes the current player
-
class
pychess.Players.Player.
Player
¶ Bases:
GObject
-
end
(status, reason)¶ Called when the game ends in a normal way. Use this for shutting down engines etc.
-
hurry
()¶ Forces engines to move now, and sends a hurry message to nonlocal human players
-
kill
(reason)¶ Called when game has too die fast and ugly. Mostly used in case of errors and stuff. Use for closing connections etc.
-
makeMove
(board1, move, board2)¶ Takes a board object, and if ply>lowply the latest move object and second latest board object as well. Otherwise these two are None. Retruns: A new move object, witch the player wants to do.
-
offer
(offer)¶ The players opponent has offered the player offer. If the player accepts, it should respond by mirroring the offer with emit(“accept”, offer). If it should either ignore the offer or emit “decline”.
-
offerDeclined
(offer)¶ An offer sent by the player was responded negative by the opponent
-
offerError
(offer, error)¶ An offer, accept or action made by the player has been refused by the game model.
-
offerWithdrawn
(offer)¶ An offer earlier offered to the player has been withdrawn
-
pause
()¶ Should stop the player from thinking until resume is called
-
playerUndoMoves
(moves, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
prestart
()¶
-
putMessage
(message)¶ Sends the player a chatmessage
-
putMove
(board1, move, board2)¶ Like makeMove, but doesn’t block and doesn’t return anything. putMove is only used when the player is spectatctor to a game
-
resume
()¶ Should resume player to think if he’s paused
-
setName
(name)¶ __repr__ should return this name
-
setOptionInitialBoard
(model)¶
-
spectatorUndoMoves
(moves, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
start
(event, is_dead)¶
-
undoMoves
(moves, gamemodel)¶ Undo ‘moves’ moves and makes the latest board in gamemodel the current
-
updateTime
(secs, opsecs)¶ Updates the player with the current remaining time as a float of seconds
-
time
¶
-
pychess.Players.ProtocolEngine module¶
-
class
pychess.Players.ProtocolEngine.
ProtocolEngine
(subprocess, color, protover, md5)¶ Bases:
pychess.Players.Engine.Engine
-
isAnalyzing
()¶
-
pychess.Players.PyChessCECP module¶
-
class
pychess.Players.PyChessCECP.
PyChessCECP
¶ Bases:
pychess.Players.PyChess.PyChess
-
handle_sigterm
(*args)¶
-
makeReady
()¶
-
run
()¶
-
-
pychess.Players.PyChessCECP.
get_input
()¶
pychess.Players.PyChessFICS module¶
pychess.Players.UCIEngine module¶
-
class
pychess.Players.UCIEngine.
UCIEngine
(subprocess, color, protover, md5)¶ Bases:
pychess.Players.ProtocolEngine.ProtocolEngine
-
end
(status, reason)¶ Called when the game ends in a normal way. Use this for shutting down engines etc.
-
getAnalysisLines
()¶
-
hasOption
(key)¶
-
hurry
()¶ Forces engines to move now, and sends a hurry message to nonlocal human players
-
kill
(reason)¶ Kills the engine, starting with the ‘stop’ and ‘quit’ commands, then trying sigterm and eventually sigkill. Returns the exitcode, or if engine have already been killed, the method returns None
-
makeMove
(board1, move, board2)¶ Takes a board object, and if ply>lowply the latest move object and second latest board object as well. Otherwise these two are None. Retruns: A new move object, witch the player wants to do.
-
maxAnalysisLines
()¶
-
minAnalysisLines
()¶
-
offer
(offer)¶ The players opponent has offered the player offer. If the player accepts, it should respond by mirroring the offer with emit(“accept”, offer). If it should either ignore the offer or emit “decline”.
-
parseLine
(proc)¶
-
pause
()¶ Should stop the player from thinking until resume is called
-
playerUndoMoves
(moves, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
prestart
()¶
-
putMove
(board1, move, board2)¶ Like makeMove, but doesn’t block and doesn’t return anything. putMove is only used when the player is spectatctor to a game
-
requestMultiPV
(n)¶ Set the number of analysis lines the engine will give, if possible.
If setting is too high, the engine’s maximum will be used. The setting will last until the next call to requestMultiPV. Return value: the setting used.
-
resume
()¶ Should resume player to think if he’s paused
-
setBoard
(board, search=True)¶
-
setOption
(key, value)¶ Set an option, which will be sent to the engine, after the ‘readyForOptions’ signal has passed. If you want to know the possible options, you should go to engineDiscoverer or use the hasOption method while you are in your ‘readyForOptions’ signal handler
-
setOptionAnalyzing
(mode)¶
-
setOptionInitialBoard
(model)¶ If the game starts at a board other than FEN_START, it should be sent here. We sends a gamemodel, so the engine can load the entire list of moves, if any
-
setOptionStrength
(strength, forcePonderOff)¶ Strength is a number [1,8] inclusive. Higher is better.
-
setOptionTime
(secs, gain, moves)¶ Seconds is the initial clock of the game. Gain is the amount of seconds a player gets after each move. If the engine doesn’t support playing with time, this will fail.
-
setOptionVariant
(variant)¶ Inform the engine of any special variant. If the engine doesn’t understand the variant, this will raise an error.
-
set_board
(board)¶
-
spectatorUndoMoves
(moves, gamemodel)¶ Some players undo different depending on whether they are players or spectators. This is a convenient way to handle that.
-
start
(event, is_dead)¶
-
updateTime
(secs, opsecs)¶ Updates the player with the current remaining time as a float of seconds
-
pychess.Players.engineNest module¶
Module contents¶
pychess.Savers package¶
Submodules¶
pychess.Savers.ChessFile module¶
-
class
pychess.Savers.ChessFile.
ChessFile
(file)¶ Bases:
object
This class describes an opened chessfile. It is lazy in the sense of not parsing any games, that the user don’t request. It has no catching.
-
close
()¶
-
get_book_moves
(fen=None)¶
-
get_date
(gameno)¶ Returns a tuple (year,month,day) of the game date Default is current time if nothing is specified in the file
-
get_elo
(gameno)¶ Returns a tuple of the players rating in ELO format Default is 1600 if nothing is specified in the file
-
get_event
(gameno)¶ Returns the event at which the game took place Could be “World Chess Cup” or “My local tournament” Default is “?” if nothing is specified in the file
-
get_id
(gameno)¶
-
get_info
(gameno)¶
-
get_player_names
(gameno)¶ Returns a tuple of the players names Default is (“Unknown”, “Unknown”) if nothing is specified
-
get_records
(direction=0)¶
-
get_result
(gameno)¶ Returns the result of the game Can be any of: RUNNING, DRAW, WHITEWON or BLACKWON Default is RUNNING if nothing is specified in the file
-
get_round
(gameno)¶ Returns the round of the event at which the game took place Pgn supports having subrounds like 2.1.5, but as of writing, only the first int is returned. Default is 1 if nothing is specified in the file
-
get_site
(gameno)¶ Returns the location at which the game took place Default is “?” if nothing is specified in the file
-
get_variant
(gameno)¶
-
loadToModel
(gameno, position, model=None)¶ Load the data of game “gameno” into the gamemodel If no model is specified, a new one will be created, loaded and returned
-
set_fen_filter
(fen)¶
-
set_scout_filter
(query)¶
-
pychess.Savers.chessalpha2 module¶
pychess.Savers.chesspastebin module¶
pychess.Savers.database module¶
-
class
pychess.Savers.database.
TagDatabase
(engine)¶ Bases:
object
-
build_order_by
(order_col, is_desc)¶
-
build_query
()¶
-
build_where_offs
(offset_list)¶
-
build_where_offs8
(offset_list)¶
-
close
()¶
-
get_count
()¶
-
get_info
(rec)¶
-
get_records
(last_seen, limit)¶
-
count
¶
-
-
pychess.Savers.database.
parseDateTag
(tag)¶
-
pychess.Savers.database.
save
(path, model, offset, flip=False)¶
pychess.Savers.epd module¶
-
class
pychess.Savers.epd.
EpdFile
(handle)¶ Bases:
pychess.Savers.ChessFile.ChessFile
-
create_rec
(line)¶
-
get_player_names
(rec)¶ Returns a tuple of the players names Default is (“Unknown”, “Unknown”) if nothing is specified
-
loadToModel
(rec, position, model=None)¶ Load the data of game “gameno” into the gamemodel If no model is specified, a new one will be created, loaded and returned
-
-
pychess.Savers.epd.
load
(handle)¶
-
pychess.Savers.epd.
save
(handle, model, position=None, flip=False)¶ Saves game to file in fen format
pychess.Savers.fen module¶
-
class
pychess.Savers.fen.
FenFile
(handle)¶ Bases:
pychess.Savers.ChessFile.ChessFile
-
loadToModel
(rec, position, model=None)¶ Load the data of game “gameno” into the gamemodel If no model is specified, a new one will be created, loaded and returned
-
-
pychess.Savers.fen.
load
(handle)¶
-
pychess.Savers.fen.
save
(handle, model, position=None, flip=False)¶ Saves game to file in fen format
pychess.Savers.pgn module¶
pychess.Savers.png module¶
Module contents¶
pychess.System package¶
Submodules¶
pychess.System.Log module¶
-
class
pychess.System.Log.
ExtraAdapter
(logger, extra)¶ Bases:
logging.LoggerAdapter
-
process
(msg, kwargs)¶ Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.
Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.
-
-
class
pychess.System.Log.
TaskFormatter
(fmt=None, datefmt=None)¶ Bases:
logging.Formatter
-
format
(record)¶ Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
-
-
pychess.System.Log.
setup_glib_logging
()¶ Code from https://github.com/GNOME/meld/blob/master/bin/meld
pychess.System.LogEmitter module¶
-
class
pychess.System.LogEmitter.
GLogHandler
(emitter)¶ Bases:
logging.Handler
-
emit
(record)¶ Do whatever it takes to actually log the specified logging record.
This version is intended to be implemented by subclasses and so raises a NotImplementedError.
-
-
class
pychess.System.LogEmitter.
LogEmitter
¶ Bases:
GObject
pychess.System.SubProcess module¶
pychess.System.accordion module¶
pychess.System.cairoextras module¶
-
class
pychess.System.cairoextras.
PycairoContext
¶ Bases:
_ctypes.Structure
-
PyObject_HEAD
¶ Structure/Union member
-
base
¶ Structure/Union member
-
ctx
¶ Structure/Union member
-
-
pychess.System.cairoextras.
create_cairo_font_face_for_file
(filename, faceindex=0, loadoptions=0)¶ Given the name of a font file, and optional faceindex to pass to FT_New_Face and loadoptions to pass to cairo_ft_font_face_create_for_ft_face, creates a cairo.FontFace object that may be used to render text with that font.
pychess.System.command module¶
pychess.System.conf module¶
The task of this module is to provide easy saving/loading of configurations It also supports gconf like connection, so you get notices when a property has changed.
-
pychess.System.conf.
get
(key, section='General')¶
-
pychess.System.conf.
hasKey
(key, section='General')¶
-
pychess.System.conf.
notify_add
(key, func, *args, section='General')¶ The signature for func must be self, client, *args, **kwargs
-
pychess.System.conf.
notify_remove
(conid)¶
-
pychess.System.conf.
save_config
(path='/home/docs/.config/pychess/config', encoding='UTF-8')¶
-
pychess.System.conf.
set
(key, value, section='General')¶
pychess.System.debug module¶
pychess.System.gst_player module¶
-
pychess.System.gst_player.
on_message
(bus, message)¶
-
pychess.System.gst_player.
play
(loop)¶
pychess.System.gstreamer module¶
-
class
pychess.System.gstreamer.
GstPlayer
¶ Bases:
pychess.System.gstreamer.Player
-
play
(uri)¶
-
pychess.System.ping module¶
pychess.System.prefix module¶
This module provides some basic functions for accessing pychess datefiles in system or user space
-
pychess.System.prefix.
addDataPrefix
(subpath)¶
-
pychess.System.prefix.
addEngineDataPrefix
(subpath)¶
-
pychess.System.prefix.
addUserCachePrefix
(subpath)¶
-
pychess.System.prefix.
addUserConfigPrefix
(subpath)¶
-
pychess.System.prefix.
addUserDataPrefix
(subpath)¶
-
pychess.System.prefix.
getDataPrefix
()¶
-
pychess.System.prefix.
getEngineDataPrefix
()¶
-
pychess.System.prefix.
getUserCachePrefix
()¶
-
pychess.System.prefix.
getUserConfigPrefix
()¶
-
pychess.System.prefix.
getUserDataPrefix
()¶
-
pychess.System.prefix.
get_user_cache_dir
()¶
-
pychess.System.prefix.
get_user_config_dir
()¶
-
pychess.System.prefix.
get_user_data_dir
()¶
-
pychess.System.prefix.
isInstalled
()¶
pychess.System.protoopen module¶
-
pychess.System.protoopen.
isWriteable
(uri)¶ Returns true if protoopen can open a write pipe to the uri
-
pychess.System.protoopen.
protoopen
(uri, encoding='latin_1')¶ Function for opening many things
-
pychess.System.protoopen.
protosave
(uri, append=False)¶ Function for saving many things
-
pychess.System.protoopen.
splitUri
(uri)¶
pychess.System.readuntil module¶
Monkey patching asyncio.StreamReader to add readuntil() from Python 3.5.2
-
exception
pychess.System.readuntil.
IncompleteReadError
(partial, expected)¶ Bases:
EOFError
Incomplete read error. Attributes:
- partial: read bytes string before the end of stream was reached
- expected: total number of expected bytes (or None if unknown)
-
exception
pychess.System.readuntil.
LimitOverrunError
(message, consumed)¶ Bases:
Exception
Reached the buffer limit while looking for a separator.
Attributes: - consumed: total number of to be consumed bytes.
-
pychess.System.readuntil.
readuntil
(self, separator=b'\n')¶ Read data from the stream until
separator
is found.On success, the data and separator will be removed from the internal buffer (consumed). Returned data will include the separator at the end.
Configured stream limit is used to check result. Limit sets the maximal length of data that can be returned, not counting the separator.
If an EOF occurs and the complete separator is still not found, an IncompleteReadError exception will be raised, and the internal buffer will be reset. The IncompleteReadError.partial attribute may contain the separator partially.
If the data cannot be read because of over limit, a LimitOverrunError exception will be raised, and the data will be left in the internal buffer, so it can be read again.
pychess.System.repeat module¶
-
pychess.System.repeat.
repeat
(func, *args, **kwargs)¶ Repeats a function in a new thread until it returns False
-
pychess.System.repeat.
repeat_sleep
(func, sleeptime, recur=False)¶ Runs func in a thread and repeats it approximately each sleeptime [s] until func returns False. Notice that we sleep first, then run. Not the other way around. If repeat_sleep is called with recur=True, each call will be called with the return value of last call as argument. The argument has to be optional, as it wont be used first time, and it has to be non-None.
pychess.System.uistuff module¶
-
class
pychess.System.uistuff.
GladeWidgets
(filename)¶ Bases:
object
A simple class that wraps a the glade get_widget function into the python __getitem__ version
-
getGlade
()¶
-
-
pychess.System.uistuff.
appendAutowrapColumn
(treeview, name, **kvargs)¶
-
pychess.System.uistuff.
createCombo
(combo, data=[], name=None, ellipsize_mode=None)¶
-
pychess.System.uistuff.
genColor
(n, startpoint=0)¶
-
pychess.System.uistuff.
getMonitorBounds
()¶
-
pychess.System.uistuff.
keep
(widget, key, get_value_=None, set_value_=None)¶
-
pychess.System.uistuff.
keepDown
(scrolledWindow)¶
-
pychess.System.uistuff.
keepWindowSize
(key, window, defaultSize=None, defaultPosition=0)¶ You should call keepWindowSize before show on your windows
-
pychess.System.uistuff.
loadDialogWidget
(widget, widget_name, config_number, get_value_=None, set_value_=None, first_value=None)¶
-
pychess.System.uistuff.
makeYellow
(box)¶
-
pychess.System.uistuff.
onceWhenReady
(window, func, *args, **kwargs)¶
-
pychess.System.uistuff.
saveDialogWidget
(widget, widget_name, config_number, get_value_=None)¶
-
pychess.System.uistuff.
updateCombo
(combo, data)¶
Module contents¶
-
pychess.System.
caller_name
(skip=2)¶ Get a name of a caller in the format module.class.method
skip specifies how many levels of stack to skip while getting caller name. skip=1 means “who calls me”, skip=2 “who calls my caller” etc.
An empty string is returned if skipped levels exceed stack height
-
pychess.System.
download_file
(url, progressbar=None)¶
-
pychess.System.
download_file_async
(url, progressbar=None)¶
-
pychess.System.
fident
(f)¶ Get an identifier for a function or method
-
pychess.System.
get_threadname
(thread_namer)¶
-
pychess.System.
profile_me
(fn)¶
pychess.Utils package¶
Subpackages¶
-
pychess.Utils.lutils.Benchmark.
benchmark
(maxdepth=6)¶ Times a search of a static list of positions.
-
class
pychess.Utils.lutils.LBoard.
LBoard
(variant=0)¶ Bases:
object
-
applyFen
(fenstr)¶ Applies the fenstring to the board. If the string is not properly written a SyntaxError will be raised, having its message ending in Pos(%d) specifying the string index of the problem. if an error is found, no changes will be made to the board.
-
applyMove
(move)¶
-
asFen
(enable_bfen=True)¶
-
clone
()¶
-
iniAtomic
()¶
-
iniCambodian
()¶
-
iniHouse
()¶
-
isChecked
()¶
-
opIsChecked
()¶
-
popMove
()¶
-
prepr
(ascii=False)¶
-
repetitionCount
(draw_threshold=3)¶
-
reprCastling
()¶
-
setCastling
(castling)¶
-
setColor
(color)¶
-
setEnpassant
(epcord)¶
-
willGiveCheck
(move)¶
-
willLeaveInCheck
(move)¶
-
fin_kings
= ((2, 6), (58, 62))¶
-
fin_rooks
= ((3, 5), (59, 61))¶
-
holding
= ({1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0}, {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0})¶
-
ini_kings
= (4, 60)¶
-
ini_rooks
= ((0, 7), (56, 63))¶
-
lastMove
¶
-
-
class
pychess.Utils.lutils.TranspositionTable.
TranspositionTable
(maxSize)¶ Bases:
object
-
addButterfly
(move, depth)¶
-
addKiller
(ply, move)¶
-
clear
()¶
-
getButterfly
(move)¶
-
isHashMove
(ply, move)¶
-
isKiller
(ply, move)¶
-
newSearch
()¶
-
probe
(board, depth, alpha, beta)¶
-
record
(board, move, score, hashf, depth)¶
-
setHashMove
(ply, move)¶
-
-
pychess.Utils.lutils.attack.
addXrayPiece
(board, tcord, fcord, color, ours, theirs)¶ This is used by swapOff. The purpose of this routine is to find a piece which attack through another piece (e.g. two rooks, Q+B, B+P, etc.) Color is the side attacking the square where the swapping is to be done.
-
pychess.Utils.lutils.attack.
defends
(board, fcord, tcord)¶ Could fcord attack tcord if the piece on tcord wasn’t on the team of fcord? Doesn’t test check.
-
pychess.Utils.lutils.attack.
getAttacks
(board, cord, color)¶ To create a bitboard of pieces of color, which attacks cord The type of args are LBoard, ,BLACK or WHITE from const file
-
pychess.Utils.lutils.attack.
isAttacked
(board, cord, color, ischecked=False)¶ To determine if cord is attacked by any pieces from color.
-
pychess.Utils.lutils.attack.
piecesAttackingCord
(board, cord, color)¶ return the type of piece attacking Cord does not support variant yet The type of args are LBoard, Cord as flat number (cord argument of class Cord, BLACK or WHITE from const file
-
pychess.Utils.lutils.attack.
pinnedOnKing
(board, cord, color)¶
-
pychess.Utils.lutils.attack.
propagateRayFollowingMovement
(board, cord, bitboard)¶ tests if there are pieces blocking the way on the movement line
-
pychess.Utils.lutils.attack.
staticExchangeEvaluate
(board, moveOrTcord, color=None)¶ The GnuChess Static Exchange Evaluator (or SEE for short). First determine the target square. Create a bitboard of all squares attacking the target square for both sides. Using these 2 bitboards, we take turn making captures from smallest piece to largest piece. When a sliding piece makes a capture, we check behind it to see if another attacker piece has been exposed. If so, add this to the bitboard as well. When performing the “captures”, we stop if one side is ahead and doesn’t need to capture, a form of pseudo-minimaxing.
-
pychess.Utils.lutils.bitboard.
clearBit
(bitboard, i)¶
-
pychess.Utils.lutils.bitboard.
firstBit
(bitboard)¶ Returns the index of the first non-zero bit from left
-
pychess.Utils.lutils.bitboard.
iterBits
(bitboard)¶
-
pychess.Utils.lutils.bitboard.
lastBit
(bitboard)¶
-
pychess.Utils.lutils.bitboard.
setBit
(bitboard, i)¶
-
pychess.Utils.lutils.bitboard.
toString
(bitboard)¶
-
class
pychess.Utils.lutils.egtb_gaviota.
EgtbGaviota
¶ Bases:
object
-
scoreAllMoves
(board)¶
-
scoreGame
(board, omitDepth, probeSoft)¶
-
supports
(size)¶
-
-
class
pychess.Utils.lutils.egtb_gaviota.
TbStats
¶ Bases:
_ctypes.Structure
-
bytes_read
¶ Structure/Union member
-
drive_hits
¶ Structure/Union member
-
drive_miss
¶ Structure/Union member
-
dtm_cachesize
¶ Structure/Union member
-
dtm_easy_hits
¶ Structure/Union member
-
dtm_hard_prob
¶ Structure/Union member
-
dtm_occupancy
¶ Structure/Union member
-
dtm_soft_prob
¶ Structure/Union member
-
files_opened
¶ Structure/Union member
-
memory_efficiency
¶ Structure/Union member
-
memory_hits
¶ Structure/Union member
-
total_hits
¶ Structure/Union member
-
wdl_cachesize
¶ Structure/Union member
-
wdl_easy_hits
¶ Structure/Union member
-
wdl_hard_prob
¶ Structure/Union member
-
wdl_occupancy
¶ Structure/Union member
-
wdl_soft_prob
¶ Structure/Union member
-
-
pychess.Utils.lutils.ldata.
FILE
(cord)¶
-
pychess.Utils.lutils.ldata.
RANK
(cord)¶
-
pychess.Utils.lutils.ldata.
VALUE_AT_PLY
(val, ply)¶ Return the value of scoring val a given number of plies into the future.
-
pychess.Utils.lutils.ldraw.
test
(board)¶ Test if the position is drawn. Two-fold repetitions are counted.
-
pychess.Utils.lutils.ldraw.
testFifty
(board)¶
-
pychess.Utils.lutils.ldraw.
testMaterial
(board)¶ Tests if no players are able to win the game from the current position
-
pychess.Utils.lutils.ldraw.
testPlayerMatingMaterial
(board, color)¶ Tests if given color has enough material to mate on board
-
pychess.Utils.lutils.leval.
cacheablePawnInfo
(board, phase)¶
-
pychess.Utils.lutils.leval.
clearPawnTable
()¶
-
pychess.Utils.lutils.leval.
evalBishops
(board, color, phase)¶
-
pychess.Utils.lutils.leval.
evalDev
(board, color, phase)¶ Calculate the development score for side (for opening only). Penalize the following. . Uncastled and cannot castled . Early queen move. - bad wing pawns
-
pychess.Utils.lutils.leval.
evalDoubleQR7
(board, color, phase)¶ Tests for QR, RR, QB and BB combos on the 7th rank. These are dangerous to kings, and good at killing pawns
-
pychess.Utils.lutils.leval.
evalKing
(board, color, phase)¶
-
pychess.Utils.lutils.leval.
evalKingTropism
(board, color, phase)¶ All other things being equal, having your Knights, Queens and Rooks close to the opponent’s king is a good thing
-
pychess.Utils.lutils.leval.
evalMaterial
(board, color)¶
-
pychess.Utils.lutils.leval.
evalPawnStructure
(board, color, phase, passed, weaked)¶ Pawn evaluation is based on the following factors: 1. Pawn square tables. 2. Passed pawns. 3. Backward pawns. 4. Pawn base under attack. 5. Doubled pawns 6. Isolated pawns 7. Connected passed pawns on 6/7th rank. 8. Unmoved & blocked d, e pawn 9. Passed pawn which cannot be caught. 10. Pawn storms. Notice: The function has better precicion for current player
-
pychess.Utils.lutils.leval.
evalRooks
(board, color, phase)¶ rooks on open/half-open files
-
pychess.Utils.lutils.leval.
evalTrappedBishops
(board, color)¶ Check for bishops trapped at A2/H2/A7/H7
-
pychess.Utils.lutils.leval.
evaluateComplete
(board, color)¶ A detailed evaluation function, taking into account several positional factors
-
pychess.Utils.lutils.leval.
probePawns
(board, phase)¶
-
pychess.Utils.lutils.leval.
recordPawns
(board, phase, score, passed, weaked)¶
-
exception
pychess.Utils.lutils.lmove.
ParsingError
¶ Bases:
Exception
Please raise this with a 3-tupple: (move, reason, board.asFen()) The reason should be usable in the context: ‘Move was not parseable because %s’ % reason
-
pychess.Utils.lutils.lmove.
FCORD
(move)¶
-
pychess.Utils.lutils.lmove.
FILE
(cord)¶
-
pychess.Utils.lutils.lmove.
FLAG
(move)¶
-
pychess.Utils.lutils.lmove.
FLAG_PIECE
(piece)¶
-
pychess.Utils.lutils.lmove.
PROMOTE_PIECE
(flag)¶
-
pychess.Utils.lutils.lmove.
RANK
(cord)¶
-
pychess.Utils.lutils.lmove.
TCORD
(move)¶
-
pychess.Utils.lutils.lmove.
determineAlgebraicNotation
(algnot)¶
-
pychess.Utils.lutils.lmove.
listToMoves
(board, movstrs, type=None, testvalidate=False, ignoreErrors=False)¶
-
pychess.Utils.lutils.lmove.
listToSan
(board, moves)¶
-
pychess.Utils.lutils.lmove.
parseAN
(board, an)¶ Parse an Algebraic Notation string
-
pychess.Utils.lutils.lmove.
parseAny
(board, algnot)¶
-
pychess.Utils.lutils.lmove.
parseFAN
(board, fan)¶ Parse a Figurine Algebraic Notation string
-
pychess.Utils.lutils.lmove.
parseLAN
(board, lan)¶ Parse a Long/Expanded Algebraic Notation string
-
pychess.Utils.lutils.lmove.
parsePolyglot
(board, pg)¶ Parse a 16-bit Polyglot-format move
-
pychess.Utils.lutils.lmove.
parseSAN
(board, san)¶ Parse a Short/Abbreviated Algebraic Notation string
-
pychess.Utils.lutils.lmove.
sittuyin_promotion_fcord
(board, tcord)¶
-
pychess.Utils.lutils.lmove.
toAN
(board, move, short=False, castleNotation=0)¶ Returns a Algebraic Notation string of a move board should be prior to the move short – returns the short variant, e.g. f7f8q rather than f7f8=Q
-
pychess.Utils.lutils.lmove.
toFAN
(board, move)¶ Returns a Figurine Algebraic Notation string of a move
-
pychess.Utils.lutils.lmove.
toLAN
(board, move, localRepr=False)¶ Returns a Long/Expanded Algebraic Notation string of a move board should be prior to the move
-
pychess.Utils.lutils.lmove.
toPolyglot
(board, move)¶ Returns a 16-bit Polyglot-format move board should be prior to the move
-
pychess.Utils.lutils.lmove.
toSAN
(board, move, localRepr=False)¶ Returns a Short/Abbreviated Algebraic Notation string of a move The board should be prior to the move
-
pychess.Utils.lutils.lmovegen.
genAllMoves
(board, drops=True)¶
-
pychess.Utils.lutils.lmovegen.
genCaptures
(board)¶
-
pychess.Utils.lutils.lmovegen.
genCastles
(board)¶
-
pychess.Utils.lutils.lmovegen.
genCheckEvasions
(board)¶
-
pychess.Utils.lutils.lmovegen.
genDrops
(board)¶
-
pychess.Utils.lutils.lmovegen.
genPieceMoves
(board, piece, tcord)¶ ” Used by parseSAN only to accelerate it a bit
-
pychess.Utils.lutils.lmovegen.
gen_sittuyin_promotions
(board)¶
-
pychess.Utils.lutils.lmovegen.
newMove
(fromcord, tocord, flag=0)¶
-
class
pychess.Utils.lutils.lsearch.
EndgameTable
¶ Bases:
object
-
scoreAllMoves
(lBoard)¶ Return each move’s result and depth to mate. lBoard: A low-level board structure Return value: a list, with best moves first, of: move: A high-level move structure game_result: Either WHITEWON, DRAW, BLACKWON depth: Depth to mate
-
-
pychess.Utils.lutils.lsearch.
alphaBeta
(board, depth, alpha=-32767, beta=32767, ply=0)¶ This is a alphabeta/negamax/quiescent/iterativedeepend search algorithm Based on moves found by the validator.py findmoves2 function and evaluated by eval.py. The function recalls itself “depth” times. If the last move in range depth was a capture, it will continue calling itself, only searching for captures. It returns a tuple of * a list of the path it found through the search tree (last item being
the deepest)- a score of your standing the the last possition.
-
pychess.Utils.lutils.lsearch.
enableEGTB
()¶
-
pychess.Utils.lutils.lsearch.
quiescent
(board, alpha, beta, ply)¶
-
pychess.Utils.lutils.lsearch.
random
() → x in the interval [0, 1).¶
-
pychess.Utils.lutils.lsort.
getCaptureValue
(board, move)¶
-
pychess.Utils.lutils.lsort.
getMoveValue
(board, table, depth, move)¶ Sort criteria is as follows. 1. The move from the hash table 2. Captures as above. 3. Killers. 4. History. 5. Moves to the centre.
-
pychess.Utils.lutils.lsort.
sortCaptures
(board, moves)¶
-
pychess.Utils.lutils.lsort.
sortMoves
(board, table, ply, hashmove, moves)¶
-
pychess.Utils.lutils.perft.
do_perft
(board, depth, root)¶
-
pychess.Utils.lutils.perft.
perft
(board, depth, root)¶
This module differs from leval in that it is not optimized for speed. It checks differences between last and current board, and returns not scores, but strings describing the differences. Can be used for commenting on board changes.
-
pychess.Utils.lutils.strateval.
attack_type
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
defencive_moves_safety
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
defencive_moves_tactic
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
final_status
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
join
(items)¶
-
pychess.Utils.lutils.strateval.
offencive_moves_check
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
offencive_moves_fianchetto
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
offencive_moves_pin
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
offencive_moves_rook
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
prefix_type
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
simple_activity
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
simple_tropism
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
state_destroysCastling
(model, ply, phase)¶ Does the move destroy the castling ability of the opponent
-
pychess.Utils.lutils.strateval.
state_outpost
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
state_pawn
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
state_trappedBishops
(model, ply, phase)¶ Check for bishops trapped at A2/H2/A7/H7
-
pychess.Utils.lutils.strateval.
tip_mobility
(model, ply, phase)¶
-
pychess.Utils.lutils.strateval.
tip_pawnStorm
(model, ply, phase)¶ If players are castled in different directions we should storm in opponent side
Submodules¶
pychess.Utils.Board module¶
-
class
pychess.Utils.Board.
Board
(setup=False, lboard=None)¶ Bases:
object
Board is a thin layer above LBoard, adding the Piece objects, which are needed for animation in BoardView. In contrast to LBoard, Board is immutable, which means it will clone itself each time you apply a move to it. Caveat: As the only objects, the Piece objects in the self.data lists will not be cloned, to make animation state preserve between moves
-
asFen
(enable_bfen=True)¶
-
clone
(lboard=None)¶
-
getHoldingCord
(color, piece)¶ Get the chord of first occurrence of piece in given color holding
-
getHoldingPieces
(color)¶ Get the list of pieces from given color holding
-
move
(move, lboard=None)¶ Creates a new Board object cloning itself then applying the move.move to the clone Board’s lboard. If lboard param was given, it will be used when cloning, and move will not be applyed, just the high level Piece objects will be adjusted.
-
newHoldingCord
(color, nth=1)¶ Find the nth empty slot in given color holding. In atomic explosions nth can be > 1.
-
popPieceFromHolding
(color, piece)¶ Remove and return a piece in given color holding
-
printPieces
()¶
-
reorderHolding
(color)¶ Reorder captured pieces by their value
-
setColor
(color)¶
-
simulateMove
(board1, move)¶
-
simulateUnmove
(board1, move)¶
-
switchColor
()¶ Switches the current color to move and unsets the enpassant cord. Mostly to be used by inversed analyzers
-
FILES
= 8¶
-
HOLDING_FILES
= ((11, 10, 9), (-4, -3, -2))¶
-
PROMOTIONS
= (7, 6, 5, 4)¶
-
PROMOTION_ZONE
= ((56, 57, 58, 59, 60, 61, 62, 63), (0, 1, 2, 3, 4, 5, 6, 7))¶
-
RANKS
= 8¶
-
color
¶
-
enpassant
¶
-
ply
¶
-
variant
= 0¶
-
-
pychess.Utils.Board.
reverse_enum
(L)¶
pychess.Utils.Cord module¶
-
class
pychess.Utils.Cord.
Cord
(var1, var2=None, color=None)¶ Bases:
object
-
charToInt
(char)¶
-
intToChar
(x)¶
-
cord
¶
-
cords
¶
-
cx
¶
-
cy
¶
-
-
pychess.Utils.Cord.
cmp
(x, y)¶
pychess.Utils.EndgameTable module¶
-
class
pychess.Utils.EndgameTable.
EndgameTable
¶ Bases:
GObject
Wrap the low-level providers of exact endgame knowledge.
-
scoreAllMoves
(lBoard)¶ Return each move’s result and depth to mate.
lBoard: A low-level board structure Return value: a list, with best moves first, of: move: A high-level move structure game_result: Either WHITEWON, DRAW, BLACKWON depth: Depth to mate
-
scoreGame
(lBoard, omitDepth=False, probeSoft=False)¶ Return result and depth to mate. (Intended for engine use.)
lBoard: A low-level board structure omitDepth: Look up only the game’s outcome (may save time) probeSoft: Fail if the probe would require disk or network access. Return value: game_result: Either WHITEWON, DRAW, BLACKWON, or (on failure) None depth: Depth to mate, or (if omitDepth or the game is drawn) None
-
pychess.Utils.GameModel module¶
-
class
pychess.Utils.GameModel.
GameModel
(timemodel=None, variant=<class 'pychess.Variants.normal.NormalBoard'>)¶ Bases:
GObject
GameModel contains all available data on a chessgame. It also has the task of controlling players actions and moves
-
acceptReceived
(player, offer)¶
-
add_move2variation
(board, move, variationIdx)¶
-
add_variation
(board, moves, comment='', score='', emit=True)¶
-
checkStatus
()¶ Updates self.status so it fits with what getStatus(boards[-1]) would return. That is, if the game is e.g. check mated this will call mode.end(), or if moves have been undone from an otherwise ended position, this will call __resume and emit game_unended.
-
color
(player)¶
-
declineReceived
(player, offer)¶
-
end
(status, reason)¶
-
getBoardAtPly
(ply, variation=0)¶
-
getMoveAtPly
(ply, variation=0)¶
-
get_book_move
()¶
-
hasEnginePlayer
()¶
-
hasLocalPlayer
()¶
-
isChanged
()¶
-
isEngine2EngineGame
()¶
-
isLoadedGame
()¶
-
isLocalGame
()¶
-
isObservationGame
()¶
-
isPlayingICSGame
()¶
-
kill
(reason)¶
-
loadAndStart
(uri, loader, gameno, position, first_time=True)¶
-
offerReceived
(player, offer)¶
-
on_analyze
(analyzer, analysis)¶
-
pause
()¶ Players will raise NotImplementedError if they doesn’t support pause. Spectators will be ignored.
-
pause_analyzer
(analyzer_type)¶
-
remove_analyzer
(analyzer_type)¶
-
remove_variation
(board, parent)¶ board must be an lboard object of the first Board object of a variation Board(!) list
-
restart_analyzer
(analyzer_type)¶
-
resume
()¶
-
resume_analyzer
(analyzer_type)¶
-
save
(uri, saver, append, position=None, flip=False)¶
-
setOpening
(ply=None, redetermine=False)¶
-
setPlayers
(players)¶
-
start
()¶
-
start_analyzer
(analyzer_type, force_engine=None)¶
-
terminate
()¶
-
undoMoves
(moves)¶ Undo and remove moves number of moves from the game history from the GameModel, players, and any spectators
-
undo_in_variation
(board)¶ board must be the latest Board object of a variation board list
-
withdrawReceived
(player, offer)¶
-
zero_reached
(timemodel, color)¶
-
curplayer
¶
-
display_text
¶
-
lowply
¶
-
orientation
¶
-
ply
¶
-
practice_game
¶
-
starting_color
¶
-
waitingplayer
¶
-
pychess.Utils.IconLoader module¶
-
pychess.Utils.IconLoader.
get_pixbuf
(path, size=None)¶
-
pychess.Utils.IconLoader.
load_icon
(size, *alternatives)¶
pychess.Utils.Move module¶
-
class
pychess.Utils.Move.
Move
(cord0, cord1=None, board=None, promotion=None)¶ Bases:
object
-
as_uci
()¶
-
is_capture
(board)¶
-
cords
¶
-
promotion
¶
-
-
pychess.Utils.Move.
listToMoves
(board, mstrs, type=None, validate=False, ignoreErrors=False)¶
-
pychess.Utils.Move.
listToSan
(board, moves)¶
-
pychess.Utils.Move.
parseAN
(board, an)¶ Parse an Algebraic Notation string
-
pychess.Utils.Move.
parseAny
(board, algnot)¶
-
pychess.Utils.Move.
parseFAN
(board, lan)¶ Parse a Long/Expanded Algebraic Notation string
-
pychess.Utils.Move.
parseLAN
(board, lan)¶ Parse a Long/Expanded Algebraic Notation string
-
pychess.Utils.Move.
parseSAN
(board, san)¶ Parse a Short/Abbreviated Algebraic Notation string
-
pychess.Utils.Move.
toAN
(board, move, short=False, castleNotation=0)¶ Returns a Algebraic Notation string of a move board should be prior to the move
-
pychess.Utils.Move.
toFAN
(board, move)¶ Returns a Figurine Algebraic Notation string of a move
-
pychess.Utils.Move.
toLAN
(board, move)¶ Returns a Long/Expanded Algebraic Notation string of a move board should be prior to the move
-
pychess.Utils.Move.
toSAN
(board, move, localRepr=False)¶ Returns a Short/Abbreviated Algebraic Notation string of a move The board should be prior to the move, board2 past. If not board2, toSAN will not test mate
pychess.Utils.Piece module¶
pychess.Utils.SetupModel module¶
pychess.Utils.TimeModel module¶
-
class
pychess.Utils.TimeModel.
TimeModel
(secs=0, gain=0, bsecs=-1, minutes=-1, moves=0)¶ Bases:
GObject
-
end
()¶
-
getElapsedMoveTime
(ply)¶
-
getInitialTime
()¶
-
getPlayerTime
(color, movecount=-1)¶
-
hasBWTimes
(bmovecount, wmovecount)¶
-
isBlitzFide
()¶
-
pause
()¶
-
resume
()¶
-
setMovingColor
(movingColor)¶
-
start
()¶
-
tap
()¶
-
undoMoves
(moves)¶ - Sets time and color to move, to the values they were having in the
- beginning of the ply before the current.
his move. Example: White intervals (is thinking): [120, 130, …] Black intervals: [120, 115] Is undoed to: White intervals: [120, 130] Black intervals (is thinking): [120, …]
-
updatePlayer
(color, secs)¶
-
display_text
¶
-
hasTimes
¶
-
ply
¶
-
pychess.Utils.book module¶
-
class
pychess.Utils.book.
BookEntry
(key, move, weight, learn)¶ Bases:
tuple
-
key
¶ Alias for field number 0
-
learn
¶ Alias for field number 3
-
move
¶ Alias for field number 1
-
weight
¶ Alias for field number 2
-
-
pychess.Utils.book.
getOpenings
(board)¶ Return a tuple (move, weight, learn) for each opening move in the given position. The weight is proportional to the probability that a move should be played. By convention, games is the number of times a move has been tried, and score the number of points it has scored (with 2 per victory and 1 per draw). However, opening books aren’t required to keep this information.
pychess.Utils.checkversion module¶
-
pychess.Utils.checkversion.
checkversion
()¶
-
pychess.Utils.checkversion.
isgit
()¶
pychess.Utils.const module¶
pychess.Utils.eco module¶
-
pychess.Utils.eco.
find_opening_fen
(keyword)¶
-
pychess.Utils.eco.
get_eco
(hash, exactPosition=True)¶
pychess.Utils.elo module¶
-
pychess.Utils.elo.
get_elo_rating_change
(model, overridden_welo, overridden_belo)¶ http://www.fide.com/fide/handbook.html?id=197&view=article (§8.5, July 2017)
-
pychess.Utils.elo.
get_elo_rating_change_pgn
(model, player)¶
-
pychess.Utils.elo.
get_elo_rating_change_str
(model, player, overridden_welo, overridden_belo)¶ Determination of the ELO rating change
pychess.Utils.eval module¶
-
pychess.Utils.eval.
analyzePawnStructure
(board)¶ Look at pawn positions to be able to detect features such as doubled, isolated or passed pawns
-
pychess.Utils.eval.
evalBadBishops
(board)¶ Bishops may be limited in their movement if there are too many pawns on squares of their color
-
pychess.Utils.eval.
evalCastling
(board)¶ Used to encourage castling
-
pychess.Utils.eval.
evalDevelopment
(board)¶ Mostly useful in the opening, this term encourages the machine to move its bishops and knights into play, to control the center with its queen’s and king’s pawns
-
pychess.Utils.eval.
evalKingTropism
(board)¶ All other things being equal, having your Knights, Queens and Rooks close to the opponent’s king is a good thing
-
pychess.Utils.eval.
evalMaterial
(board)¶
-
pychess.Utils.eval.
evalPawnStructure
(board)¶ Given the pawn formations, penalize or bonify the position according to the features it contains
-
pychess.Utils.eval.
evalRookBonus
(board)¶ Rooks are more effective on the seventh rank and on open files
-
pychess.Utils.eval.
evaluateComplete
(board, color=0)¶ A detailed evaluation function, taking into account several positional factors
-
pychess.Utils.eval.
lookUpTropism
(px, py, kx, ky, piece)¶
pychess.Utils.isoCountries module¶
pychess.Utils.logic module¶
This module contains chess logic functins for the pychess client. They are based upon the lutils modules, but supports standard object types and is therefore not as fast.
-
pychess.Utils.logic.
genCastles
(board)¶
-
pychess.Utils.logic.
getDestinationCords
(board, cord)¶
-
pychess.Utils.logic.
getMoveKillingKing
(board)¶ Returns a move from the current color, able to capture the opponent king
-
pychess.Utils.logic.
getStatus
(board)¶
-
pychess.Utils.logic.
isClaimableDraw
(board)¶
-
pychess.Utils.logic.
legalMoveCount
(board)¶
-
pychess.Utils.logic.
playerHasMatingMaterial
(board, playercolor)¶
-
pychess.Utils.logic.
standard_validate
(board, move)¶
-
pychess.Utils.logic.
validate
(board, move)¶
pychess.Utils.repr module¶
Module contents¶
-
class
pychess.Utils.
wait_signal
(obj, name, *, loop=None)¶ Bases:
_asyncio.Future
A future for waiting for a given signal to occur.
-
cancel
()¶ Cancel the future and schedule callbacks.
If the future is already done or cancelled, return False. Otherwise, change the future’s state to cancelled, schedule the callbacks and return True.
-
-
pychess.Utils.
createStoryTextAppEvent
(text)¶
-
pychess.Utils.
formatTime
(seconds, clk2pgn=False)¶
-
pychess.Utils.
prettyPrintScore
(s, depth, format_mate=False)¶ The score parameter is an eval value from White point of view
pychess.Variants package¶
Submodules¶
pychess.Variants.asean module¶
-
class
pychess.Variants.asean.
AiWokBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
PROMOTIONS
= (7,)¶
-
PROMOTION_ZONE
= ((40, 41, 42, 43, 44, 45, 46, 47), (16, 17, 18, 19, 20, 21, 22, 23))¶
-
cecp_name
= 'ai-wok'¶
-
name
= 'Ai-Wok'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 34¶
-
variant_group
= 5¶
-
-
class
pychess.Variants.asean.
AseanBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
cecp_name
= 'asean'¶
-
name
= 'ASEAN'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 30¶
-
variant_group
= 5¶
-
-
class
pychess.Variants.asean.
CambodianBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
PROMOTIONS
= (7,)¶
-
PROMOTION_ZONE
= ((40, 41, 42, 43, 44, 45, 46, 47), (16, 17, 18, 19, 20, 21, 22, 23))¶
-
cecp_name
= 'cambodian'¶
-
name
= 'Cambodian'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 33¶
-
variant_group
= 5¶
-
-
class
pychess.Variants.asean.
MakrukBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
PROMOTIONS
= (7,)¶
-
PROMOTION_ZONE
= ((40, 41, 42, 43, 44, 45, 46, 47), (16, 17, 18, 19, 20, 21, 22, 23))¶
-
cecp_name
= 'makruk'¶
-
name
= 'Makruk'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 31¶
-
variant_group
= 5¶
-
-
class
pychess.Variants.asean.
SittuyinBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
PROMOTIONS
= (7, 0)¶
-
PROMOTION_ZONE
= ((56, 49, 42, 35, 36, 45, 54, 63), (0, 9, 18, 27, 28, 21, 14, 7))¶
-
cecp_name
= 'sittuyin'¶
-
name
= 'Sittuyin'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 32¶
-
variant_group
= 5¶
-
pychess.Variants.asymmetricrandom module¶
pychess.Variants.atomic module¶
-
class
pychess.Variants.atomic.
AtomicBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
cecp_name
= 'atomic'¶
-
name
= 'Atomic'¶
-
need_initial_board
= False¶
-
standard_rules
= False¶
-
variant
= 18¶
-
variant_group
= 4¶
-
-
pychess.Variants.atomic.
cordsAround
(cord)¶
-
pychess.Variants.atomic.
kingExplode
(board, move, color)¶
-
pychess.Variants.atomic.
piecesAround
(board, cord)¶
pychess.Variants.blindfold module¶
-
class
pychess.Variants.blindfold.
AllWhiteBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
cecp_name
= 'normal'¶
-
name
= 'All white'¶
-
need_initial_board
= False¶
-
standard_rules
= True¶
-
variant
= 17¶
-
variant_group
= 0¶
-
-
class
pychess.Variants.blindfold.
BlindfoldBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
cecp_name
= 'normal'¶
-
name
= 'Blindfold'¶
-
need_initial_board
= False¶
-
standard_rules
= True¶
-
variant
= 14¶
-
variant_group
= 0¶
-
pychess.Variants.bughouse module¶
pychess.Variants.corner module¶
pychess.Variants.crazyhouse module¶
pychess.Variants.euroshogi module¶
-
class
pychess.Variants.euroshogi.
EuroShogiBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
PROMOTION_ZONE
= ((56, 57, 58, 59, 60, 61, 62, 63, 48, 49, 50, 51, 52, 53, 54, 55, 40, 41, 42, 43, 44, 45, 46, 47), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23))¶
-
cecp_name
= 'euroshogi'¶
-
name
= 'EuroShogi'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 35¶
-
variant_group
= 4¶
-
pychess.Variants.fischerandom module¶
-
class
pychess.Variants.fischerandom.
FischerandomBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
shuffle_start
()¶ Create a random initial position. The king is placed somewhere between the two rooks. The bishops are placed on opposite-colored squares.
-
cecp_name
= 'fischerandom'¶
-
name
= 'Fischer Random'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 3¶
-
variant_group
= 2¶
-
pychess.Variants.giveaway module¶
Giveaway Variant
-
class
pychess.Variants.giveaway.
GiveawayBoard
(setup=False, lboard=None)¶ Bases:
pychess.Variants.suicide.SuicideBoard
Description: This is the international version of Losing chess used on ICC as Giveaway and on Lichess as Antichess You must capture if you can, and the object is to lose all your pieces or to have no moves left. But in Giveaway, the king is just like any other piece. It can move into check and be captured, and you can even promote pawns to kings.
-
cecp_name
= 'giveaway'¶
-
name
= 'Giveaway'¶
-
variant
= 23¶
-
pychess.Variants.horde module¶
Horde Variant
-
class
pychess.Variants.horde.
HordeBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: Lichess horde: https://lichess.org/variant/horde -
FILES
= 8¶
-
HOLDING_FILES
= ((11, 10, 9), (-6, -5, -4, -3, -2))¶
-
cecp_name
= 'horde'¶
-
name
= 'Horde'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 28¶
-
variant_group
= 4¶
-
pychess.Variants.kingofthehill module¶
The King of the Hill Variation
-
class
pychess.Variants.kingofthehill.
KingOfTheHillBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: The King of the hill variation is where the object of the game is to try and manoeuvre to the centre of the board. The gmae is won when one player manages to get there king to any of the 4 centre square ie d4, d5, e4, e5
-
cecp_name
= 'kingofthehill'¶
-
name
= 'King of the hill'¶
-
need_initial_board
= False¶
-
standard_rules
= False¶
-
variant
= 26¶
-
variant_group
= 4¶
-
-
pychess.Variants.kingofthehill.
testKingInCenter
(board)¶ Test for a winning position
pychess.Variants.knightodds module¶
Knightodds variant
-
class
pychess.Variants.knightodds.
KnightOddsBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: Knight Odds variant plays with the same rules as normal chess but one side start the game with a knight missing
-
cecp_name
= 'normal'¶
-
name
= 'Knight odds'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 11¶
-
variant_group
= 1¶
-
pychess.Variants.losers module¶
Losers Variant
-
class
pychess.Variants.losers.
LosersBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: The Losers variant is a game where the concept is to get rid of all your pieces before you opponent does. On a players turn if a piece can be taken it must be taken otherwise a normal chess move can be played
-
cecp_name
= 'losers'¶
-
name
= 'Losers'¶
-
need_initial_board
= False¶
-
standard_rules
= False¶
-
variant
= 21¶
-
variant_group
= 4¶
-
-
pychess.Variants.losers.
testKingOnly
(board)¶ Checks to see if if a winning position has been acheived
pychess.Variants.normal module¶
Standard Chess game
pychess.Variants.pawnodds module¶
Pawn Odds Variant
-
class
pychess.Variants.pawnodds.
PawnOddsBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: A standard chess game where one side starts with one less pawn, this is known as giving pawn odds
-
cecp_name
= 'normal'¶
-
name
= 'Pawn odds'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 10¶
-
variant_group
= 1¶
-
pychess.Variants.pawnspassed module¶
Pawns Passed Chess
-
class
pychess.Variants.pawnspassed.
PawnsPassedBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: Standard chess game rules, but where the board setup is defined as all the white pawns start on the 5th rank and all the black pawns start on the 4th rank
-
cecp_name
= 'normal'¶
-
name
= 'Pawns Passed'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 8¶
-
variant_group
= 3¶
-
pychess.Variants.pawnspushed module¶
Pawns Pushed Chess
-
class
pychess.Variants.pawnspushed.
PawnsPushedBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: Standard chess rules but the start setup position is all the white pawns start on the 4th rank and all the black pawns start on the 5th rank
-
cecp_name
= 'normal'¶
-
name
= 'Pawns Pushed'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 7¶
-
variant_group
= 3¶
-
pychess.Variants.queenodds module¶
Queen Odds Variant
-
class
pychess.Variants.queenodds.
QueenOddsBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: Standard chess rules but one side starts without a queen -
cecp_name
= 'normal'¶
-
name
= 'Queen odds'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 13¶
-
variant_group
= 1¶
-
pychess.Variants.racingkings module¶
The Racing Kings Variation
-
class
pychess.Variants.racingkings.
RacingKingsBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: The Racing Kings variation is where the object of the game is to bring your king to the eight row.
-
cecp_name
= 'racingkings'¶
-
name
= 'Racing Kings'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 29¶
-
variant_group
= 4¶
-
-
pychess.Variants.racingkings.
test2KingInEightRow
(board)¶ Test for a winning position
-
pychess.Variants.racingkings.
testKingInEightRow
(board)¶ Test for a winning position
pychess.Variants.randomchess module¶
Random Chess
-
class
pychess.Variants.randomchess.
RandomBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: - Randomly chosen pieces (two queens or three rooks possible)
- Exactly one king of each color
- Pieces placed randomly behind the pawns
- No castling
- Black’s arrangement mirrors white’s
-
random_start
()¶
-
cecp_name
= 'wild/3'¶
-
name
= 'Random'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 4¶
-
variant_group
= 2¶
pychess.Variants.rookodds module¶
Rook Odds Variant
-
class
pychess.Variants.rookodds.
RookOddsBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: Standard chess rules apply, but one side starts with one less rook -
cecp_name
= 'normal'¶
-
name
= 'Rook odds'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 12¶
-
variant_group
= 1¶
-
pychess.Variants.setupposition module¶
-
class
pychess.Variants.setupposition.
SetupBoard
(setup=True, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
as_fen
(variant)¶
-
move
(move, color)¶ Creates a new Board object cloning itself then applying the move.move to the clone Board’s lboard. If lboard param was given, it will be used when cloning, and move will not be applyed, just the high level Piece objects will be adjusted.
-
simulateMove
(board, move)¶
-
PROMOTIONS
= ()¶
-
PROMOTION_ZONE
= ((), ())¶
-
cecp_name
= ''¶
-
name
= ''¶
-
ply
¶
-
standard_rules
= False¶
-
variant
= 36¶
-
variant_group
= 3¶
-
pychess.Variants.shuffle module¶
Shuffle Variant
-
class
pychess.Variants.shuffle.
ShuffleBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: The shuffle variant uses the standard chess rules with the exception no castling is allowed and the back rank is shuffled around
-
shuffle_start
()¶
-
cecp_name
= 'nocastle'¶
-
name
= 'Shuffle'¶
-
need_initial_board
= True¶
-
standard_rules
= True¶
-
variant
= 2¶
-
variant_group
= 2¶
-
pychess.Variants.suicide module¶
Suicide Variation
-
class
pychess.Variants.suicide.
SuicideBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
Description: This is the FICS version of Losing chess used on FICS as suicide chess. You must capture if you can, and the object is to lose all your pieces or to have no moves left. But in Suicide, the king is just like any other piece. It can move into check and be captured, and you can even promote pawns to kings.
-
PROMOTIONS
= (8, 7, 6, 5, 4)¶
-
cecp_name
= 'suicide'¶
-
name
= 'Suicide'¶
-
need_initial_board
= True¶
-
standard_rules
= False¶
-
variant
= 22¶
-
variant_group
= 4¶
-
-
pychess.Variants.suicide.
pieceCount
(board, color)¶
pychess.Variants.theban module¶
Theban Chess Variant
pychess.Variants.threecheck module¶
Three-check Chess Variant
-
class
pychess.Variants.threecheck.
ThreeCheckBoard
(setup=False, lboard=None)¶ Bases:
pychess.Utils.Board.Board
-
cecp_name
= '3check'¶
-
name
= 'Three-check'¶
-
need_initial_board
= False¶
-
standard_rules
= False¶
-
variant
= 27¶
-
variant_group
= 4¶
-
-
pychess.Variants.threecheck.
checkCount
(board, color)¶
pychess.Variants.upsidedown module¶
Upside-down Chess variant
pychess.Variants.wildcastle module¶
Wildcastle Chess variant
pychess.Variants.wildcastleshuffle module¶
Wildcastle shuffle Chess
Module contents¶
pychess.gfx package¶
Submodules¶
pychess.gfx.Pieces module¶
-
pychess.gfx.Pieces.
drawPiece
(piece, context, x, y, psize, allwhite=False, asean=False, variant=None)¶ Rendering pieces using .svg chess figurines
-
pychess.gfx.Pieces.
drawPiece3
(piece, context, x, y, psize, allwhite=False, asean=False, variant=None)¶ Rendering pieces using .svg chess figurines
-
pychess.gfx.Pieces.
drawPiece4
(piece, context, x, y, psize, allwhite=False, asean=False, variant=None)¶ Rendering pieces using .ttf chessfont figurines
-
pychess.gfx.Pieces.
get_chess_font_face
(name)¶ Set chess font and char mapping for a chess .ttf
-
pychess.gfx.Pieces.
get_svg_pieces
(svgdir)¶ Load figurines from .svg files
-
pychess.gfx.Pieces.
set_piece_theme
(piece_set)¶
Module contents¶
pychess.ic package¶
Subpackages¶
-
class
pychess.ic.managers.ChatManager.
ChatManager
(connection)¶ Bases:
GObject
-
convTime
(h, m, s)¶
-
entityDecode
(text)¶
-
entityEncode
(text)¶
-
getChannelLog
(channel, minutes=30)¶ Channel can be channel_id, shout or c-shout
-
getChannelPlayers
(matchlist)¶
-
getChannels
()¶
-
getJoinedChannels
()¶
-
getNoChannelPlayers
(match)¶
-
getPeopleInChannel
(channel)¶
-
getPlayersChannels
(player)¶
-
get_allob_list
(match)¶ - Description: Processes the returning pattern matched of the FICS allob command
- extracts out the gameno and a list of observers before emmiting them for collection by the observers view
match: (re.reg-ex) is the complied matching pattern for processing
-
gotPlayerChannels
(matchlist)¶
-
joinChannel
(channel)¶
-
mayTellChannel
(channel)¶
-
onAnnouncement
(match)¶
-
onArrivalNotification
(match)¶
-
onChannelList
(matchlist)¶
-
onChannelLogBreak
(match)¶
-
onChannelLogLine
(match)¶
-
onChannelLogStart
(match)¶
-
onChannelMessage
(match)¶
-
onDepartedNotification
(match)¶
-
onKibitzMessage
(match)¶
-
onPrivateMessage
(match)¶
-
onShoutMessage
(match)¶
-
onWhisperMessage
(match)¶
-
on_allob_no
(match)¶
-
removeChannel
(channel)¶
-
tellAll
(message)¶
-
tellBughousePartner
(message)¶
-
tellChannel
(channel, message)¶
-
tellGame
(gameno, message)¶
-
tellOpponent
(message)¶
-
tellPlayer
(player, message)¶
-
tellUser
(player, message)¶
-
toldChannel
(match)¶
-
whisper
(message)¶
-
channelListItem
= re.compile('((?:\\d+,?)+)\\s*(.*)')¶
-
entityExpr
= re.compile('&#x([a-f0-9]+);')¶
-
-
class
pychess.ic.managers.FingerManager.
FingerManager
(connection)¶ Bases:
GObject
-
finger
(user)¶
-
onFinger
(matchlist)¶
-
onRatingAdjust
(match)¶
-
parseDate
(date)¶
-
parseShortDate
(date)¶
-
parseTime
(time)¶
-
setBusyMessage
(message)¶ Like set busy is really busy right now.
-
setFingerNote
(note, message)¶
-
-
class
pychess.ic.managers.FingerManager.
FingerObject
(name='')¶ Bases:
object
-
getAdminLevel
()¶ Returns the admin level as a string Only set for admins.
-
getBusyMessage
()¶ Returns the userset idle message This is set when status == STATUS_BUSY or sometimes when status == STATUS_PLAYING
-
getColor
()¶ If status == STATUS_PLAYING getColor returns the color witch the player has got in the game. Otherwise always WHITE is returned
-
getCreated
()¶ Returns when the account was created
-
getEmail
()¶ Returns the email adress of the user. This will probably only be set for the logged in user
-
getGameno
()¶ Returns the gameno of the game in which user is currently playing This is only set when status == STATUS_PLAYING
-
getIdleTime
()¶ Returns the when the last time the user did something active Not set when status == STATUS_OFFLINE
-
getLastSeen
()¶ Returns when the user logged off This is only set when status == STATUS_OFFLINE This is not set, if the user has never logged on
-
getName
()¶ Returns the name of the user, without any title sufixes
-
getNotes
()¶ Returns a list of the ten finger notes
-
getOpponent
()¶ Returns the opponent of the user in his current game This is only set when status == STATUS_PLAYING
-
getRating
(type=None)¶
-
getRatings
()¶
-
getRatingsLen
()¶
-
getSanctions
()¶ Returns any sanctions the user has against them. This is usually an empty string
-
getSilence
()¶ Return True if the user is playing in silence This is only set when status == STATUS_PLAYING
-
getStatus
()¶ Returns the current user-status as a STATUS constant
-
getTimeseal
()¶ Returns True if the user is using timeseal for fics connection
-
getTitles
()¶
-
getTotalTimeOnline
()¶ Returns how many seconds the user has been on FICS since the account was created. This is not set, if the user has never logged on
-
getUpTime
()¶ Returns the when the user logged on Not set when status == STATUS_OFFLINE
-
setAdminLevel
(value)¶
-
setBusyMessage
(value)¶ Use relative seconds
-
setColor
(value)¶
-
setCreated
(value)¶ Use relative seconds
-
setEmail
(value)¶
-
setGameno
(value)¶
-
setIdleTime
(value)¶ Use relative seconds
-
setLastSeen
(value)¶ Use relative seconds
-
setName
(value)¶
-
setNote
(index, note)¶
-
setOpponent
(value)¶
-
setRating
(rating_type, rating_line)¶
-
setSanctions
(value)¶
-
setSilence
(value)¶
-
setStatus
(value)¶
-
setTimeseal
(value)¶
-
setTitles
(titles)¶
-
setTotalTimeOnline
(value)¶ Use relative seconds
-
setUpTime
(value)¶ Use relative seconds
-
-
class
pychess.ic.managers.ListAndVarManager.
ListAndVarManager
(connection)¶ Bases:
object
-
addToList
(list_name, value)¶
-
autoFlagNotify
(*args)¶
-
getList
(list_name)¶
-
onUpdateEmptyListitems
(match)¶
-
onUpdateList
(match)¶
-
onUpdateListitems
(matchlist)¶
-
onUpdateLists
(matchlist)¶
-
removeFromList
(list_name, value)¶
-
-
class
pychess.ic.managers.OfferManager.
OfferManager
(connection)¶ Bases:
GObject
-
accept
(offer)¶
-
acceptIndex
(index)¶
-
challenge
(player_name, game_type, startmin, incsec, rated, color=None)¶
-
decline
(offer)¶
-
declineIndex
(index)¶
-
noOffersToAccept
(match)¶
-
notEnoughMovesToUndo
(match)¶
-
offer
(offer)¶
-
onOfferAdd
(match)¶
-
onOfferDeclined
(match)¶
-
onOfferRemove
(match)¶
-
playIndex
(index)¶
-
withdraw
(offer)¶
-
-
class
pychess.ic.managers.SeekManager.
SeekManager
(connection)¶ Bases:
GObject
-
assess
(player1, player2, type)¶
-
on_assess
(matchlist)¶
-
on_our_seeks_removed
(matchlist)¶
-
on_seek_add
(match)¶
-
on_seek_clear
(*args)¶
-
on_seek_remove
(match)¶
-
on_seek_updated
(matchlist)¶
-
refresh_seeks
()¶
-
seek
(startmin, incsec, game_type, rated, ratings=(0, 9999), color=None, manual=False)¶
-
-
class
pychess.ic.managers.ICCAutoLogOutManager.
ICCAutoLogOutManager
(connection)¶ Bases:
pychess.ic.managers.AutoLogOutManager.AutoLogOutManager
-
class
pychess.ic.managers.ICCErrorManager.
ICCErrorManager
(connection)¶ Bases:
pychess.ic.managers.ErrorManager.ErrorManager
-
on_icc_illegal_move
(data)¶
-
-
class
pychess.ic.managers.ICCFingerManager.
ICCFingerManager
(connection)¶ Bases:
pychess.ic.managers.FingerManager.FingerManager
-
finger
(user)¶
-
on_icc_who_am_i
(data)¶
-
on_icc_yfinger
(data)¶
-
-
class
pychess.ic.managers.ICCListAndVarManager.
ICCListAndVarManager
(connection)¶ Bases:
pychess.ic.managers.ListAndVarManager.ListAndVarManager
-
autoFlagNotify
(*args)¶
-
-
class
pychess.ic.managers.ICCNewsManager.
ICCNewsManager
(connection)¶
-
class
pychess.ic.managers.ICCSeekManager.
ICCSeekManager
(connection)¶ Bases:
pychess.ic.managers.SeekManager.SeekManager
-
on_icc_seek_add
(data)¶
-
on_icc_seek_removed
(data)¶
-
Submodules¶
pychess.ic.FICSConnection module¶
pychess.ic.FICSObjects module¶
-
class
pychess.ic.FICSObjects.
FICSAdjournedGame
(wplayer, bplayer, our_color=None, length=None, time=None, rated=False, game_type=None, private=False, minutes=None, inc=None, result=7, reason=None, board=None, relation=None, gameno=None)¶ Bases:
pychess.ic.FICSObjects.FICSGame
-
display_time
¶
-
opponent
¶
-
-
class
pychess.ic.FICSObjects.
FICSChallenge
(index, player, minutes, inc, rated, color, game_type, adjourned=False)¶
-
class
pychess.ic.FICSObjects.
FICSChallenges
(connection)¶ Bases:
GObject
-
clear
()¶
-
onChallengeIssued
(om, challenge)¶
-
onChallengeRemoved
(om, index)¶
-
onPlayingGame
(bm, game)¶
-
start
()¶
-
-
class
pychess.ic.FICSObjects.
FICSGame
(wplayer, bplayer, gameno=None, game_type=None, rated=False, minutes=None, inc=None, result=None, reason=None, board=None, private=False, relation=None)¶ Bases:
pychess.ic.FICSObjects.FICSMatch
-
get_private
()¶
-
set_private
(private)¶
-
update
(game)¶
-
display_text
¶
-
private
= <GObjectMock name='mock.property()' id='140293778564600'>¶
-
supported
¶
-
-
class
pychess.ic.FICSObjects.
FICSGames
(connection)¶ Bases:
GObject
-
game_ended
(game)¶
-
get
(game, create=True, emit=True)¶
-
get_game_by_gameno
(gameno)¶
-
items
()¶
-
keys
()¶
-
onAdjournmentsList
(adm, adjournments)¶
-
onCurGameEnded
(bm, game)¶
-
onHistoryList
(adm, history)¶
-
onJournalList
(adm, journal)¶
-
start
()¶
-
values
()¶
-
-
class
pychess.ic.FICSObjects.
FICSHistoryGame
(wplayer, bplayer, time=None, rated=False, game_type=None, private=False, minutes=None, inc=None, result=None, reason=None, board=None, relation=None, wrating=None, brating=None, gameno=None, history_no=None)¶ Bases:
pychess.ic.FICSObjects.FICSGame
-
display_time
¶
-
-
class
pychess.ic.FICSObjects.
FICSJournalGame
(wplayer, bplayer, our_color=None, time=None, rated=False, game_type=None, private=False, minutes=None, inc=None, result=None, reason=None, board=None, relation=None, wrating=None, brating=None, gameno=None, journal_no=None)¶ Bases:
pychess.ic.FICSObjects.FICSGame
-
display_time
¶
-
-
class
pychess.ic.FICSObjects.
FICSMatch
(minutes, inc, rated, game_type)¶ Bases:
GObject
-
display_rated
¶
-
display_timecontrol
¶
-
sortable_time
¶
-
-
class
pychess.ic.FICSObjects.
FICSPlayer
(name, online=False, status=10, game=None, titles=None)¶ Bases:
GObject
-
display_titles
(long=False)¶
-
getIcon
(size=16, gametype=None)¶
-
classmethod
getIconByRating
(rating, size=16)¶
-
getMarkup
(gametype=None, big=True, long_titles=True)¶
-
getRatingByGameType
(game_type)¶
-
getRatingForCurrentGame
()¶
-
getRatingMean
()¶
-
getStrength
()¶
-
get_game
()¶
-
get_online
()¶
-
get_status
()¶
-
get_titles
()¶
-
isAdmin
()¶
-
isAvailableForGame
()¶
-
isComputer
()¶
-
isGuest
()¶
-
isObservable
()¶
-
isTitled
()¶
-
long_name
(game_type=None)¶
-
restore_previous_status
()¶
-
set_game
(game)¶
-
set_online
(online)¶
-
set_status
(status)¶
-
set_titles
(titles)¶
-
atomic
¶
-
blitz
¶
-
bughouse
¶
-
crazyhouse
¶
-
display_online
¶
-
display_status
¶
-
game
= <GObjectMock name='mock.property()' id='140293778564600'>¶
-
lightning
¶
-
losers
¶
-
online
= <GObjectMock name='mock.property()' id='140293778564600'>¶
-
standard
¶
-
status
= <GObjectMock name='mock.property()' id='140293778564600'>¶
-
suicide
¶
-
titles
= <GObjectMock name='mock.property()' id='140293778564600'>¶
-
wild
¶
-
-
class
pychess.ic.FICSObjects.
FICSPlayers
(connection)¶ Bases:
GObject
-
get
(name)¶
-
get_online_playernames
()¶
-
items
()¶
-
keys
()¶
-
online_changed
(player, prop)¶
-
player_disconnected
(name)¶
-
start
()¶
-
values
()¶
-
-
class
pychess.ic.FICSObjects.
FICSSeek
(index, player, minutes, inc, rated, color, game_type, rmin=0, rmax=9999, automatic=True, formula=False)¶
-
class
pychess.ic.FICSObjects.
FICSSeeks
(connection)¶ Bases:
GObject
-
clear
()¶
-
onAddSeek
(glm, seek)¶
-
onClearSeeks
(glm)¶
-
onCurGameEnded
(bm, game)¶
-
onRemoveSeek
(glm, index)¶
-
start
()¶
-
-
class
pychess.ic.FICSObjects.
FICSSoughtMatch
(index, player, minutes, inc, rated, color, game_type)¶ Bases:
pychess.ic.FICSObjects.FICSMatch
-
player_rating
¶ This returns self.player’s rating for the type of match being sought. If self.player doesn’t have a rating for the type of match being sought, this returns 0. If the match is untimed we use self.player’s standard time-control rating if they have one.
-
-
pychess.ic.FICSObjects.
get_challenge_tooltip_text
(challenge)¶
-
pychess.ic.FICSObjects.
get_player_tooltip_text
(player, show_status=True)¶
-
pychess.ic.FICSObjects.
get_rating_range_display_text
(rmin=0, rmax=9999)¶
-
pychess.ic.FICSObjects.
get_seek_tooltip_text
(seek)¶
-
pychess.ic.FICSObjects.
get_soughtmatch_tooltip_text
(sought)¶
-
pychess.ic.FICSObjects.
make_sensitive_if_available
(button, player)¶
-
pychess.ic.FICSObjects.
make_sensitive_if_playing
(button, player)¶
-
pychess.ic.FICSObjects.
player_id
(name)¶ Two players are equal if the first 11 characters of their name match. This is to facilitate matching players from output of commands like the ‘games’ command which only return the first 11 characters of a player’s name
pychess.ic.ICGameModel module¶
-
class
pychess.ic.ICGameModel.
ICGameModel
(connection, ficsgame, timemodel)¶ Bases:
pychess.Utils.GameModel.GameModel
-
acceptReceived
(player, offer)¶
-
backToMainLine
()¶
-
checkStatus
()¶ Updates self.status so it fits with what getStatus(boards[-1]) would return. That is, if the game is e.g. check mated this will call mode.end(), or if moves have been undone from an otherwise ended position, this will call __resume and emit game_unended.
-
end
(status, reason)¶
-
ficsplayer
(player)¶
-
goFirst
()¶
-
goLast
()¶
-
goNext
(step=1)¶
-
goPrev
(step=1)¶
-
hasGuestPlayers
()¶
-
offerReceived
(player, offer)¶
-
onActionError
(om, offer, error)¶
-
onBoardSetup
(bm, gameno, fen, wname, bname)¶
-
onDisconnected
(connection)¶
-
onExGameReset
(bm, ficsgame)¶
-
onGameEnded
(bm, ficsgame)¶
-
onGamePaused
(bm, gameno, paused)¶
-
onGameUndoing
(bm, gameno, ply)¶
-
onKibitzMessage
(cm, name, gameno, text)¶
-
onMadeExamined
(bm, gameno)¶
-
onMadeUnExamined
(bm, gameno)¶
-
onObserversReceived
(other, gameno, observers)¶
-
onTimesUpdate
(bm, gameno, wms, bms)¶
-
onWhisperMessage
(cm, name, gameno, text)¶
-
setPlayers
(players)¶
-
terminate
()¶
-
update_board
(gameno, ply, curcol, lastmove, fen, wname, bname, wms, bms)¶
-
display_text
¶
-
noTD
¶
-
remote_ficsplayer
¶
-
remote_player
¶
-
pychess.ic.ICLogon module¶
pychess.ic.TimeSeal module¶
-
class
pychess.ic.TimeSeal.
ICSStreamReader
(limit, loop, connected_event, name)¶ Bases:
asyncio.streams.StreamReader
-
read_until
(*untils)¶
-
-
class
pychess.ic.TimeSeal.
ICSStreamReaderProtocol
(stream_reader, client_connected_cb, loop, name, timeseal)¶ Bases:
asyncio.streams.StreamReaderProtocol
-
cook_some
(data)¶
-
data_received
(data)¶ Called when some data is received.
The argument is a bytes object.
-
decode
(buf, stateinfo=None)¶
-
encode
(inbuf, timestamp=None)¶
-
-
class
pychess.ic.TimeSeal.
ICSTelnet
(timeseal)¶ Bases:
object
-
cancel
()¶
-
close
()¶
-
get_init_string
()¶ timeseal header: TIMESTAMP|bruce|Linux gruber 2.6.15-gentoo-r1 #9 PREEMPT Thu Feb 9 20:09:47 GMT 2006 i686 Intel(R) Celeron(R) CPU 2.00GHz GenuineIntel GNU/Linux| 93049
-
read_until
(*untils)¶
-
readline
()¶
-
readuntil
(until)¶
-
start
(host, port, connected_event)¶
-
write
(string)¶
-
sensitive
= False¶
-
pychess.ic.VerboseTelnet module¶
-
class
pychess.ic.VerboseTelnet.
FromABPlusPrediction
(callback, regexp0, regexp1, regexp2)¶ Bases:
pychess.ic.VerboseTelnet.MultipleLinesPrediction
-
handle
(line)¶
-
-
class
pychess.ic.VerboseTelnet.
FromPlusPrediction
(callback, regexp0, regexp1)¶ Bases:
pychess.ic.VerboseTelnet.MultipleLinesPrediction
-
handle
(line)¶
-
-
class
pychess.ic.VerboseTelnet.
FromToPrediction
(callback, regexp0, regexp1)¶ Bases:
pychess.ic.VerboseTelnet.MultipleLinesPrediction
-
handle
(line)¶
-
-
class
pychess.ic.VerboseTelnet.
LinePrediction
(callback, regexp)¶ Bases:
pychess.ic.VerboseTelnet.Prediction
-
handle
(line)¶
-
-
class
pychess.ic.VerboseTelnet.
MultipleLinesPrediction
(callback, *regexps)¶
-
class
pychess.ic.VerboseTelnet.
NLinesPrediction
(callback, *regexps)¶ Bases:
pychess.ic.VerboseTelnet.MultipleLinesPrediction
-
handle
(line)¶
-
-
class
pychess.ic.VerboseTelnet.
PredictionsTelnet
(telnet, predictions, reply_cmd_dict, replay_dg_dict, replay_cn_dict)¶ Bases:
object
-
cancel
()¶
-
close
()¶
-
parse
()¶
-
run_command
(text, show_reply=False)¶
-
test_prediction
(prediction, line)¶
-
Module contents¶
-
class
pychess.ic.
GameType
(fics_name, short_fics_name, rating_type, display_text=None, variant_type=0)¶ Bases:
object
-
variant
¶
-
-
class
pychess.ic.
NormalGameType
(fics_name, short_fics_name, rating_type, display_text)¶ Bases:
pychess.ic.GameType
-
class
pychess.ic.
VariantGameType
(fics_name, short_fics_name, rating_type, variant_type)¶ Bases:
pychess.ic.GameType
-
display_text
¶
-
seek_text
¶
-
-
class
pychess.ic.
WildGameType
(fics_name, variant_type)¶ Bases:
pychess.ic.VariantGameType
-
classmethod
instances
()¶
-
classmethod
-
pychess.ic.
get_infobarmessage_content
(player, text, gametype=None)¶
-
pychess.ic.
get_infobarmessage_content2
(player, heading_text, message_text, gametype=None)¶
-
pychess.ic.
parseRating
(rating)¶
-
pychess.ic.
parse_title_hex
(titlehex)¶
-
pychess.ic.
time_control_to_gametype
(minutes, gain)¶
-
pychess.ic.
type_to_display_text
(typename)¶
pychess.perspectives package¶
Subpackages¶
Module contents¶
-
class
pychess.perspectives.
Perspective
(name, label)¶ Bases:
object
-
activate_panel
(name)¶
-
close
()¶
-
load_from_xml
()¶
-
on_clicked
(button, panel)¶ Toggle show/hide side panel menu item in View menu
-
on_toggled
(menu_item, panel)¶ Show/Hide side panel
-
sensitive
¶
-
-
class
pychess.perspectives.
PerspectiveManager
¶ Bases:
object
-
activate_perspective
(name)¶
-
add_perspective
(perspective)¶
-
disable_perspective
(name)¶
-
get_perspective
(name)¶
-
on_persp_toggled
(button)¶
-
set_perspective_widget
(name, widget)¶
-
set_widgets
(widgets)¶
-
-
pychess.perspectives.
panel_name
(module_name)¶
pychess.widgets package¶
Subpackages¶
-
class
pychess.widgets.pydock.PyDockComposite.
PyDockComposite
(position, perspective)¶ Bases:
Alignment
-
changeComponent
(old, new)¶
-
dock
(widget, position, title, id)¶
-
getComponents
()¶
-
getPosition
()¶ Returns NORTH or SOUTH if the children are packed vertically. Returns WEST or EAST if the children are packed horizontally. Returns CENTER if there is only one child
-
initChildren
(old, new, preserve_dimensions=False)¶
-
removeComponent
(component)¶
-
-
class
pychess.widgets.pydock.PyDockLeaf.
PyDockLeaf
(widget, title, id, perspective)¶ Bases:
pychess.widgets.pydock.__init__.TabReceiver
-
dock
(widget, position, title, id)¶ if position == CENTER: Add a new widget to the leaf-notebook if position != CENTER: Fork this leaf into two
-
getCurrentPanel
()¶
-
getPanels
()¶ Returns a list of (widget, title, id) tuples
-
hideArrows
()¶
-
isDockable
()¶
-
setCurrentPanel
(id)¶ Returns the panel id currently shown
-
setDockable
(dockable)¶ If the leaf is not dockable it won’t be moveable and won’t accept new panels
-
showArrows
()¶
-
undock
(widget)¶ remove the widget from the leaf-notebook if this was the only widget, remove this leaf from its owner
-
zoomDown
()¶
-
zoomUp
()¶
-
-
class
pychess.widgets.pydock.PyDockTop.
PyDockTop
(id, perspective)¶ Bases:
pychess.widgets.pydock.PyDockComposite.PyDockComposite
,pychess.widgets.pydock.__init__.TabReceiver
-
addComponent
(widget)¶
-
changeComponent
(old, new)¶
-
clear
()¶
-
dock
(widget, position, title, id)¶
-
getComponents
()¶
-
getPosition
()¶ Returns NORTH or SOUTH if the children are packed vertically. Returns WEST or EAST if the children are packed horizontally. Returns CENTER if there is only one child
-
hideArrows
()¶
-
loadFromXML
(xmlpath, idToWidget)¶ idTowidget is a dictionary {id: (widget,title)} asserts that self.id is in the xmlfile
-
old2new
(name)¶ After 0.99.0 database perspective panel names changed
-
removeComponent
(widget)¶
-
saveToXML
(xmlpath)¶ - <docks>
- <dock id=”x”>
- <v pos=”200”>
- <leaf current=”x” dockable=”False”>
- <panel id=”x” />
</leaf> <h pos=”200”>
- <leaf current=”y” dockable=”True”>
- <panel id=”y” /> <panel id=”z” />
</leaf> <leaf current=”y” dockable=”True”>
<panel id=”y” /></leaf>
</h>
</v>
</dock>
</docks>
-
showArrows
()¶
-
Submodules¶
pychess.widgets.Background module¶
Sets the application background image
-
pychess.widgets.Background.
expose
(widget, context)¶
-
pychess.widgets.Background.
giveBackground
(widget)¶
-
pychess.widgets.Background.
hexcol
(color)¶ Description : Takes a colour tuple(rgb) and returns a hex based string #rrggbb Returns : (str)
-
pychess.widgets.Background.
isDarkTheme
(widget)¶
-
pychess.widgets.Background.
newTheme
(widget, background=None)¶
pychess.widgets.BoardControl module¶
pychess.widgets.BoardView module¶
pychess.widgets.BorderBox module¶
pychess.widgets.ChainVBox module¶
pychess.widgets.ChannelsPanel module¶
pychess.widgets.ChatView module¶
pychess.widgets.ChessClock module¶
pychess.widgets.ExternalsDialog module¶
pychess.widgets.InfoBar module¶
-
class
pychess.widgets.InfoBar.
InfoBarMessageButton
(text, response_id, sensitive=True, tooltip_text='')¶ Bases:
GObject
-
get_sensitive
()¶
-
get_tooltip_text
()¶
-
set_sensitive
(sensitive)¶
-
set_tooltip_text
(tooltip_text)¶
-
sensitive
= <GObjectMock name='mock.property()' id='140293785090256'>¶
-
tooltip_text
= <GObjectMock name='mock.property()' id='140293785090256'>¶
-
-
class
pychess.widgets.InfoBar.
InfoBarNotebook
(name=None)¶ Bases:
Notebook
This is a
Gtk.Notebook
which manages InfoBarMessage objects pushed onto it via push_message() like a stack. If/when the current message at the top of the stack is responded to or dismissed by the user, the next message in the stack waiting for a response is displayed. Messages that aren’t applicable anymore can be removed from anywhere in the InfoBar message stack by calling message.dismiss()-
clear_messages
()¶
-
customGetTabLabelText
(child)¶
-
push_message
(message)¶
-
-
pychess.widgets.InfoBar.
get_message_content
(heading_text, message_text, image_stock_id)¶
pychess.widgets.InfoPanel module¶
pychess.widgets.LearnInfoBar module¶
pychess.widgets.MenuItemsDict module¶
-
class
pychess.widgets.MenuItemsDict.
GtkMenuItem
(name, sensitive=False, label=None, tooltip=None)¶ Bases:
object
-
update
()¶
-
label
¶
-
sensitive
¶
-
tooltip
¶
-
-
class
pychess.widgets.MenuItemsDict.
GtkMenuToggleButton
(name, sensitive=False, active=False, label=None)¶ Bases:
pychess.widgets.MenuItemsDict.GtkMenuItem
-
update
()¶
-
active
¶
-
-
class
pychess.widgets.MenuItemsDict.
MenuItemsDict
¶ Bases:
dict
Description: Keeps track of menubar menuitem widgets that need to be managed on a game by game basis. Each menuitem writes through its respective widget state to the GUI if we are encapsulated in the gamewidget that’s focused/infront
-
ANAL_MENU_ITEMS
= ('analyze_game1', 'analyzer_check', 'inv_analyzer_check', 'ana_combobox', 'inv_ana_combobox')¶
-
VIEW_MENU_ITEMS
= ('hint_mode', 'spy_mode')¶
-
pychess.widgets.PieceWidget module¶
pychess.widgets.PromotionDialog module¶
pychess.widgets.RecentChooser module¶
pychess.widgets.TaskerManager module¶
pychess.widgets.ViewsPanel module¶
pychess.widgets.WebKitBrowser module¶
-
class
pychess.widgets.WebKitBrowser.
WebKitBrowser
(url)¶ Bases:
object
-
change_title
(widget, data, arg)¶
-
go
(widget)¶
-
go_back
(widget)¶
-
go_forward
(widget)¶
-
refresh
(widget)¶
-
search
(widget)¶
-
-
pychess.widgets.WebKitBrowser.
open_link
(label, url)¶ Gtk.Label() can use this like label.connect(“activate-link”, open_link)
pychess.widgets.analyzegameDialog module¶
pychess.widgets.discovererDialog module¶
pychess.widgets.enginesDialog module¶
pychess.widgets.gameinfoDialog module¶
-
pychess.widgets.gameinfoDialog.
initialize
(widgets)¶
-
pychess.widgets.gameinfoDialog.
on_pick_date
(button, date_entry)¶
-
pychess.widgets.gameinfoDialog.
refresh_elo_rating_change
(widgets)¶
-
pychess.widgets.gameinfoDialog.
run
(widgets)¶
pychess.widgets.gamenanny module¶
pychess.widgets.gamewidget module¶
pychess.widgets.newGameDialog module¶
pychess.widgets.playerinfoDialog module¶
pychess.widgets.preferencesDialog module¶
pychess.widgets.tipOfTheDay module¶
Module contents¶
-
pychess.widgets.
createAlignment
(top, right, bottom, left)¶
-
pychess.widgets.
createImage
(pixbuf)¶
-
pychess.widgets.
dock_panel_tab
(title, desc, icon, button=None)¶
-
pychess.widgets.
insert_formatted
(text_view, iter, text, tag=None)¶
-
pychess.widgets.
mainwindow
()¶
-
pychess.widgets.
new_notebook
(name=None)¶