Demeter

Description Perl tools for X-ray Absorption Spectroscopy
Demeter > Perl Modules > Demeter::UI::Wx::Config
Source

NAME

Demeter::UI::Wx::Config - A configuration widget for Demeter applications

VERSION

This documentation refers to Demeter version 0.9.26.

SYNOPSIS

A configuration widget can be added to a Wx application:

  my $config = Demeter::UI::Wx::Config -> new($parent, \&callback);
  $sizer -> Add($config, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);

The first argument is the window in which the configuration widget is to be packed. The second is a reference to a callback that will be called whenever a parameter is altered.

DESCRIPTION

This is a widget for managing the rather dizzying array of configuration parameters controled by the Demeter::Config object. Creating and packing the widget will give your user a way of examining the various parameters and and altering their values.

To use this widget, you must provide a reference to a callback that will be called when a parameter value is changed. For the example in the synopsis, the callback will be called like so:

  $config -> &$callback($group, $parameter, $value, $save);

Thus the callback must be a method of the object using this widget. The other things passed are the group and name of the configuration parameter, its new value, and a flag which is true if the ini file was saved.

METHODS

populate

This is the only user servicable method of this widget. It is used to populate the parameter tree with the desired subset of parameters.

   $config->populate('all');
     or
   $config->populate('plot', 'bkg', 'fft', 'bft');
     or
   $config->populate('hephaestus');

The second example might be used for a simple Athena-like application while the third example is what is actually used in Hephaestus.

all

Display all groups known to the Config object.

base

Display all groups known that are part of Demeter's principle set of groups. Those are the ones that are imported into the Config object regardless of what the application is. As an example of the difference between all and base, Hephaestus defines an application-specific parameter group called hephaestus. The hephaestus group will be included in all but not in base.

a list of specific groups

The other option is to specify a list of one or more specific parameter groups to display in the tree.

The default is to display all groups.

USING THE CONFIGURATION WIDGET

Using the tree

Each parameter group is displayed to the right of an expander button. Under wxGtk, this is a little triangle that points down when the group is expaned and to the right when the group is collapsed. Click on this button to open or close the parameter group.

When you click on a parameter group, its description will be displayed in the description box.

When you click on a parameter from a group that has been expanded in the list, its description will be displayed in the description box and other information will be displayed in the other controls on the right side of the window.

You can only alter the value of a parameter that is selected in the tree.

Using the controls

A control appropriate to the type of widget will be displayed just above the description box. For many parameter types, this is a box for entering text. For integer-valued parameters, this is spin box that you can alter by typing in it directly or by clicking the little up and down arrows. For true/false parameters, a check box is used. For color-valued parameters, a button which pops up a color picker is used.

The buttons labeled as "your value" and "Demeter's value" can be used to restore the value of the control used to set the parameter value. "Demeter's value" is the system-wide default read from Demeter's configuration files, while the other value is the user's own value read from the user's ini file.

Applying and saving parameter values

To alter a parameter value for use within the current instance of a Demeter-based application, click the "Apply" button. This will set the current parameter value in the Config object. To alter a paremeter value and save it for future use, click the button which says "Apply and save". This will also write out the user's ini file.

If a parameter is flagged as only taking effect when the application is restarted, the "Apply" button will be disabled.

DEPENDENCIES

Demeter's dependencies are in the Build.PL file.

BUGS AND LIMITATIONS

Please report problems to the Ifeffit Mailing List (http://cars9.uchicago.edu/mailman/listinfo/ifeffit/)

Patches are welcome.

AUTHOR

Bruce Ravel, http://bruceravel.github.io/home

http://bruceravel.github.io/demeter/

LICENCE AND COPYRIGHT

Copyright (c) 2006-2018 Bruce Ravel (http://bruceravel.github.io/home). All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlgpl.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.