
functions
files
intro
|
|
Common widget manipulation |
modules/CWM.ycp |
| Routines for common widget manipulation |
|
|
|
Imports
Global Functions
- AdjustButtons (string next, string back, string abort, string help)
- CreateWidgets (list<string> names, map<string,map<string,any> > source)
- GetProcessedWidget ()
- MergeHelps (list<map<string,any> > widgets)
- OkCancelBox ()
- PrepareDialog (term dialog, list<map<string,any> > widgets)
- ReplaceWidgetHelp (string widget, string help)
- Run (list<map<string, any> > widgets, map<any, any> functions)
- ShowAndRun (map<string,any> settings)
- ShowAndRunOrig (list<string> widget_names, map<string,map<string,any> > widget_descr, term contents, string caption, string back_button, string next_button, map<any, any> fallback)
- ValidateBasicType (any value, string type)
- ValidateMaps (map<string,map<string,any> > widgets)
- ValidateValueType (string key, any value, string widget)
- cleanupWidgets (list<map<string,any> > widgets)
- handleWidgets (list<map <string, any> > widgets, map event_descr)
- initWidgets (list<map<string, any> > widgets)
- mergeFunctions (list<map <string, any> > widgets, map<any, any> functions)
- prepareWidget (map<string, any> widget_descr)
- saveWidgets (list<map<string,any> > widgets, map event)
- validateWidget (map<string, any> widget, map event, string key)
- validateWidgets (list<map <string, any> > widgets, map event)
Local Variables
Local Functions
|
|
|
|
local processed_widget -> map<string, any>
|
|
Widget that is being currently processed
|
local current_dialog_widgets -> list<map<string,any> >
|
|
All widgets of the current dialog, in the correct order
|
local settings_stack -> list<map<string,any> >
|
|
stack of settings of nested calls of CWM
|
local PushSettings () -> void
|
|
Push the settings of the currently run dialog to the stack
|
local PopSettings () -> void
|
|
Pop the settings of the currently run dialog from the stack
|
local ProcessTerm (term t, map<string,map<string,any> > widgets) -> term
|
|
Process term with the dialog, replace strings in the term with
appropriate widgets
Processes only `VBox, `HBox, `Left and `Right
- Parameters:
|
t |
term dialog containing strings |
|
widgets |
map of widget name -> widget description map |
- Return value:
|
|
updated term ready to be used as a dialog |
|
global ValidateBasicType (any value, string type) -> boolean
|
|
Validate the value against the basic type
- Parameters:
|
value |
any a value to validate |
|
type |
string type information |
- Return value:
|
|
true on success or if do not know how to validate |
|
global ValidateValueType (string key, any value, string widget) -> boolean
|
|
Validate type of entry of the widget/option description map
Also checks option description maps if present
- Parameters:
|
key |
string key of the map entry |
|
value |
any value of the map entry |
|
widget |
any name of the widget/option |
- Return value:
|
|
true if validation succeeded |
|
local ValidateValueContents (string key, any value, string widget) -> boolean
|
|
Validate value of entry of the widget/option description map
Also checks option description maps if present
- Parameters:
|
key |
string key of the map entry |
|
value |
any value of the map entry |
|
widget |
any name of the widget/option |
- Return value:
|
|
true if validation succeeded |
|
global mergeFunctions (list<map <string, any> > widgets, map<any, any> functions) -> list<map <string, any> >
|
|
Add fallback functions to a widget
global only because of testsuites
- Parameters:
|
widgets |
a list of widget desctiption maps |
|
functions |
map of functions |
- Return value:
|
|
a list of modified widget description maps |
|
global initWidgets (list<map<string, any> > widgets) -> void
|
|
Set widgets according to internally stored settings
global only because of testsuites
- Parameters:
|
widgets |
list of maps representing widgets |
|
global handleWidgets (list<map <string, any> > widgets, map event_descr) -> symbol
|
|
Handle change of widget after event generated
global only because of testsuites
- Parameters:
|
widgets |
list of maps represenging widgets |
|
event_descr |
map event that occured |
- Return value:
|
|
modified action (sometimes may be needed) or nil |
|
global saveWidgets (list<map<string,any> > widgets, map event) -> void
|
|
Save changes of widget after event generated
global only because of testsuites
- Parameters:
|
widgets |
list of maps represenging widgets |
|
event |
map event that occured |
|
global cleanupWidgets (list<map<string,any> > widgets) -> void
|
|
Cleanup after dialog was finished (independently on what event)
global only because of testsuites
- Parameters:
|
widgets |
list of maps represenging widgets |
|
global GetProcessedWidget () -> map<string, any>
|
|
Return description map of currently processed widget
- Return value:
|
|
description map of currently processed widget |
|
global OkCancelBox () -> term
|
|
Create a term with OK and Cancel buttons placed horizontally
- Return value:
|
global ValidateMaps (map<string,map<string,any> > widgets) -> boolean
|
|
Validate widget description map, check for maps structure
Also checks option description maps if present
- Parameters:
|
widgets |
map widgets description map |
- Return value:
|
global prepareWidget (map<string, any> widget_descr) -> map<string, any>
|
|
Prepare a widget for usage
- Parameters:
|
widget_descr |
map widget description map |
- Return value:
|
|
modified widget description map |
|
global validateWidget (map<string, any> widget, map event, string key) -> boolean
|
|
Validate single widget
- Parameters:
|
widget |
widget description map |
|
event |
map event that caused validation |
|
key |
widget key for validation by function |
- Return value:
|
|
true if validation succeeded |
|
global validateWidgets (list<map <string, any> > widgets, map event) -> boolean
|
|
Validate dialog contents for allow it to be saved
- Parameters:
|
widgets |
list of widgets to validate |
|
event |
map event that caused validation |
- Return value:
|
|
true if everything is OK, false if something is wrong |
|
global CreateWidgets (list<string> names, map<string,map<string,any> > source) -> list<map<string, any> >
|
|
Read widgets with listed names
- Parameters:
|
names |
a list of strings/symbols names of widgets |
|
source |
a map containing the widgets |
- Return value:
|
|
of maps representing widgets |
|
global MergeHelps (list<map<string,any> > widgets) -> string
|
|
Merge helps from the widgets
- Parameters:
|
widgets |
a list of widget description maps |
- Return value:
|
|
merged helps of the widgets |
|
global PrepareDialog (term dialog, list<map<string,any> > widgets) -> term
|
|
Prepare the dialog, replace strings in the term with appropriate
widgets
Processes only `VBox, `HBox, `Left and `Right
- Parameters:
|
dialog |
term dialog containing strings |
|
widgets |
list of widget description maps |
- Return value:
|
|
updated term ready to be used as a dialog |
|
global ReplaceWidgetHelp (string widget, string help) -> void
|
|
Replace help for a particular widget
- Parameters:
|
widget |
string widget ID of widget to replace help |
|
help |
string new help to the widget |
|
global Run (list<map<string, any> > widgets, map<any, any> functions) -> symbol
|
|
Generic function to create dialog and handle it's events
- Parameters:
|
widgets |
list of widget maps |
|
functions |
map initialize/save/handle fallbacks if not specified
with the widgets. |
- Return value:
|
global AdjustButtons (string next, string back, string abort, string help) -> void
|
|
Adjust the labels of the bottom buttons of the wizard sequencer
- Parameters:
|
next |
label of the "Next" button |
|
back |
string label of the "Back" button |
|
abort |
string label of the "Abort" button |
|
help |
string label of the additional "Help" button (if needed) |
|
global ShowAndRun (map<string,any> settings) -> symbol
|
|
Display the dialog and run its event loop
- Parameters:
|
settings |
a map of all settings needed to run the dialog |
|
global ShowAndRunOrig (list<string> widget_names, map<string,map<string,any> > widget_descr, term contents, string caption, string back_button, string next_button, map<any, any> fallback) -> symbol
|
|
Display the dialog and run its event loop
- Parameters:
|
widget_names |
list of names of widgets that will be used in the
dialog |
|
widget_descr |
map description map of all widgets |
|
contents |
term contents of the dialog, identifiers instead of
widgets |
|
caption |
string dialog caption |
|
back_button |
string label of the back button |
|
next_button |
string label of the next button |
|
fallback |
map initialize/save/handle fallbacks if not specified
with the widgets. |
- Return value:
|