pychess.widgets package
Subpackages
- pychess.widgets.pydock package
- Submodules
- pychess.widgets.pydock.ArrowButton module
- pychess.widgets.pydock.HighlightArea module
- pychess.widgets.pydock.OverlayWindow module
- pychess.widgets.pydock.PyDockComposite module
- pychess.widgets.pydock.PyDockLeaf module
- pychess.widgets.pydock.PyDockTop module
- pychess.widgets.pydock.StarArrowButton module
- Module contents
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
- class pychess.widgets.BoardControl.ActiveState(board)
Bases:
BoardState
It is the human player’s turn and a piece is being dragged by the mouse.
- isSelectable(cord)
- motion(x_loc, y_loc)
- release(x_loc, y_loc)
- class pychess.widgets.BoardControl.BoardState(board)
Bases:
object
There are 6 total BoardStates: NormalState, ActiveState, SelectedState LockedNormalState, LockedActiveState, LockedSelectedState
The board state is Locked while it is the opponents turn. The board state is not Locked during your turn. (Locked states are not used when BoardControl setup_position is True.)
Normal/Locked State - No pieces or cords are selected Active State - A piece is currently being dragged by the mouse Selected State - A cord is currently selected
- getBoard()
- isSelectable(cord)
- leave(x_loc, y_loc)
- motion(x_loc, y_loc)
- point2Cord(x_loc, y_loc, color=None)
- press(x_loc, y_loc, button)
- release(x_loc, y_loc)
- transPoint(x_loc, y_loc)
- validate(cord0, cord1)
- class pychess.widgets.BoardControl.LockedActiveState(board)
Bases:
LockedBoardState
It is the opponent’s turn and a piece is being dragged by the mouse.
- isSelectable(cord)
- motion(x_loc, y_loc)
- release(x_loc, y_loc)
- class pychess.widgets.BoardControl.LockedBoardState(board)
Bases:
BoardState
Parent of LockedNormalState, LockedActiveState, LockedSelectedState
The board is in one of the three Locked states during the opponent’s turn.
- isAPotentiallyLegalNextMove(cord0, cord1)
Determines whether the given move is at all legally possible as the next move after the player who’s turn it is makes their move Note: This doesn’t always return the correct value, such as when BoardControl.setLocked() has been called and we’ve begun a drag, but view.shown and BoardControl.lockedPly haven’t been updated yet
- class pychess.widgets.BoardControl.LockedNormalState(board)
Bases:
LockedBoardState
It is the opponent’s turn and no piece or cord is selected.
- isSelectable(cord)
- press(x, y, button)
- class pychess.widgets.BoardControl.LockedSelectedState(board)
Bases:
LockedBoardState
It is the opponent’s turn and a cord is selected.
- isSelectable(cord)
- motion(x_loc, y_loc)
- press(x_loc, y_loc, button)
- class pychess.widgets.BoardControl.NormalState(board)
Bases:
BoardState
It is the human player’s turn and no pieces or cords are selected.
- isSelectable(cord)
- press(x_loc, y_loc, button)
- class pychess.widgets.BoardControl.SelectedState(board)
Bases:
BoardState
It is the human player’s turn and a cord is selected.
- isSelectable(cord)
- press(x_loc, y_loc, button)
pychess.widgets.BoardView module
- pychess.widgets.BoardView.contains(r_zero, r_one)
Takes two squares and determines if square one is contained within square zero Returns a boolean
- pychess.widgets.BoardView.intersects(r_zero, r_one)
Takes two square and determines if they have an Intersection Returns a boolean
- pychess.widgets.BoardView.join(r_zero, r_one)
Take(x, y, w, [h]) squares
- pychess.widgets.BoardView.matrixAround(rotated_matrix, anchor_x, anchor_y)
Description : Rotates a matrix through the hypotenuse so that the original matrix becomes the inverse matrix and the inverse matrix becomes matrix Returns a tuple representing the matrix and its inverse
- pychess.widgets.BoardView.rect(rectangle)
Takes a list of 3 variables x,y,height and generates a rectangle rectangle(list) : contains screen locations returns a Gdk.Rectangle
- pychess.widgets.BoardView.union(r_zero, r_one)
Takes 2 rectangles and returns a rectangle that represents the union of the two areas Returns a Gdk.Rectangle
pychess.widgets.BorderBox module
pychess.widgets.ChainVBox module
- class pychess.widgets.ChainVBox.ChainLine(position)
Bases:
Alignment
The ChainLine’s are the little right-angle lines above and below the chain button that visually connect the ChainButton to the widgets who’s values are “chained” together by the ChainButton being active
- draw(context)
- on_draw(widget, context)
- on_size_allocate(widget, requisition)
pychess.widgets.ChannelsPanel module
pychess.widgets.ChatView module
pychess.widgets.ChessClock module
pychess.widgets.ExternalsDialog module
pychess.widgets.ImageMenu module
- pychess.widgets.ImageMenu.switchWithImage(image, dialog)
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='140736151179600'>
- tooltip_text = <GObjectMock name='mock.property()' id='140736151179600'>
- 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()
- property label
- property sensitive
- property tooltip
- class pychess.widgets.MenuItemsDict.GtkMenuToggleButton(name, sensitive=False, active=False, label=None)
Bases:
GtkMenuItem
- update()
- property 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.SpotGraph module
- pychess.widgets.SpotGraph.ceil(f)
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)
- check_buttons(widget, data)
- 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
This module intends to work as glue between the gamemodel and the gamewidget taking care of stuff that is neither very offscreen nor very onscreen like bringing up dialogs and
- class pychess.widgets.gamenanny.GameNanny
Bases:
object
- engineDead(engine, gmwidg)
- game_ended(gamemodel, reason, gmwidg)
- nurseGame(gmwidg, gamemodel)
Call this function when gmwidget is just created
- offer_callback(player, offer, gamemodel, gmwidg)
- on_disconnected(fics_connection, gamewidget)
- on_game_started(gamemodel, gmwidg)
- on_game_terminated(gamemodel, gmwidg)
- on_gmwidg_closed(gmwidg)
- on_gmwidg_title_changed(gmwidg, new_title)
pychess.widgets.gamewidget module
This module handles the tabbed layout in PyChess
- class pychess.widgets.gamewidget.GameWidget(gamemodel, perspective)
Bases:
GObject
- analyzer_added(gamemodel, analyzer, analyzer_type)
- analyzer_removed(gamemodel, analyzer, analyzer_type)
- bringToFront()
- clearMessages()
- find_in_database()
- game_changed(gamemodel, ply)
This runs when the game changes. It updates everything.
- game_ended(gamemodel, reason)
- game_paused(gamemodel)
- game_resumed(gamemodel)
- game_saved(gamemodel, uri)
Run when the game is saved. Will remove * from title.
- game_started(gamemodel)
- game_unended(gamemodel)
- getPageNumber()
- hide_arrow(analyzer, analyzer_type)
- infront()
- initBoardAndClock(gamemodel)
- initButtons(board)
- initTabcontents()
- isInFront()
- light_on_off(on)
- message_received(gamemodel, name, msg)
- moves_undone(gamemodel, moves)
- name_changed(player)
- on_game_close_clicked(button)
- on_shapes_changed(boardcontrol)
- on_show_fics_gameno(*args)
Checks the configuration / preferences to see if the FICS game number should be displayed next to player names.
- opp_not_out_of_time(bm)
- player_display_text(color, with_elo)
- player_lagged(bm, player)
- players_changed(gamemodel)
- replaceMessages(message)
Replace all messages with message
- save_shapes_to_pgn()
- setLocked(locked)
Makes the board insensitive and turns off the tab ready indicator
- showMessage(message)
- show_arrow(analyzer, analyzer_type)
- shownChanged(boardview, shown)
- zero_reached(timemodel, color)
- property display_text
- pychess.widgets.gamewidget.getWidgets()
- pychess.widgets.gamewidget.hideDesignGW()
- pychess.widgets.gamewidget.isDesignGWShown()
- pychess.widgets.gamewidget.setWidgets(w)
- pychess.widgets.gamewidget.showDesignGW()
pychess.widgets.newGameDialog module
- class pychess.widgets.newGameDialog.EnterNotationExtension
Bases:
_GameInitializationMode
- classmethod run()
- class pychess.widgets.newGameDialog.SetupPositionExtension
Bases:
_GameInitializationMode
- classmethod castl_toggled(button, castl)
- classmethod ep_combo_changed(combo)
- classmethod fen_changed(*args)
- classmethod fifty_spin_changed(spin)
- classmethod game_changed(model, ply)
- classmethod get_fen()
- classmethod ini_widgets(setup, lboard=None)
- classmethod moveno_spin_changed(spin)
- classmethod rotate_button_pressed(widget, button_event)
- classmethod run(fenstr, variant)
- classmethod side_button_toggled(button)
- board_control = None
- pychess.widgets.newGameDialog.createPlayerUIGlobals(discoverer)
- pychess.widgets.newGameDialog.createRematch(gamemodel)
If gamemodel contains only LOCAL or ARTIFICIAL players, this starts a new game, based on the info in gamemodel
- pychess.widgets.newGameDialog.loadFileAndRun(uri)
- pychess.widgets.newGameDialog.loadPgnAndRun(data)
pychess.widgets.playerinfoDialog module
pychess.widgets.preferencesDialog module
- Description:
This module facilitates configurable object that the end user can
customise such as which chess setor board colours to use or the ability to turn on/off various sidepanel facilities such as hints, comments engine analysis etc. It also allows the user to setup and use customised sounds or no sounds at all for a variety of in game events such as running out of time or piece movement events etc.
- class pychess.widgets.preferencesDialog.PanelTab(widgets)
Bases:
object
- hideit()
- panel_about(button)
- panel_toggled(button)
- selection_changed(treeselection)
- showit()
- class pychess.widgets.preferencesDialog.SaveTab(widgets)
Bases:
object
- Description:
Allows the user to configure the structure of saved
game files name along with various game attributes such as elapse time between moves and analysis engin evalutations
- class pychess.widgets.preferencesDialog.SoundTab(widgets)
Bases:
object
- classmethod getPlayer()
- classmethod playAction(action)
- SOUND_DIRS = ('/builddir/build/BUILD/pychess-1.0.3/sounds', '/usr/share/sounds', '/usr/local/share/sounds', '/builddir')
- actionToKeyNo = {'aPlayerCaptures': 2, 'aPlayerChecks': 1, 'aPlayerMoves': 0, 'gameIsDrawn': 6, 'gameIsLost': 5, 'gameIsSetup': 3, 'gameIsWon': 4, 'invalidMove': 10, 'oberservedEnds': 8, 'observedMoves': 7, 'puzzleSuccess': 11, 'shortOnTime': 9, 'variationChoice': 12}
- i = 12
- soundcombo = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
- sounduri = ['file:/builddir/build/BUILD/pychess-1.0.3/sounds/move1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/check1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/capture1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/start1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/win1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/lose1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/draw1.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/obs_mov.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/obs_end.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/alarm.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/invalid.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/success.ogg', 'file:/builddir/build/BUILD/pychess-1.0.3/sounds/choice.ogg']
- useSounds = True
- class pychess.widgets.preferencesDialog.ThemeTab(widgets)
Bases:
object
- Description:
Allows the setting of various user specific chess
sets and board colours
- discoverThemes()
- Description:
Finds all the different chess sets that are present
in the pieces directory
- Returns:
(a List) of themes
- pychess.widgets.preferencesDialog.anal_combo_get_value(combobox)
- pychess.widgets.preferencesDialog.anal_combo_set_value(combobox, value, show_arrow_check, analyzer_type)
- pychess.widgets.preferencesDialog.initialize(widgets)
- Description:
Initialises the various tabs for each section of configurable artifacts
- pychess.widgets.preferencesDialog.run(widgets)
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)