YaST2 Developers Documentation: Common widget manipulation

Common widget manipulation

modules/CWM.ycp
Routines for common widget manipulation
  • Jiri Srain

This module has an unstable interface.

Imports

  • Label
  • Report
  • Wizard

Global Functions

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

Info:

Handler to be called after validation of a dialog fails

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 ContainerWidgets -> list<symbol>

UI containers, layout helpers that contain other widgets. Used by functions that recurse through "contents" to decide whether to go deeper.

local ProcessTerm (term t, map<string,map<string,any> > widgets) -> term

Process term with the dialog, replace strings in the term with appropriate widgets

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 StringsOfTerm (term t) -> list<string>

Process term with the dialog, return all strings. To be used as an argument for widget_names until they are obsoleted.

Parameters:
t term dialog containing strings
Return value:
strings found in the term
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 CWMTab uses it too

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:
the term (HBox)
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:
true on success
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

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
local handleDebug () -> void

A hook to handle Alt-Ctrl-Shift-D

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:
wizard sequencer symbol
global DisableButtons (list<string> buttons) -> void

Disable given bottom buttons of the wizard sequencer

Parameters:
buttons
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 SetValidationFailedHandler () -> void

Set handler to be called after validation of a dialog failed

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:
wizard sequencer symbol
global InitNull (string key) -> void

Do-nothing replacement for a widget initialization function. Used for push buttons if all the other widgets have a fallback.

Parameters:
key id of the widget
global StoreNull (string key, map event) -> void

Do-nothing replacement for a widget storing function. Used for push buttons if all the other widgets have a fallback.

Parameters:
key id of the widget
event the event being handled