YaST2 Developers Documentation: Base YaST package

Base YaST package

modules/WizardHW
Routines for generic hardware summary dialog
  • Jiri Srain

This module has an unstable interface.

Imports

  • CWM
  • Label
  • Popup
  • Report
  • Wizard

Global Functions

Local Variables

Local Functions

local current_items -> list<map<string,any> >

List of items in the currently displayed dialog

local descriptions -> map<string,string>

Map of rich text descriptions for all items Contained info can be reachable through current_items, this is for faster access

local last_event -> map

The last handled UI event

local dialog_ret -> map<string,any>

The return value to be returned by WizardHW::WaitForEvent ()

Info:

Callback Perform an action (when an event which is not handled internally occurred)

Info:

Callback Get rich text description of an item. This can be used to set it dynamically

Info:

Callback Set all the items Should call the SetContents function of this module

Info:

Callback Select the initial item If not set, the first is selected

local SimpleStoreReturnValue (string selected, map event) -> symbol

Store the event description in internal variable To be used by WizardHW::WaitForEvent function

Parameters:
selected string the ID of the currently selected item
event a map of the current item
Return value:
always a non-nil symbol (needed just to finish event loop
local _SetSelectedItem (string selected) -> void

Set which item is to be selected

Parameters:
selected string the item that is should be marked as selected
local Init (string key) -> void

Init function of the widget Used when using the callback interface

Parameters:
key strnig the widget key
local Handle (string key, map event) -> symbol

Handle function of the widget Used when using the callback interface

Parameters:
key strnig the widget key
event map event to be handled
Return value:
for wizard sequencer or nil
local GetActionLabel (list action) -> string

Get the description label for the action

Parameters:
action a list describing the action
Return value:
the label of the action
local CreateActionsButton (list<list> actions) -> term

Create the Push/Menu button for additional actions

Parameters:
actions a list of the actions
Return value:
the widget
global CreateWidget (list<string> headers, list<list> actions) -> map<string,any>

Create CWM widtet for the hardware settings NOTE: The Init and Handle callbacks must be defined

Parameters:
headers a list of headers of the table
actions a list of additionaly offered actions, see CreateHWDialog function for details
Return value:
a map a widget for CWM
global RunHWDialog (map settings) -> symbol

Draw the dialog, handle all its events via callbacks

Parameters:
settings a map containing all the settings: $[ "action_callback" : symbol(string,map) -- callback to handle all events which aren't handled internally, first parameter is the ID of the selected item, second is the event. If not set, events which are symbols are returned to wizard sequencer "set_items_callback" : void() -- callback to set the items to be displayed. Should called WizardHW::SetContents instead of direct widgets modification, as it stores the settings also internally. This callback must be set. "set_initial_item_callback" : void() -- callback to set the selected item when dialog initialized. Should call the function WizardHW::SetSelectedItem instead of manual widget modification. If not set, the first item is selected. "item_descr_callback" : string(string) -- callback to get rich text description of the item if it is intended to be dynamical. if not set, static description set via "set_items_callback" is used. "actions" : list -- a list of actions to be offered via additional button next to Add/Edit/Delete button. Each item is a two-item-list, where the first item is the event ID and the second item is the label of the entry of the menu button. If there is only one entry, menu button is replaced by push button. If empty (or not specifued), nothing is shown. "title" : string -- the dialog title, must be specified "help" : string -- the help for the dialog, must be specifed "headers" : list -- a list of the table headers, must be specified "next_button" : string -- label for the "Next" button. To hide it, set to nil. If not specified, "Next" is used. "back_button" : string -- label for the "Back" button. To hide it, set to nil. If not specified, "Back" is used. "abort_button" : string -- label for the "Abort" button. To hide it, set to nil. If not specified, "Abort" is used. ]
Return value:
for wizard sequencer
global CreateHWDialog (string title, string help, list<string> headers, list<list> actions) -> void

Create the Hardware Wizard dialog Draw the dialog

Parameters:
title string the dialog title
help string the help for the dialog
headers a list of the table headers
actions a list of actions to be offered via additional button next to Add/Edit/Delete button. Each item is a two-item-list, where the first item is the event ID and the second item is the label of the entry of the menu button. If there is only one entry, menu button is replaced by push button. If empty (or not specifued), nothing is shown. below the widgets (next to other buttons)
global SetSelectedItem (string selected) -> void

Set which item is to be selected

Parameters:
selected string the item that is should be marked as selected
global SelectedItem () -> string

Return the id of the currently selected item in the table

Return value:
id of the selected item
global SetRichDescription (string descr) -> void

Set the rich text description.

Parameters:
descr rich text description
global SetContents (list<map<string,any> > items) -> void

Set the information about hardware

Parameters:
items a list of maps, one item per item in the dialog, with keys "id" : string = the identification of the device, "rich_descr" : string = RichText description of the device "table_descr" : list = fields of the table
global WaitForEvent () -> map<string,any>

Wait for event from the event

Return value:
a map with keys: "event" : map = event as returned from UI::WaitForEvent (), "selected" : string = ID of the selected item in the list box
global UserInput () -> map<string,any>

Wait for event from the event

Return value:
a map with keys: "event" : any = event as returned from UI::UserInoput () "selected" : string = ID of the selected item in the list box
global CreateRichTextDescription (string title, list<string> properties) -> string

Create rich text description of a device. It can be used for WizardHW::SetContents function for formatting richtext device descriptions

Parameters:
title header - usually device name
properties important properties of the device which should be displayed in the overview dialog
Return value:
rich text string
global UnconfiguredDevice () -> list<string>

Get propertly list of an unconfigured device. Should be used together with device name in CreateRichTextDescription() function.

Return value:
a list of strings