Tik-76.115 Individual Project: Guinea Pig
$Id: gui_classes.html,v 1.3 1996/04/22 20:36:15 kepa Exp $

Testee UI - GUI process classes

This document describes the classes that implement Testee UI functionality used in GUI process.

General overview

Parts of Testee UI functionality run in three different processes. The GUI process is a process that implements the real graphical user interface the testee sees. It receives commands from the Testee UI stub classes inside Test Logic process. It also gives back user responses and handles answering and warning timeout. Here's the general process and communication framework. (Things described in this document are drawn in black):

[Image]

Classes and interfaces

The GUI process contains for example in the case of an A/B Test an ab class, this class uses other classes containing help routines common to all test types. The GUI process communicates with the Testee UI stub routines inside Test Logic process to a implement Test Logic controlled GUI.

Here are the GUI classes. (Internal arrows show normal method calling direction) :

[Image]

The ab class is one GUI type. The different type GUI modules and classes are named after their type (ab, ab_scale, vol etc.). This class inherits from classes gui and guineawin. It implements the GUI type specific behaviour of the Testee UI.

The gui class is responsible for parsing command line arguments and opening communication socket as specified by the arguments. It also handles socket closing.

The guinewin class contains graphics intialization and communication routines common for all GUI types. It uses the callback class to implement the low-level communication and timeout handling chores.

Creating new GUI types

Creating new gui types to the Guinea Pig system is pretty straightforward. You need to create two classes newtype.py, which is the real gui process, and newtype_gui.py, which contains the stub routines needed by the Test Logic process.

You can copy the stub routines directly from old tests. The module abx_gui.py contains all the routines you need. You have to only change in this file the class name to newtype_gui and the started test type to newtype.

To implement the real gui process module newtype.py you have to do a little bit more. Now you should know the basics of Python and Tkinter programming. You can check the modules ab.py, ab_scale.py, abc.py and abx.py. All of this is 95% normal Tkinter programming. You can send events to the test logic with send_event method. Here is how you send the BUTTON B pressing event to the test logic:

self.send_event('BUTTON B', time.time())

When the test subject gives his/her answer, you can use the send_answer method. You must only send one answer message as an to enable message.

self.send_answer('X', time.time())

If you need more complicated message handling, you must modify the mainCB message handling routine and the stub routines also. For a good example on how to do this, see the abc.py and abc_gui.py modules.

Last, but vital part is to make sure the $PYTHONPATH environment variable contains the directory in which your new GUI modules are. Otherwise they won't start. See the module gui_test.py for an example how to test the new GUI modules.

Communication protocols used

Use the GUI protocol documentation to find out about the communication protocols used between the Test Logic and GUI server processes.


· Testee UI Architecture · Testee UI Index · Document index · Guinea Pig ·