Tpclient-pywx is a thousand parsec client which provides a 2D interface using wxPython.
This page is for development information on tpclient-pywx.
Git repository of tpclient-pywx is located at git://git.thousandparsec.net/git/tpclient-pywx
The master branch of it contains tp03 version. The version of client for communication through TP04 protocol is placed on 'tp04' branch.
- python - an interpreter and language libraries.
- wxPython - GUI platform.
- libtpclient-py - a library, providing high-level client services to tpclient-pywx. Is not wx-specific.
- libtpproto-py - a library for talking with TP server on tp04 protocol.
Tpclient-pywx uses wx resource files for GUI building. A customized xrced (the 'xrced' executable script in tpclient-pywx) is used to view and edit them.
The startup script file ./tpclient-pywx defines application (a descendant of libtpclient's Application) as a container of several threads: GUI, network, media, local and remote browsers, finder, download. Threads communicate via sending function calls (provided by CallThread class) and events to other threads.
- GUI (class GUI) thread handles drawing windows and user's interaction with them.
- Network thread (NetworkThread class) is responsible for communication with server.
- Media thread (MediaThread class) downloads media images for GUI.
- Local (LocalBrowser) and Remote (RemoteBrowser) browsers set daemon to browse games.
- Finder thread looks for TP games. Uses Zeroconf or TP metasever to find games.
GUI thread is implemented by class 'GUI' (a child of wx.App) which is responsible for GUI display and event handling. GUI class instantiates primary windows (files in ./windows/): the splash window (winSplash.py), the connection window (winConnect.py), the server lookup window (winServerBrowser.py) and, among others, the game main window (winMain.py). All windows except main game window are created on startup and shown/hidden when needed.
Main game window consists of a number of panels and secondary windows (see files in ./windows/main/). Main game window uses pyAUI to show a number of panels inside self:
- Starmap panel is placed on screen centre by default and shows game objects like systems and ships.
- Information panel shows info on currently selected object.
- Messages panel gives users and ability to browse, filter and delete messages.
- Orders panel is used for editing selected object's orders.
- System panel shows a tree of objects, present in current game.
- Design window is used for viewing and editing designs.
- Download Manager window shows a list of downloads.
- Help window gives access to tpclient's help files.
- Game Info window shows a list of game properties like server URL, number of players, etc.
- Idle Finder window is used to find free objects, which could be assinged orders.
- Waiting window contains information about other players' status and is shown at the end of turn.
User interface files (.xrc format) are placed in ./windows/xrc folder. They're used in following way: 1. You create an xrc file for your wxWindow in ./windows/xrc. 2. Script ./windows/xrc/generate.sh generates .py files in ./windows/xrc with classes which directly use XRCs. 3. You create a class inheriting auto-generated class (mixing in other classes like winBaseXRC if needed) and use it.
- Place a NOSPLASHMOVIE file into tpclient-pywx top level to disable splash movie.
- You can set default connection settings with command line arguments: ./tpclient-pywx tp://<username></username>:<password>@<server></server></<game></game>
This client is i18nalized using GNU Gettext library. To update the strings file ./locale/tpclient-pywx.pot use ./locale/generate.sh. To add a new locale create a subdir in ./locale/, add a translated strings .po file there, then compile it to .mo.
To debug your translation, set your locale via PATH environment variable.
Currently it is translated into Slovenian (see ./locale/sl).
The main author and maintainer of this client is [email protected].
This client has been in development during GSOC'09 by Greywhind and during GSOC'10 by [email protected]