YaST2 Developers Documentation: Common widget manipulation



functions
files
intro

Common widget manipulation

modules/CWM.ycp
Routines for common widget manipulation

Imports

  • Label
  • Report
  • Wizard

Global Functions

Local Functions

local ProcessTerm (term t, map 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

local ValidateValueType (string key, any value, any 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, any 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> 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 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 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 names, map source) -> list<map<string, any> >

Read widgets with listed names

Parameters:
names list of strings/symbols names of widgets
source the map containing the widgets
Return value:
of maps representing widgets

global MergeHelps (list<map> 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> 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 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 ShowAndRun (list widget_names, map 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

YaST2 Developers Documentation