Reid Augustin > Games-Go-GoPair-1.001 > Games::Go::TDFinder

Download:
Games-Go-GoPair-1.001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.017   Source  

NAME ^

TDFinder - a widget to support preparing Go tournament registration

SYNOPSIS ^

use Games::Go::TDFinder;

$tdFinder = $parent->Games::Go::TDFinder ( ? options ? );

DESCRIPTION ^

TDFinder is a widget to assist in preparing a Go Tournament register.tde file in AGA (American Go Association) format. It consists of three main parts: a TDEntry widget at the bottom, a 'match' list in the middle (which is an ROText widget), and the tde information at the top (A TextUndo widget).

The widget opens the TDLIST file for searching. Tournemant directors should download the most recent TDLIST from the AGA shortly before the tournament. The most recent TDLIST is available from the AGA at: http:www.usgo.org

Typing search keys into the TDEntry field causes the TDFinder to search through the TDLIST looking for matches. When the number of matches is small enough to fit into the 'match' list ROText widget, they are posted there. Individual TDLIST entries can be selected either by further refining the search keys, or by using the Up/Down arrow keys. Typing 'Enter', double clicking a match (BUGBUG: TBD), or dragging a match to the tde text widget (BUGBUG: TBD) transfers a match to the tde file.

The caller is responsible for make sure the final register.tde file corresponds to the information in the tde part of the TDFinder widget.

OPTIONS ^

-tdListFile => filename

Specify the filename of the current TDLIST file of players (from the AGA). If -tdListFile => undef, no TDLIST file is opened (and you can't really do much of anything), otherwise if TDLIST can't be opened, TDFinder complains and dies.

TDFinder checks the date of the tdListFile. If it is less than two weeks old, TDFinder presents a warning dialog box.

-tdListFile may only be specified at widget creation. Configuring it later has no effect.

Default: 'tdlist' (in the current directory - a symlink is acceptable)

-height => height in chars

Height is passed to the matchText widget.

Default: 12

-scrollbars => a scrollbar 'where string

The scrollbar 'where' string is passed to the tdeText widget. See the -scrollbars option in Tk::Scrolled for details.

Default: 'osow'

-namelength => number

The starting length of names in the tdeText widget. Lines are formatted so that all the names take the same amount of space. This number grows if a longer name is entered into tdeText.

Default: 20

-clublength => number

The starting length of club names in the tdeText widget. Lines are formatted so that all the club names take the same amount of space. This number grows if a longer name is entered into tdeText.

Default: 10

DEFAULT

All other options are passed to the tdeText widget.

ADVERTISED WIDGETS ^

entry

The TDEntry support widget: consists of a label, an entry widget, and a 'Case sensitive' Checkbutton.

You might want to do something like:

    $tdFinder->Subwidget('entry')->focus(); # start with focus in entry widget.
tdeText

The TextUndo widget which holds the current register.tde contents. The caller is reponsible for maintaining the on-disk file contents and making sure the tdeText content matches the register.tde file (see tdfind(1)).

Use something like:

    $register_tde = tdFinder->Subwidget('tdeText')->get('1.0', 'end')

to get the current contents of the tdeText widget.

METHODS ^

$tdFinder->clear()

Clears the entire TDFinder, including the tdeText, matchText, and tdEntry subwidgets.

$tdeFinder->addPlayer($player)

Adds a player to the TDFinder. Player should be a reference to a hash containing the following members:

    $p->{agaNum}        required
    $p->{country}       required
    $p->{name}          required
    $p->{agaRating}     required
    $p->{club}          optional
    $p->{flags}         optional
    $p->{comment}       optional
$tdFinder->addTD('line in TDLIST format')

Parses a line from the TDLIST file and adds the player to tdeText.

$tdFinder->addTDE('line in register.tde format')

Parses a line from the register.tde file and adds the player to tdeText.

$tdFinder->sort()

Sorts the entries in tdeText. Currently, only sorting by rank (strongest first) is supported. Comments lines are skipped over.

SEE ALSO ^

o Games::Go::TDEntry(3)

perl/Tk entry widget support for TDFinder

o tdfind(1)

perl/Tk script that implements a TDLIST finder

AUTHOR ^

Reid Augustin, <reid@netchip.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2004, 2005 by Reid Augustin

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: