| |
- gnome.canvas.Canvas(gtk.Layout)
-
- CheckerBoard
- gtk.Dialog(gtk.Window)
-
- NewDialog
- gobject.GObject(__builtin__.object)
-
- Engine
- Game
- gtk.GenericCellRenderer(gtk.CellRenderer)
-
- CellRendererWrap
- GladeGui
- gtk.ListStore(gobject.GObject, gtk.TreeModel, gtk.TreeDragSource, gtk.TreeDragDest, gtk.TreeSortable)
-
- Players
- Main
- Position
- ConfigParser.RawConfigParser
-
- Prefs
- gtk.Statusbar(gtk.HBox)
-
- Feedback
- _ctypes.Structure(_ctypes._CData)
-
- CBcoor
- CBmove
- gtk.TreeStore(gobject.GObject, gtk.TreeModel, gtk.TreeDragSource, gtk.TreeDragDest, gtk.TreeSortable)
-
- Book
- gtk.TreeView(gtk.Container)
-
- BookView
- gtk.Window(gtk.Bin)
-
- Fatal
- shlex.shlex
-
- Pdn
class Book(gtk.TreeStore) |
|
game history - a tree of all the games in the book
- games grow from the root
games store a name, the setup position, etc.
- moves grow from a game
moves contain the move as a string and as a list and
the position after the move
the currently active game is to be remembered between calls to
several methods, so persistant iters are required
output game headers are: gametype, black, white, result, date,
site, round, fen. other headers are not in the output pdn
the "event" header is in COL_NAME |
|
- Method resolution order:
- Book
- gtk.TreeStore
- gobject.GObject
- gtk.TreeModel
- gtk.TreeDragSource
- gtk.TreeDragDest
- gtk.TreeSortable
- gobject.GInterface
- __builtin__.object
Methods defined here:
- __init__(self)
- do_clear(self)
- clear book
- fen2str(self, fen)
- return fen as a string
- game2pdn(self)
- return current game as a pdn string, wrapped email friendly
- get_move(self, num)
- get move <num>, return saved position and turn
- get_movelist(self)
- return list of the moves in the current game
- goto_game(self, num)
- set game <num> as current, return game header
- new_game(self, name, gametype, black, white, position, color)
- add a new game to the book, return path
- new_move(self, name, position, color, move)
- append move to current game, return path
- old_game(self, position)
- replace position in current old game, return old games' movelist
- old_move(self, num, name, position, color, move)
- replace position in move <num> in current game, return path
- pdn_game(self)
- add a new empty game to the book
- pdn_move(self, name, strength, annotation, move)
- append move from pdn to current game, some essential
parameters are only added later on replay, ie. old_move
- set_result(self, result)
- replace result in current game
- trunc_game(self, num)
- delete all moves after <num> from current game
- wrap(self, text, width)
- A word-wrap function that preserves existing line breaks
and most spaces in the text. Expects that existing line
breaks are posix newlines (
).
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/148061
Data and other attributes defined here:
- COL_ANNO = 4
- COL_HEAD = 1
- COL_MOVE = 2
- COL_NAME = 0
- COL_POS = 5
- COL_STREN = 3
- COL_TURN = 6
Methods inherited from gtk.TreeStore:
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __iter__(...)
- x.__iter__() <==> iter(x)
- __len__(...)
- x.__len__() <==> len(x)
- __nonzero__(...)
- x.__nonzero__() <==> x != 0
- __setitem__(...)
- x.__setitem__(i, y) <==> x[i]=y
- append(...)
- clear(...)
- insert(...)
- insert_after(...)
- insert_before(...)
- is_ancestor(...)
- iter_depth(...)
- iter_is_valid(...)
- move_after(...)
- move_before(...)
- prepend(...)
- remove(...)
- reorder(...)
- set(...)
- set_value(...)
- swap(...)
Data and other attributes inherited from gtk.TreeStore:
- __gtype__ = <GType GtkTreeStore (135978944)>
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object GtkTreeStore\n\nSignals from GObject:\n not...-reordered (GtkTreePath, GtkTreeIter, gpointer)\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from gtk.TreeModel:
- filter_new(...)
- foreach(...)
- get(...)
- get_column_type(...)
- get_flags(...)
- get_iter(...)
- get_iter_first(...)
- get_iter_from_string(...)
- get_iter_root(...)
- get_n_columns(...)
- get_path(...)
- get_string_from_iter(...)
- get_value(...)
- iter_children(...)
- iter_has_child(...)
- iter_n_children(...)
- iter_next(...)
- iter_nth_child(...)
- iter_parent(...)
- ref_node(...)
- row_changed(...)
- row_deleted(...)
- row_has_child_toggled(...)
- row_inserted(...)
- rows_reordered(...)
- unref_node(...)
Methods inherited from gtk.TreeDragSource:
- drag_data_delete(...)
- drag_data_get(...)
- row_draggable(...)
Methods inherited from gtk.TreeDragDest:
- drag_data_received(...)
- row_drop_possible(...)
Methods inherited from gtk.TreeSortable:
- get_sort_column_id(...)
- has_default_sort_func(...)
- set_default_sort_func(...)
- set_sort_column_id(...)
- set_sort_func(...)
- sort_column_changed(...)
|
class BookView(gtk.TreeView) |
|
display of book: games and moves
the book view displays data from several columns of the book model
in a single column, collection is done via a celldata function
to speed up loading of games, the model is disconnected then
it might have been preferable to show the black and white move on
the same line, but that seems quite hard and doesnt mix well with
annotations |
|
- Method resolution order:
- BookView
- gtk.TreeView
- gtk.Container
- gtk.Widget
- gtk.Object
- gobject.GObject
- __builtin__.object
Methods defined here:
- __init__(self)
- never called, libglade doesnt
- connect_model(self, toggle=True)
- toggle/connect from book
- do_markup(self, column, cell, model, iter)
- add annotation and headers to cells markup
- edit_game(self, model, path)
- edit game headers and dialog
- edit_move(self, model, path)
- edit move info and dialog
- on_activate_row(self, treeview, path, column)
- on double click on row edit game or move
- on_change_selection(self, selection)
- on selction change goto selected game or move
- open(self, book)
- connect to the model, install callbacks
Data and other attributes defined here:
- __gtype__ = <GType capers+BookView (136794072)>
Methods inherited from gtk.TreeView:
- append_column(...)
- collapse_all(...)
- collapse_row(...)
- columns_autosize(...)
- create_row_drag_icon(...)
- enable_model_drag_dest(...)
- enable_model_drag_source(...)
- expand_all(...)
- expand_row(...)
- expand_to_path(...)
- get_background_area(...)
- get_bin_window(...)
- get_cell_area(...)
- get_column(...)
- get_columns(...)
- get_cursor(...)
- get_dest_row_at_pos(...)
- get_drag_dest_row(...)
- get_enable_search(...)
- get_expander_column(...)
- get_hadjustment(...)
- get_headers_visible(...)
- get_model(...)
- get_path_at_pos(...)
- get_reorderable(...)
- get_rules_hint(...)
- get_search_column(...)
- get_selection(...)
- get_vadjustment(...)
- get_visible_rect(...)
- insert_column(...)
- insert_column_with_attributes(...)
- insert_column_with_data_func(...)
- map_expanded_rows(...)
- move_column_after(...)
- remove_column(...)
- row_activated(...)
- row_expanded(...)
- scroll_to_cell(...)
- scroll_to_point(...)
- set_column_drag_function(...)
- set_cursor(...)
- set_cursor_on_cell(...)
- set_drag_dest_row(...)
- set_enable_search(...)
- set_expander_column(...)
- set_hadjustment(...)
- set_headers_clickable(...)
- set_headers_visible(...)
- set_model(...)
- set_reorderable(...)
- set_rules_hint(...)
- set_search_column(...)
- set_search_equal_func(...)
- set_vadjustment(...)
- tree_to_widget_coords(...)
- unset_rows_drag_dest(...)
- unset_rows_drag_source(...)
- widget_to_tree_coords(...)
Methods inherited from gtk.Container:
- add(...)
- add_with_properties(...)
- check_resize(...)
- child_get(...)
- child_get_property(...)
- child_set(...)
- child_set_property(...)
- child_type(...)
- children(...)
- forall(...)
- foreach(...)
- get_border_width(...)
- get_children(...)
- get_focus_chain(...)
- get_focus_hadjustment(...)
- get_focus_vadjustment(...)
- get_resize_mode(...)
- propagate_expose(...)
- remove(...)
- resize_children(...)
- set_border_width(...)
- set_focus_chain(...)
- set_focus_child(...)
- set_focus_hadjustment(...)
- set_focus_vadjustment(...)
- set_reallocate_redraws(...)
- set_resize_mode(...)
- unset_focus_chain(...)
Data and other attributes inherited from gtk.Container:
- border_width = <attribute 'border_width' of 'gtk.Container' objects>
- focus_child = <attribute 'focus_child' of 'gtk.Container' objects>
- has_focus_chain = <attribute 'has_focus_chain' of 'gtk.Container' objects>
- need_resize = <attribute 'need_resize' of 'gtk.Container' objects>
- reallocate_redraws = <attribute 'reallocate_redraws' of 'gtk.Container' objects>
- resize_mode = <attribute 'resize_mode' of 'gtk.Container' objects>
Methods inherited from gtk.Widget:
- activate(...)
- add_accelerator(...)
- add_events(...)
- add_mnemonic_label(...)
- can_activate_accel(...)
- child_focus(...)
- child_notify(...)
- class_path(...)
- create_pango_context(...)
- create_pango_layout(...)
- destroy(...)
- drag_begin(...)
- drag_check_threshold(...)
- drag_dest_find_target(...)
- drag_dest_get_target_list(...)
- drag_dest_set(...)
- drag_dest_set_proxy(...)
- drag_dest_set_target_list(...)
- drag_dest_unset(...)
- drag_get_data(...)
- drag_highlight(...)
- drag_source_set(...)
- drag_source_set_icon(...)
- drag_source_set_icon_pixbuf(...)
- drag_source_set_icon_stock(...)
- drag_source_unset(...)
- drag_unhighlight(...)
- draw(...)
- ensure_style(...)
- event(...)
- freeze_child_notify(...)
- get_accessible(...)
- get_allocation(...)
- get_ancestor(...)
- get_child_requisition(...)
- get_child_visible(...)
- get_clipboard(...)
- get_colormap(...)
- get_composite_name(...)
- get_direction(...)
- get_display(...)
- get_events(...)
- get_extension_events(...)
- get_modifier_style(...)
- get_name(...)
- get_no_show_all(...)
- get_pango_context(...)
- get_parent(...)
- get_parent_window(...)
- get_pointer(...)
- get_root_window(...)
- get_screen(...)
- get_settings(...)
- get_size_request(...)
- get_style(...)
- get_toplevel(...)
- get_visual(...)
- grab_add(...)
- grab_default(...)
- grab_focus(...)
- grab_remove(...)
- has_screen(...)
- hide(...)
- hide_all(...)
- hide_on_delete(...)
- intersect(...)
- is_ancestor(...)
- is_focus(...)
- list_mnemonic_labels(...)
- map(...)
- mnemonic_activate(...)
- modify_base(...)
- modify_bg(...)
- modify_fg(...)
- modify_font(...)
- modify_style(...)
- modify_text(...)
- path(...)
- queue_clear(...)
- queue_clear_area(...)
- queue_draw(...)
- queue_draw_area(...)
- queue_resize(...)
- queue_resize_no_redraw(...)
- rc_get_style(...)
- realize(...)
- remove_accelerator(...)
- remove_mnemonic_label(...)
- render_icon(...)
- reparent(...)
- reset_rc_styles(...)
- reset_shapes(...)
- selection_add_target(...)
- selection_add_targets(...)
- selection_clear_targets(...)
- selection_convert(...)
- selection_owner_set(...)
- selection_remove_all(...)
- send_expose(...)
- set_accel_path(...)
- set_app_paintable(...)
- set_child_visible(...)
- set_colormap(...)
- set_composite_name(...)
- set_direction(...)
- set_double_buffered(...)
- set_events(...)
- set_extension_events(...)
- set_name(...)
- set_no_show_all(...)
- set_parent(...)
- set_parent_window(...)
- set_redraw_on_allocate(...)
- set_scroll_adjustments(...)
- set_sensitive(...)
- set_size_request(...)
- set_state(...)
- set_style(...)
- set_uposition(...)
- set_usize(...)
- shape_combine_mask(...)
- show(...)
- show_all(...)
- show_now(...)
- size_allocate(...)
- size_request(...)
- style_get_property(...)
- thaw_child_notify(...)
- translate_coordinates(...)
- unmap(...)
- unparent(...)
- unrealize(...)
Data and other attributes inherited from gtk.Widget:
- allocation = <attribute 'allocation' of 'gtk.Widget' objects>
- name = <attribute 'name' of 'gtk.Widget' objects>
- parent = <attribute 'parent' of 'gtk.Widget' objects>
- saved_state = <attribute 'saved_state' of 'gtk.Widget' objects>
- state = <attribute 'state' of 'gtk.Widget' objects>
- style = <attribute 'style' of 'gtk.Widget' objects>
- window = <attribute 'window' of 'gtk.Widget' objects>
Methods inherited from gtk.Object:
- flags(...)
- set_flags(...)
- unset_flags(...)
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object capers+BookView\n\nSignals from GObject:\n ...die Annahme, dass alle Zeilen gleich hoch sind.\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class CBcoor(_ctypes.Structure) |
|
cb api coordinates structure |
|
- Method resolution order:
- CBcoor
- _ctypes.Structure
- _ctypes._CData
- __builtin__.object
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'CBcoor' objects>
- list of weak references to the object (if defined)
- x = <_ctypes.CField object>
- y = <_ctypes.CField object>
Methods inherited from _ctypes.Structure:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Data and other attributes inherited from _ctypes.Structure:
- __new__ = <built-in method __new__ of _ctypes.StructType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __hash__(...)
- x.__hash__() <==> hash(x)
|
class CBmove(_ctypes.Structure) |
|
cb api move structure |
|
- Method resolution order:
- CBmove
- _ctypes.Structure
- _ctypes._CData
- __builtin__.object
Data and other attributes defined here:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'CBmove' objects>
- list of weak references to the object (if defined)
- delpiece = <_ctypes.CField object>
- jumps = <_ctypes.CField object>
- mdel = <_ctypes.CField object>
- mfrom = <_ctypes.CField object>
- mto = <_ctypes.CField object>
- newpiece = <_ctypes.CField object>
- oldpiece = <_ctypes.CField object>
- path = <_ctypes.CField object>
Methods inherited from _ctypes.Structure:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Data and other attributes inherited from _ctypes.Structure:
- __new__ = <built-in method __new__ of _ctypes.StructType object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from _ctypes._CData:
- __hash__(...)
- x.__hash__() <==> hash(x)
|
class CellRendererWrap(gtk.GenericCellRenderer) |
|
a cell renderer, that wraps long text
the first on_get_size will not be given a cell_area, probably,
because the treeview widget is not yet realized. as no width can
be set for the wordwrap, pango will not wrap at all and the cell
will be as wide as the longest single line in the model.
one way around this is to set an initial width. this has a severe
drawback: a cell will never shrink below its initial width and its
initial height will neither shrink nor grow. so if the set width is
smaller than the actual width, when the cell is realized, there will
be a blank padding on the bottom. if the set width is larger than
the actual width, some of the text will be cut off.
another way might be to pack the cell into the column after view and
column have been realized. still, the first calls will not sport a
cell_area.
this always sets the marked up text |
|
- Method resolution order:
- CellRendererWrap
- gtk.GenericCellRenderer
- gtk.CellRenderer
- gtk.Object
- gobject.GObject
- __builtin__.object
Methods defined here:
- __init__(self)
- do_get_property(self, property)
- do_set_property(self, property, value)
- on_get_size(self, widget, cell_area)
- tell the treeview the cell's size
- on_render(self, window, widget, background_area, cell_area, expose_area, flags)
- paint the cell
Data and other attributes defined here:
- __gtype__ = <GType capers+CellRendererWrap (136777920)>
Methods inherited from gtk.CellRenderer:
- activate(...)
- editing_canceled(...)
- get_fixed_size(...)
- get_size(...)
- render(...)
- set_fixed_size(...)
- start_editing(...)
Methods inherited from gtk.Object:
- destroy(...)
- flags(...)
- set_flags(...)
- unset_flags(...)
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object capers+CellRendererWrap\n\nSignals from GOb...rarray: markup\n markup displayed by the cell\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class CheckerBoard(gnome.canvas.Canvas) |
|
present the game visually
- the user may drag pieces (event handler)
- the game may move, take, crown pieces (public method)
the board does not know the rules, as soon as a piece is dropped,
the board will ask the game if the move was legal, and if it
wasnt, will put the piece back to the start, otherwise, it will
pass the result of the query on to the game
board coordinates start in the top-left corner (NORTHWEST), the
other classes send and get calibrated coordinates (0-[79])
the board also does not know the numbering scheme and where the
double corner lies. this information is included in the position
passed when a new board is setup
the board resizes itself to match the setup, and flips, if asked
self.busy is true, while a piece is moved by user or engine |
|
- Method resolution order:
- CheckerBoard
- gnome.canvas.Canvas
- gtk.Layout
- gtk.Container
- gtk.Widget
- gtk.Object
- gobject.GObject
- __builtin__.object
Methods defined here:
- flip(self, flip='flip')
- quickly rotate board
- move_piece(self, a, b)
- animate move, set board to 'busy'
- move_piece2(self, a, b)
- animate move in gtk.idle, set board to 'busy'
- new(self, gametype, setup, flip)
- create board backdrop, pieces, numbers from setup
- on_board_event(self, num, event)
- handle events on board, ie. menu and edit mode
- on_piece_event(self, piece, event)
- handle events on pieces, ie. dragndrop
- set_piece(self, num, value)
- make piece on square <num> of <value>, return new piece
- setposition(self, setup)
- quickly switch to setup position, only same game
- take_piece(self, num)
- hide piece on square <num>
Data and other attributes defined here:
- __gtype__ = <GType capers+CheckerBoard (136796088)>
- busy = False
- edit = False
Methods inherited from gnome.canvas.Canvas:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- c2w(...)
- get_color(...)
- get_color_pixel(...)
- get_dither(...)
- get_item_at(...)
- get_scroll_offsets(...)
- get_scroll_region(...)
- root(...)
- scroll_to(...)
- set_dither(...)
- set_pixels_per_unit(...)
- set_scroll_region(...)
- update_now(...)
- w2c(...)
- w2c_affine(...)
- w2c_d(...)
- window_to_world(...)
- world_to_window(...)
Methods inherited from gtk.Layout:
- freeze(...)
- get_hadjustment(...)
- get_size(...)
- get_vadjustment(...)
- move(...)
- put(...)
- set_hadjustment(...)
- set_size(...)
- set_vadjustment(...)
- thaw(...)
Data and other attributes inherited from gtk.Layout:
- bin_window = <attribute 'bin_window' of 'gtk.Layout' objects>
Methods inherited from gtk.Container:
- add(...)
- add_with_properties(...)
- check_resize(...)
- child_get(...)
- child_get_property(...)
- child_set(...)
- child_set_property(...)
- child_type(...)
- children(...)
- forall(...)
- foreach(...)
- get_border_width(...)
- get_children(...)
- get_focus_chain(...)
- get_focus_hadjustment(...)
- get_focus_vadjustment(...)
- get_resize_mode(...)
- propagate_expose(...)
- remove(...)
- resize_children(...)
- set_border_width(...)
- set_focus_chain(...)
- set_focus_child(...)
- set_focus_hadjustment(...)
- set_focus_vadjustment(...)
- set_reallocate_redraws(...)
- set_resize_mode(...)
- unset_focus_chain(...)
Data and other attributes inherited from gtk.Container:
- border_width = <attribute 'border_width' of 'gtk.Container' objects>
- focus_child = <attribute 'focus_child' of 'gtk.Container' objects>
- has_focus_chain = <attribute 'has_focus_chain' of 'gtk.Container' objects>
- need_resize = <attribute 'need_resize' of 'gtk.Container' objects>
- reallocate_redraws = <attribute 'reallocate_redraws' of 'gtk.Container' objects>
- resize_mode = <attribute 'resize_mode' of 'gtk.Container' objects>
Methods inherited from gtk.Widget:
- activate(...)
- add_accelerator(...)
- add_events(...)
- add_mnemonic_label(...)
- can_activate_accel(...)
- child_focus(...)
- child_notify(...)
- class_path(...)
- create_pango_context(...)
- create_pango_layout(...)
- destroy(...)
- drag_begin(...)
- drag_check_threshold(...)
- drag_dest_find_target(...)
- drag_dest_get_target_list(...)
- drag_dest_set(...)
- drag_dest_set_proxy(...)
- drag_dest_set_target_list(...)
- drag_dest_unset(...)
- drag_get_data(...)
- drag_highlight(...)
- drag_source_set(...)
- drag_source_set_icon(...)
- drag_source_set_icon_pixbuf(...)
- drag_source_set_icon_stock(...)
- drag_source_unset(...)
- drag_unhighlight(...)
- draw(...)
- ensure_style(...)
- event(...)
- freeze_child_notify(...)
- get_accessible(...)
- get_allocation(...)
- get_ancestor(...)
- get_child_requisition(...)
- get_child_visible(...)
- get_clipboard(...)
- get_colormap(...)
- get_composite_name(...)
- get_direction(...)
- get_display(...)
- get_events(...)
- get_extension_events(...)
- get_modifier_style(...)
- get_name(...)
- get_no_show_all(...)
- get_pango_context(...)
- get_parent(...)
- get_parent_window(...)
- get_pointer(...)
- get_root_window(...)
- get_screen(...)
- get_settings(...)
- get_size_request(...)
- get_style(...)
- get_toplevel(...)
- get_visual(...)
- grab_add(...)
- grab_default(...)
- grab_focus(...)
- grab_remove(...)
- has_screen(...)
- hide(...)
- hide_all(...)
- hide_on_delete(...)
- intersect(...)
- is_ancestor(...)
- is_focus(...)
- list_mnemonic_labels(...)
- map(...)
- mnemonic_activate(...)
- modify_base(...)
- modify_bg(...)
- modify_fg(...)
- modify_font(...)
- modify_style(...)
- modify_text(...)
- path(...)
- queue_clear(...)
- queue_clear_area(...)
- queue_draw(...)
- queue_draw_area(...)
- queue_resize(...)
- queue_resize_no_redraw(...)
- rc_get_style(...)
- realize(...)
- remove_accelerator(...)
- remove_mnemonic_label(...)
- render_icon(...)
- reparent(...)
- reset_rc_styles(...)
- reset_shapes(...)
- selection_add_target(...)
- selection_add_targets(...)
- selection_clear_targets(...)
- selection_convert(...)
- selection_owner_set(...)
- selection_remove_all(...)
- send_expose(...)
- set_accel_path(...)
- set_app_paintable(...)
- set_child_visible(...)
- set_colormap(...)
- set_composite_name(...)
- set_direction(...)
- set_double_buffered(...)
- set_events(...)
- set_extension_events(...)
- set_name(...)
- set_no_show_all(...)
- set_parent(...)
- set_parent_window(...)
- set_redraw_on_allocate(...)
- set_scroll_adjustments(...)
- set_sensitive(...)
- set_size_request(...)
- set_state(...)
- set_style(...)
- set_uposition(...)
- set_usize(...)
- shape_combine_mask(...)
- show(...)
- show_all(...)
- show_now(...)
- size_allocate(...)
- size_request(...)
- style_get_property(...)
- thaw_child_notify(...)
- translate_coordinates(...)
- unmap(...)
- unparent(...)
- unrealize(...)
Data and other attributes inherited from gtk.Widget:
- allocation = <attribute 'allocation' of 'gtk.Widget' objects>
- name = <attribute 'name' of 'gtk.Widget' objects>
- parent = <attribute 'parent' of 'gtk.Widget' objects>
- saved_state = <attribute 'saved_state' of 'gtk.Widget' objects>
- state = <attribute 'state' of 'gtk.Widget' objects>
- style = <attribute 'style' of 'gtk.Widget' objects>
- window = <attribute 'window' of 'gtk.Widget' objects>
Methods inherited from gtk.Object:
- flags(...)
- set_flags(...)
- unset_flags(...)
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object capers+CheckerBoard\n\nSignals from GObject...liased\n The antialiasing mode of the canvas.\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Engine(gobject.GObject) |
|
interface to the checkers engine dll
on init this class loads an engine. it also translates between
the different data types of the C-api and the python game
unlike "enginecommand()" and "islegal()", which return in an
instant, the "getmove()" function needs to be in a thread: when
its done, it will install game.do_enginemove as an idle task
in gtk.
getmove will change the game.lock, so feedback can know, when
the engine stopped. gtk seems to cycle thread locks, so not
deleting it, should not leak.
there is only ever one engine active at a time, as the CBapi
does not support thinking on the opponents time. so its ok to
lock the game, not the engine thread.
engines have to conform to the CheckerBoard API by Martin Fierz.
engines are written eg. in C, and can be loaded and removed at
runtime |
|
- Method resolution order:
- Engine
- gobject.GObject
- __builtin__.object
Methods defined here:
- __init__(self, enginefile)
- load a dll, set globals: name, gametype, about, help
- cbcoor2num(self, cbcoor)
- convert CBapi coordinate structure to board number
- enginecommand(self, command)
- mostly 'get gametype' and 'name'
- get(self, key)
- shorthand enginecommand get: gametype...
- getmove(self, data)
- wraps the threaded call to the engine, always return False
- getmove_thread(self, lock, data)
- start searching a move; in a thread
- islegal(self, list, color, position, cbmove)
- check move in list, return False if illegal, else return list
- playnow(self, lock, playnow)
- engine break, in timeout, stop when break or lock lost/released
- pos2cbboard(self, position, board)
- copy position to CBapi board
in CBapi, origin is SW, in capers origin is NW
- showbuf(self, lock, buf)
- engine feedback, in timeout, stop when lock lost/released
Data and other attributes defined here:
- DRAW = 0
- LOSS = 2
- UNKNOWN = 3
- WIN = 1
- __gtype__ = <GType capers+Engine (136816936)>
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object capers+Engine\n\nSignals from GObject:\n notify (GParam)\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Game |
|
glue together gui, engine, board and book
the game does know very little about the rules, it has to ask the
engine, if a move was legal, the game only knows the current position,
it has to ask the book for others
on entry of a move, board and book will be updated, current game,
current and last move are tracked here too, its easier than always
having to ask the book
on selecting an old game, a new setup position is created and the game
rewound, in order to update all the pixbuf references to valid ones;
a game loaded from pdn is just like a game from the treestore
all communication with board and book shall be through the game
the game also keeps the lock, while an engine is searching a move
_grey is the engine used to validate moves by human players;
_black and _white are either references to engines, or None
_game_curr, _game_last, _move_curr and _move_last are paths into
the Book treestore |
|
Methods defined here:
- __init__(self)
- clean(self)
- clear board of all hidden pieces, needed for edit
- coor2num(self, x, y)
- translate coordinates to number
- do_enginemove(self, data)
- register legal engine move with current position, release game lock
always return False to remove gobject idle
- do_move(self, a, b)
- update temp position and board after move, reducable
- do_move_silent(self, a, b)
- update temp position after move, reducable
- do_oldmove(self, steps, data)
- register legal old move with current position, called from replay
- do_usermove(self, steps, data)
- register legal user move with current position, called from board
- empty(self)
- clear board of all pieces, needed for edit empty
- engine_getmove(self)
- ask the engine for a move, called from gobject timeout, so its
in a loop, where False means break, and True means continue, but
this will never break what is not broken, only engines_stop does
- engines_go(self)
- let engine_getmove return True
- engines_stop(self)
- make engine_getmove always return False
- game_next(self)
- go to the last position in the game
- game_prev(self)
- go to the last position in the game
- goto_begin(self)
- go to the begin of the game
- goto_end(self)
- go to the last position in the game
- goto_game(self, game)
- go to move/position <game> in current game
- goto_game_move(self, path)
- go to move/position <path> in game <path>
when game changed, only go to begin
- goto_move(self, move)
- go to move/position <move> in current game
- goto_next(self)
- go to the next position in the game
- goto_prev(self)
- go to the previous position in the game
- islegal(self, list)
- if game not locked, target is empty and color right, ask engine
- new(self)
- setup from prefs, register with board and book, kickoff engines
- num2coor(self, num)
- translate number to coordinates
- num2piece(self, num)
- return piece on square <num>
- num2val(self, num)
- return value of square <num>
- old(self, game)
- setup from old game <game>, register with prefs, board and book
- pdn_game(self, last)
- go to the first game in the book, that has num <last> games
- promote(self, num, value, silent=False)
- update temp position with piece value
- save_move(self, steps, jumps)
- register move with book
- save_oldmove(self, steps, jumps)
- reregister move with book, increments move_curr
- set_result(self, code)
- game ended, push message and format result for board/pdn
- start_edit(self, empty=False)
- start new game from current setup or empty board, lock game
- stop_edit(self)
- create fen of current position, correct book, release game lock
- take_piece(self, num)
- take piece on squares num in list, called via map()
- take_piece_silent(self, num)
- take piece on squares num in list, called via map()
Data and other attributes defined here:
- ENGLISH = 21
- INTERNL = 20
- ITALIAN = 22
- MAFIERZ = 32
- RUSSIAN = 25
- engines_loop = 0
- gametype = 0
|
class GladeGui |
|
interface with the libglade runtime
the layout of the application window is described in a file
that libglade loads at runtime. signal handlers are installed
in this class' dictionary. widgets are made available as
attributes of this class
display of pieces and numbers can be toggled |
|
Methods defined here:
- __getitem__(self, key)
- Make widgets available as attributes of this class
- __init__(self, gladefile)
- Load the interface descripton and connect the signals
setup up actions and accelerators, create clipboard
- copy_cb(self, *args)
- copy game
- edit_cb(self, *args)
- edit board toggle
- editempty_cb(self, *args)
- edit empty board toggle, set global, then call edit board
- flip_cb(self, *args)
- flip board
- new_cb(self, *args)
- new same game
- nwo_cb(self, *args)
- new game with options
- on_button_begin(widget)
- on_button_end(widget)
- on_button_game_next(widget)
- on_button_game_prev(widget)
- on_button_go(widget)
- on_button_next(widget)
- on_button_prev(widget)
- on_button_stop(widget)
- on_wm_quit(widget, event)
- # glade handlers
- open_cb(self, *args)
- load book from pdn file
- paste_cb(self, *args)
- paste game
- quit_cb(self, *args)
- # action callbacks
- save_cb(self, *args)
- save current game as pdn
Data and other attributes defined here:
- types = {'GnomeCanvas': <class 'capers.CheckerBoard'>, 'GtkDialog': <class 'capers.NewDialog'>, 'GtkStatusbar': <class 'capers.Feedback'>, 'GtkTreeView': <class 'capers.BookView'>}
|
class NewDialog(gtk.Dialog) |
|
Start new game with options
Options are: gametype, black and white players
The selection of players depends on the gametype, as engines are
specifically adapted to one; only the human player can play all
the different types, the exclude filter takes that into account.
the unique filter's types list is preset with 0, as to not show
the humans "any" gametype |
|
- Method resolution order:
- NewDialog
- gtk.Dialog
- gtk.Window
- gtk.Bin
- gtk.Container
- gtk.Widget
- gtk.Object
- gobject.GObject
- __builtin__.object
Methods defined here:
- gt_exclude(self, model, iter)
- exclude entries by global gametype
- gt_unique(self, model, iter)
- only one entry per gametype
- on_gt_change(self, gbox, xfil)
- change filter for players
- prepare(self)
- reset(self)
- change filter for players to prefs, called from gui
- save(self)
- write current selection to prefs
Data and other attributes defined here:
- __gtype__ = <GType capers+NewDialog (135607216)>
Methods inherited from gtk.Dialog:
- __init__(...)
- x.__init__(...) initializes x; see x.__class__.__doc__ for signature
- add_action_widget(...)
- add_button(...)
- add_buttons(...)
- get_has_separator(...)
- response(...)
- run(...)
- set_default_response(...)
- set_has_separator(...)
- set_response_sensitive(...)
Data and other attributes inherited from gtk.Dialog:
- action_area = <attribute 'action_area' of 'gtk.Dialog' objects>
- vbox = <attribute 'vbox' of 'gtk.Dialog' objects>
Methods inherited from gtk.Window:
- activate_default(...)
- activate_focus(...)
- activate_key(...)
- add_accel_group(...)
- add_mnemonic(...)
- begin_move_drag(...)
- begin_resize_drag(...)
- deiconify(...)
- fullscreen(...)
- get_accept_focus(...)
- get_decorated(...)
- get_default_size(...)
- get_destroy_with_parent(...)
- get_focus(...)
- get_frame_dimensions(...)
- get_gravity(...)
- get_has_frame(...)
- get_icon(...)
- get_icon_list(...)
- get_mnemonic_modifier(...)
- get_modal(...)
- get_position(...)
- get_resizable(...)
- get_role(...)
- get_screen(...)
- get_size(...)
- get_skip_pager_hint(...)
- get_skip_taskbar_hint(...)
- get_title(...)
- get_transient_for(...)
- get_type_hint(...)
- has_toplevel_focus(...)
- iconify(...)
- is_active(...)
- maximize(...)
- mnemonic_activate(...)
- move(...)
- parse_geometry(...)
- present(...)
- propagate_key_event(...)
- remove_accel_group(...)
- remove_mnemonic(...)
- reshow_with_initial_size(...)
- resize(...)
- set_accept_focus(...)
- set_decorated(...)
- set_default(...)
- set_default_size(...)
- set_destroy_with_parent(...)
- set_focus(...)
- set_frame_dimensions(...)
- set_geometry_hints(...)
- set_gravity(...)
- set_has_frame(...)
- set_icon(...)
- set_icon_from_file(...)
- set_icon_list(...)
- set_keep_above(...)
- set_keep_below(...)
- set_mnemonic_modifier(...)
- set_modal(...)
- set_policy(...)
- set_position(...)
- set_resizable(...)
- set_role(...)
- set_screen(...)
- set_skip_pager_hint(...)
- set_skip_taskbar_hint(...)
- set_title(...)
- set_transient_for(...)
- set_type_hint(...)
- set_wmclass(...)
- stick(...)
- tooltips_get_info_from_tip_window(...)
- unfullscreen(...)
- unmaximize(...)
- unstick(...)
Data and other attributes inherited from gtk.Window:
- allow_grow = <attribute 'allow_grow' of 'gtk.Window' objects>
- allow_shrink = <attribute 'allow_shrink' of 'gtk.Window' objects>
- configure_notify_received = <attribute 'configure_notify_received' of 'gtk.Window' objects>
- configure_request_count = <attribute 'configure_request_count' of 'gtk.Window' objects>
- decorated = <attribute 'decorated' of 'gtk.Window' objects>
- default_widget = <attribute 'default_widget' of 'gtk.Window' objects>
- destroy_with_parent = <attribute 'destroy_with_parent' of 'gtk.Window' objects>
- focus_widget = <attribute 'focus_widget' of 'gtk.Window' objects>
- frame = <attribute 'frame' of 'gtk.Window' objects>
- frame_bottom = <attribute 'frame_bottom' of 'gtk.Window' objects>
- frame_left = <attribute 'frame_left' of 'gtk.Window' objects>
- frame_right = <attribute 'frame_right' of 'gtk.Window' objects>
- frame_top = <attribute 'frame_top' of 'gtk.Window' objects>
- gravity = <attribute 'gravity' of 'gtk.Window' objects>
- group = <attribute 'group' of 'gtk.Window' objects>
- has_focus = <attribute 'has_focus' of 'gtk.Window' objects>
- has_frame = <attribute 'has_frame' of 'gtk.Window' objects>
- has_user_ref_count = <attribute 'has_user_ref_count' of 'gtk.Window' objects>
- iconify_initially = <attribute 'iconify_initially' of 'gtk.Window' objects>
- keys_changed_handler = <attribute 'keys_changed_handler' of 'gtk.Window' objects>
- maximize_initially = <attribute 'maximize_initially' of 'gtk.Window' objects>
- mnemonic_modifier = <attribute 'mnemonic_modifier' of 'gtk.Window' objects>
- modal = <attribute 'modal' of 'gtk.Window' objects>
- need_default_position = <attribute 'need_default_position' of 'gtk.Window' objects>
- need_default_size = <attribute 'need_default_size' of 'gtk.Window' objects>
- position = <attribute 'position' of 'gtk.Window' objects>
- stick_initially = <attribute 'stick_initially' of 'gtk.Window' objects>
- title = <attribute 'title' of 'gtk.Window' objects>
- transient_parent = <attribute 'transient_parent' of 'gtk.Window' objects>
- type = <attribute 'type' of 'gtk.Window' objects>
- type_hint = <attribute 'type_hint' of 'gtk.Window' objects>
- wm_role = <attribute 'wm_role' of 'gtk.Window' objects>
- wmclass_class = <attribute 'wmclass_class' of 'gtk.Window' objects>
- wmclass_name = <attribute 'wmclass_name' of 'gtk.Window' objects>
Methods inherited from gtk.Bin:
- get_child(...)
Data and other attributes inherited from gtk.Bin:
- child = <attribute 'child' of 'gtk.Bin' objects>
Methods inherited from gtk.Container:
- add(...)
- add_with_properties(...)
- check_resize(...)
- child_get(...)
- child_get_property(...)
- child_set(...)
- child_set_property(...)
- child_type(...)
- children(...)
- forall(...)
- foreach(...)
- get_border_width(...)
- get_children(...)
- get_focus_chain(...)
- get_focus_hadjustment(...)
- get_focus_vadjustment(...)
- get_resize_mode(...)
- propagate_expose(...)
- remove(...)
- resize_children(...)
- set_border_width(...)
- set_focus_chain(...)
- set_focus_child(...)
- set_focus_hadjustment(...)
- set_focus_vadjustment(...)
- set_reallocate_redraws(...)
- set_resize_mode(...)
- unset_focus_chain(...)
Data and other attributes inherited from gtk.Container:
- border_width = <attribute 'border_width' of 'gtk.Container' objects>
- focus_child = <attribute 'focus_child' of 'gtk.Container' objects>
- has_focus_chain = <attribute 'has_focus_chain' of 'gtk.Container' objects>
- need_resize = <attribute 'need_resize' of 'gtk.Container' objects>
- reallocate_redraws = <attribute 'reallocate_redraws' of 'gtk.Container' objects>
- resize_mode = <attribute 'resize_mode' of 'gtk.Container' objects>
Methods inherited from gtk.Widget:
- activate(...)
- add_accelerator(...)
- add_events(...)
- add_mnemonic_label(...)
- can_activate_accel(...)
- child_focus(...)
- child_notify(...)
- class_path(...)
- create_pango_context(...)
- create_pango_layout(...)
- destroy(...)
- drag_begin(...)
- drag_check_threshold(...)
- drag_dest_find_target(...)
- drag_dest_get_target_list(...)
- drag_dest_set(...)
- drag_dest_set_proxy(...)
- drag_dest_set_target_list(...)
- drag_dest_unset(...)
- drag_get_data(...)
- drag_highlight(...)
- drag_source_set(...)
- drag_source_set_icon(...)
- drag_source_set_icon_pixbuf(...)
- drag_source_set_icon_stock(...)
- drag_source_unset(...)
- drag_unhighlight(...)
- draw(...)
- ensure_style(...)
- event(...)
- freeze_child_notify(...)
- get_accessible(...)
- get_allocation(...)
- get_ancestor(...)
- get_child_requisition(...)
- get_child_visible(...)
- get_clipboard(...)
- get_colormap(...)
- get_composite_name(...)
- get_direction(...)
- get_display(...)
- get_events(...)
- get_extension_events(...)
- get_modifier_style(...)
- get_name(...)
- get_no_show_all(...)
- get_pango_context(...)
- get_parent(...)
- get_parent_window(...)
- get_pointer(...)
- get_root_window(...)
- get_settings(...)
- get_size_request(...)
- get_style(...)
- get_toplevel(...)
- get_visual(...)
- grab_add(...)
- grab_default(...)
- grab_focus(...)
- grab_remove(...)
- has_screen(...)
- hide(...)
- hide_all(...)
- hide_on_delete(...)
- intersect(...)
- is_ancestor(...)
- is_focus(...)
- list_mnemonic_labels(...)
- map(...)
- modify_base(...)
- modify_bg(...)
- modify_fg(...)
- modify_font(...)
- modify_style(...)
- modify_text(...)
- path(...)
- queue_clear(...)
- queue_clear_area(...)
- queue_draw(...)
- queue_draw_area(...)
- queue_resize(...)
- queue_resize_no_redraw(...)
- rc_get_style(...)
- realize(...)
- remove_accelerator(...)
- remove_mnemonic_label(...)
- render_icon(...)
- reparent(...)
- reset_rc_styles(...)
- reset_shapes(...)
- selection_add_target(...)
- selection_add_targets(...)
- selection_clear_targets(...)
- selection_convert(...)
- selection_owner_set(...)
- selection_remove_all(...)
- send_expose(...)
- set_accel_path(...)
- set_app_paintable(...)
- set_child_visible(...)
- set_colormap(...)
- set_composite_name(...)
- set_direction(...)
- set_double_buffered(...)
- set_events(...)
- set_extension_events(...)
- set_name(...)
- set_no_show_all(...)
- set_parent(...)
- set_parent_window(...)
- set_redraw_on_allocate(...)
- set_scroll_adjustments(...)
- set_sensitive(...)
- set_size_request(...)
- set_state(...)
- set_style(...)
- set_uposition(...)
- set_usize(...)
- shape_combine_mask(...)
- show(...)
- show_all(...)
- show_now(...)
- size_allocate(...)
- size_request(...)
- style_get_property(...)
- thaw_child_notify(...)
- translate_coordinates(...)
- unmap(...)
- unparent(...)
- unrealize(...)
Data and other attributes inherited from gtk.Widget:
- allocation = <attribute 'allocation' of 'gtk.Widget' objects>
- name = <attribute 'name' of 'gtk.Widget' objects>
- parent = <attribute 'parent' of 'gtk.Widget' objects>
- saved_state = <attribute 'saved_state' of 'gtk.Widget' objects>
- state = <attribute 'state' of 'gtk.Widget' objects>
- style = <attribute 'style' of 'gtk.Widget' objects>
- window = <attribute 'window' of 'gtk.Widget' objects>
Methods inherited from gtk.Object:
- flags(...)
- set_flags(...)
- unset_flags(...)
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object capers+NewDialog\n\nSignals from GObject:\n ...log hat einen Trennbalken \xc3\xbcber seinen Kn\xc3\xb6pfen\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
|
class Pdn(shlex.shlex) |
|
load games from pdn file
as the parser is quite small, its put here too. the globals game and
move are counts that match paths into the books treestore.
this gets a filename, parses the games in the file and writes them to
the book, then points the game at the first loaded game; moves are not
checked for validity here |
|
Methods defined here:
- __init__(self, stream, filename)
- init lexer in posix mode, prepare parser
- move_split(self, move)
- split a move, return list of integers
- parse(self)
- parse book: headers, annotation, movelist; hold game.lock
- parse_annotation(self)
- parse annotation, return it
- parse_fen(self, fen)
- parse fen string: setup position, return turn, bpos, wpos
- parse_header(self)
- parse headers: key, value; save to book, increment game counter
- parse_move(self)
- parse single move: hops, strength, annotation; return them
- parse_moves(self)
- parse movelist: moves, result; save them to book
Methods inherited from shlex.shlex:
- __iter__(self)
- error_leader(self, infile=None, lineno=None)
- Emit a C-compiler-like, Emacs-friendly error-message leader.
- get_token(self)
- Get a token from the input stream (or from stack if it's nonempty)
- next(self)
- pop_source(self)
- Pop the input source stack.
- push_source(self, newstream, newfile=None)
- Push an input source onto the lexer's input source stack.
- push_token(self, tok)
- Push a token onto the stack popped by the get_token method
- read_token(self)
- sourcehook(self, newfile)
- Hook called on a filename to be sourced.
|
class Players(gtk.ListStore) |
|
list the possible opponents in a game
human is always first, then comes the list of available engines
human gets a gametype of 0, to be distinguishable from engines
subclasses liststore, to be suitable as a model for the engines
popup in the "New..." dialogue |
|
- Method resolution order:
- Players
- gtk.ListStore
- gobject.GObject
- gtk.TreeModel
- gtk.TreeDragSource
- gtk.TreeDragDest
- gtk.TreeSortable
- gobject.GInterface
- __builtin__.object
Methods defined here:
- __init__(self)
- human is first, then load engines, ask them for gametype etc.
- file2engine(self, filename)
- return an engine for a filename
- file2name(self, file)
- return the name of the engine corresponding to <file>
- gt2engine(self, gametype)
- return an engine for a gametype, the first one found
- name2engine(self, name)
- return the name of the engine corresponding to <file> or None
- name2file(self, name)
- return the name of the engine corresponding to <file> or human
Data and other attributes defined here:
- COL_ABOUT = 4
- COL_ENGINE = 6
- COL_FILE = 0
- COL_GAMENAME = 3
- COL_GAMETYPE = 2
- COL_HELP = 5
- COL_NAME = 1
Methods inherited from gtk.ListStore:
- __delitem__(...)
- x.__delitem__(y) <==> del x[y]
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __iter__(...)
- x.__iter__() <==> iter(x)
- __len__(...)
- x.__len__() <==> len(x)
- __nonzero__(...)
- x.__nonzero__() <==> x != 0
- __setitem__(...)
- x.__setitem__(i, y) <==> x[i]=y
- append(...)
- clear(...)
- insert(...)
- insert_after(...)
- insert_before(...)
- iter_is_valid(...)
- move_after(...)
- move_before(...)
- prepend(...)
- remove(...)
- reorder(...)
- set(...)
- set_column_types(...)
- set_value(...)
- swap(...)
Data and other attributes inherited from gtk.ListStore:
- __gtype__ = <GType GtkListStore (135960120)>
Methods inherited from gobject.GObject:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __gobject_init__(...)
- __hash__(...)
- x.__hash__() <==> hash(x)
- __repr__(...)
- x.__repr__() <==> repr(x)
- chain(...)
- connect(...)
- connect_after(...)
- connect_object(...)
- connect_object_after(...)
- disconnect(...)
- emit(...)
- emit_stop_by_name(...)
- freeze_notify(...)
- get_data(...)
- get_property(...)
- handler_block(...)
- handler_disconnect(...)
- handler_is_connected(...)
- handler_unblock(...)
- notify(...)
- set_data(...)
- set_property(...)
- stop_emission(...)
- thaw_notify(...)
Data and other attributes inherited from gobject.GObject:
- __dict__ = <dictproxy object>
- __gdoc__ = 'Object GtkListStore\n\nSignals from GObject:\n not...-reordered (GtkTreePath, GtkTreeIter, gpointer)\n\n'
- __grefcount__ = <attribute '__grefcount__' of 'gobject.GObject' objects>
- __new__ = <built-in method __new__ of type object>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
Methods inherited from gtk.TreeModel:
- filter_new(...)
- foreach(...)
- get(...)
- get_column_type(...)
- get_flags(...)
- get_iter(...)
- get_iter_first(...)
- get_iter_from_string(...)
- get_iter_root(...)
- get_n_columns(...)
- get_path(...)
- get_string_from_iter(...)
- get_value(...)
- iter_children(...)
- iter_has_child(...)
- iter_n_children(...)
- iter_next(...)
- iter_nth_child(...)
- iter_parent(...)
- ref_node(...)
- row_changed(...)
- row_deleted(...)
- row_has_child_toggled(...)
- row_inserted(...)
- rows_reordered(...)
- unref_node(...)
Methods inherited from gtk.TreeDragSource:
- drag_data_delete(...)
- drag_data_get(...)
- row_draggable(...)
Methods inherited from gtk.TreeDragDest:
- drag_data_received(...)
- row_drop_possible(...)
Methods inherited from gtk.TreeSortable:
- get_sort_column_id(...)
- has_default_sort_func(...)
- set_default_sort_func(...)
- set_sort_column_id(...)
- set_sort_func(...)
- sort_column_changed(...)
|
class Position |
|
known setup positions:
international, english, (italian, russian,) mafierz
in store: pseudo constants for the values of a square, a function
to return a mutable deepcopy of a position, with references to
pixmaps intact, and a function to print an ascii art board
- a position is a list of squares: 64 or 100 are allowed
- a square is a list of five values: num, col, x, y, pixbuf |
|
Methods defined here:
- ascii(self, position)
- return ascii art string of <position>
- copy(self, position)
- return mutable deepcopy of position:
simple types by value, objects by reference
- english(self)
- return english setup, color to move first
- fen_setup(self, position, fen)
- change position to match fen setup, return turn, position
- international(self)
- return international setup, color to move first
- italian(self)
- return italian setup, color to move first
- mafierz(self)
- return mafierz setup (italian rules on russian board),
color to move first
- russian(self)
- return russian setup, color to move first
Data and other attributes defined here:
- BLACK = 2
- CC = 3
- COL_NUM = 0
- COL_PIECE = 4
- COL_VAL = 1
- COL_X = 2
- COL_Y = 3
- EMPTY = 0
- FREE = 16
- KING = 8
- MAN = 4
- WHITE = 1
|
class Prefs(ConfigParser.RawConfigParser) |
|
read, manage and save settings
- the player has a name
- the game has a gametype, a black and a white player
players may be "human" or the path to an engine
- the look has a scene and a glade file
this is just the last game played, no checking is done, if
engine and gametype match; prefs are synced from "New..."
preferences are saved in a file "prefs" in
$XDG_CONFIG_HOME/capers or in
$HOME/.config/capers or in $PWD |
|
Methods defined here:
- __init__(self)
- load settings, make defaults
- find(self)
- find or invent the preferences file, return filename
- pmkdir(self, newdir)
- works like <mkdir -p>
- save(self)
- save preferences to default location
Methods inherited from ConfigParser.RawConfigParser:
- add_section(self, section)
- Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
already exists.
- defaults(self)
- get(self, section, option)
- getboolean(self, section, option)
- getfloat(self, section, option)
- getint(self, section, option)
- has_option(self, section, option)
- Check for the existence of a given option in a given section.
- has_section(self, section)
- Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
- items(self, section)
- options(self, section)
- Return a list of option names for the given section name.
- optionxform(self, optionstr)
- read(self, filenames)
- Read and parse a filename or a list of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing
configuration files in the list will be read. A single
filename may also be given.
- readfp(self, fp, filename=None)
- Like read() but the argument must be a file-like object.
The `fp' argument must have a `readline' method. Optional
second argument is the `filename', which if not given, is
taken from fp.name. If fp has no `name' attribute, `<???>' is
used.
- remove_option(self, section, option)
- Remove an option.
- remove_section(self, section)
- Remove a file section.
- sections(self)
- Return a list of section names, excluding [DEFAULT]
- set(self, section, option, value)
- Set an option.
- write(self, fp)
- Write an .ini-format representation of the configuration state.
Data and other attributes inherited from ConfigParser.RawConfigParser:
- OPTCRE = <_sre.SRE_Pattern object>
- SECTCRE = <_sre.SRE_Pattern object>
| |