Game Editor

The game editor is based on Qt’s QTreeWidget.

Game Editor Since Qt’s QTreeWidget does not fit the tree representing the Portable Game Notation (PGN), i.e.

  • n variations per move supported

  • the main (first) variation is privileged.

This behavior is implemented using 2 types of lines:

  • regular moves where all columns have a white background

  • beginning of a variation marked with a green cross

The tree widget has 4 colums:

  1. Move shows the actual move or the beginning of a variation in SAN notation

  2. Ann shows the annotation, i.e. a symbolic move assessment

  3. Pos shows the position assessment

  4. Score shows the engine or material score [centipawn] of the last move, material score ending with M

  5. Comment shows either the move comment or starting comment of a variation

By clicking the annotation (Ann) and position assessment (Pos) fields, a popup dialog opens which allows to change the contents

class gametreeview.GameTreeView(parent=None)[source]

Game Editor object

__init__(parent=None) None[source]
setup(notifyGameNodeSelectedSignal: pyqtSignal | None, notifyGameNodeChangedSignal: pyqtSignal | None) None[source]

Set up of the game editor

Parameters:
  • notifyGameNodeSelectedSignal – signal to be emitted if a game node is selected

  • notifyGameNodeChangedSignal – signal to be emitted if the loaded game is changed

addVariant(gameNode: GameNode) None[source]

Adds a new variant, parent node must exist in the editor

Parameters:

gameNode – game node to be added (must not be main_variation !!)

addGameNodes(gameNode: GameNode, parentItem: QTreeWidgetItem | None = None) None[source]

Adds 1 or more nodes, parent node of first node must exist in the editor

Parameters:
  • gameNode – game node to be added (must be main_variation !!)

  • parentItem – parent item of the gameNode (used only for internal use)

setGameResult(result: str) None[source]

Sets the ‘Result’ header element

Parameters:

result – one out of 1-0, 0-1, 1/2-1/2, *

setGame(game: Game) None[source]

Clears the editor and sets new game

Parameters:

game – game to be set

selectNodeItem(gameNode: GameNode) None[source]

Selects a game node

Parameters:

gameNode – game node to be selected

selectSubnodeItem(gameNode: GameNode, next: bool = True)[source]

Selects the next or previous variant

Parameters:
  • gameNode – reference game node

  • next – if True select the next variant, else select previous variant