• No results found

Gui Class Reference

Implements a graphic user interface for a DODS client.

#include Gui.h

Public Methods

virtual Gui ()

boolprogress visible(int state=-1) Set or test progress indicator visibility.

boolshow gui(int state=-1) Should the GUI be used?

boolcommand(string command) Send the GUI process a command.

boolpassword(string &user, string &pass) Get username and password information.

boolsimple error(string msg)

boolpercent bar(double pro, int usr cancel)

Moves the progress bar back and forth in its slot. If user presses ”Cancel” button parameterusr cancelis true.

Gui();

Gui(const string cmd) The Gui class constructor.

Gui ()

3.19.1 Detailed Description

Implements a graphic user interface for a DODS client.

This class manages a simple graphical user interface (GUI) for a DODS client. The GUI is implemented by an embedded Tcl/Tk interpreter and a short tk script (see dods -gui.tcl). The script contains a number of functions which are loaded into the embed-ded interpreter. The functions defined by the script can be run using the methods of Gui. Some of the functions can be accessed only through certain special methods (e.g., simple error) while others can be accessed using their name via the command(...) method.

Reimplement as a singleton  

The Gui class was/is intended to support the transfer progress indicator. It also supports display of various error messages and provides a way for users to supply username and password pairs for secure sites.

Do not confuse the DODS Client GUI, managed by this class, with a DODS GUI Client, such as the DODS Matlab GUI, used for the graphical display of DODS datasets. The two can work together, but otherwise have nothing to do with each other.

The GUI process uses the following environment variables:

DODS USE GUI If this variable exists and equals “no”, the progress indicator will not appear. If it does not exist, or if it has any other value, the progress indicator will be activated.

Note that for historical reasons there is no copy constructor or compare operators.

Definition at line 66 of file Gui.h.

3.19.2 Constructor & Destructor Documentation

3.19.2.1 Gui::Gui (const string cmd) The Gui class constructor.

Create the instance of Gui and initialize the embedded interpreter. In previous versions of this class it was possible to change the way the interpreter was initialized. However, that is no longer an option.

If the constructor is called with a string argument, send that string to the interpreter as an initial command.

Parameters:

cmd Send the Tcl/Tk interpreter this command.

Definition at line 63 of file Gui.cc.

3.19.3 Member Function Documentation

3.19.3.1 bool Gui::command (string command) Send the GUI process a command.

Submits a command to the GUI interpreter for execution.

It may be that users turn off the GUI (because they are sick of it). In that case, this command will simply return false. It does no harm to call the command when no GUI is running. Care should be taken to send only valid commands—invalid commands may put the GUI into an inoperable state.

If the GUI is not running, this function starts it.

Returns:

TRUE if the command succeeded, FALSE otherwise.

Parameters:

command A command to submit to the GUI process for execution.

Definition at line 165 of file Gui.cc.

References command, and show gui.

Referenced by command.

3.19.3.2 bool Gui::password (string & user, string & pass) Get username and password information.

Pops up a username/password dialog box. The values entered by the user are returned in the parametersuserandpass.

Parameters:

user The user’s name.

pass The user’s password.

Returns:

true if the command succeeded, false otherwise.

Definition at line 218 of file Gui.cc.

References show gui.

3.19.3.3 bool Gui::percent bar (double pro, int usr cancel)

Moves the progress bar back and forth in its slot. If user presses ”Cancel” button parameterusr cancelis true.

Parameters:

pro Percent of progress.

usr cancel The cancel button.

Definition at line 255 of file Gui.cc.

References show gui.

3.19.3.4 bool Gui::progress visible (int state = -1) Set or test progress indicator visibility.

This function can be used to query whether the progress indicator is visible or not. It may also be used to set whether it is to be seen or not.

Parameters:

state If state is omitted (or is -1, the default), the function returns the visibility state. If state is included, the function sets the visibility state to the given value.

Returns:

Returns TRUE if the GUI is visible, false otherwise.

Definition at line 142 of file Gui.cc.

3.19.3.5 bool Gui::show gui (int state = -1) Should the GUI be used?

This function returns the state of two internal flags. The first, under program control, indicates whether or not to use the GUI at all. This is a private value called show gui. The second flag is derived from the value of the environment variableDODS USE GUI, and is set when the class instance is created. It is also a private value (user wants -gui), and cannot be modified. The GUI is displayed only if both these flags are TRUE.

This function can be used to modify the value of the show guiflag.

Parameters:

state If state is omitted (or is -1, the default), the function returns the result of the operation show guiAND user wants gui. If state is included, the function sets the value of the show guiflag.

Returns:

The value of show guiAND user wants gui.

Definition at line 305 of file Gui.cc.

Referenced by command, Error::display message, password, percent bar, and simple -error.

3.19.3.6 bool Gui::simple error (string error msg) Print an error message and wait for the user to acknowledge it.

Parameters:

error msg message to be printed.

Definition at line 188 of file Gui.cc.

References show gui.

Referenced by Error::display message.

The documentation for this class was generated from the following files:

Gui.h Gui.cc