Yast UI
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
YCP_UI Class Reference

Static Public Member Functions

static YCPValue AskForExistingDirectory (const YCPString &startDir, const YCPString &headline)
 Ask user for existing directory. More...
 
static YCPValue AskForExistingFile (const YCPString &startDir, const YCPString &filter, const YCPString &headline)
 Ask user for existing file. More...
 
static YCPValue AskForSaveFileName (const YCPString &startDir, const YCPString &filter, const YCPString &headline)
 Ask user for a file to save data to. More...
 
static void BusyCursor ()
 Sets the mouse cursor to the busy cursor. More...
 
static void Beep ()
 Beeps the system bell. More...
 
static YCPValue ChangeWidget (const YCPValue &widgetId, const YCPValue &property, const YCPValue &new_value)
 Changes widget contents. More...
 
static void CheckShortcuts ()
 Performs an explicit shortcut check after postponing shortcut checks. More...
 
static YCPValue CloseDialog ()
 Closes an open dialog. More...
 
static void CloseUI ()
 Closes NCurses and enables stdout. More...
 
static void DumpWidgetTree ()
 Debugging function. More...
 
static void FakeUserInput (const YCPValue &nextInput)
 Fakes User Input. More...
 
static YCPMap GetDisplayInfo ()
 Gets Display Info. More...
 
static YCPString GetLanguage (const YCPBoolean &stripEncoding)
 Gets Language. More...
 
static YCPString GetProductName ()
 Gets Product Name. More...
 
static YCPString Glyph (const YCPSymbol &symbol)
 Returns a special character (a 'glyph') More...
 
static YCPValue HasSpecialWidget (const YCPSymbol &widget)
 Checks for support of a special widget type. More...
 
static void MakeScreenShot (const YCPString &filename)
 Makes Screen Shot. More...
 
static void NormalCursor ()
 Sets the mouse cursor to the normal cursor. More...
 
static YCPBoolean OpenContextMenu (const YCPTerm &term)
 
static YCPBoolean OpenDialog (const YCPTerm &opts, const YCPTerm &dialogTerm)
 Opens a Dialog with options. More...
 
static void OpenUI ()
 Opens NCurses and disables stdout. More...
 
static void PlayMacro (const YCPString &filename)
 Plays a recorded macro. More...
 
static void PostponeShortcutCheck ()
 Postpones Shortcut Check. More...
 
static YCPValue QueryWidget (const YCPValue &widgetId, const YCPValue &property)
 Queries Widget contents. More...
 
static void RecalcLayout ()
 Recalculates Layout. More...
 
static YCPValue Recode (const YCPString &fromEncoding, const YCPString &toEncoding, const YCPString &text)
 Recodes encoding of string from or to "UTF-8" encoding. More...
 
static void RecordMacro (const YCPString &fileName)
 Records Macro into a file. More...
 
static void RedrawScreen ()
 Redraws the screen. More...
 
static YCPBoolean ReplaceWidget (const YCPValue &widgetId, const YCPTerm &term)
 
static YCPValue RunPkgSelection (const YCPValue &widgetId)
 Initializes and run the PackageSelector widget. More...
 
static void SetConsoleFont (const YCPString &magic, const YCPString &font, const YCPString &screen_map, const YCPString &unicode_map, const YCPString &encoding)
 Sets Console Font. More...
 
static void SetKeyboard ()
 Sets Keyboard. More...
 
static YCPInteger RunInTerminal (const YCPString &module)
 runs external program in the same terminal More...
 
static YCPBoolean SetFocus (const YCPValue &widgetId)
 Sets Focus to the specified widget. More...
 
static void SetFunctionKeys (const YCPMap &functionKeyMap)
 Sets the (default) function keys for a number of buttons. More...
 
static void SetLanguage (const YCPString &lang, const YCPString &encoding=YCPNull())
 Sets the language of the UI. More...
 
static void SetProductName (const YCPString &name)
 Sets Product Name. More...
 
static void StopRecordMacro ()
 Stops recording macro. More...
 
static YCPBoolean WidgetExists (const YCPValue &widgetId)
 Checks whether or not a widget with the given ID currently exists. More...
 
static YCPValue UserInput ()
 User Input. More...
 
static YCPValue TimeoutUserInput (const YCPInteger &timeout)
 User Input with Timeout. More...
 
static YCPValue WaitForEvent (const YCPInteger &timeout=YCPNull())
 Waits for Event. More...
 
static YCPValue WizardCommand (const YCPTerm &command)
 Runs a wizard command. More...
 
static YCPValue PollInput ()
 Poll Input. More...
 
static YCPBoolean TextMode ()
 Check if the UI is running in text (NCurses) mode. More...
 
static YCPValue SetReleaseNotes (const YCPMap &relnotes)
 Sets the Release Notes to be displayed by a special-purpose button. More...
 
static YCPValue SetProductLogo (const YCPBoolean &show_logo)
 
static YCPValue SetApplicationIcon (const YCPString &icon)
 
static YCPValue SetApplicationTitle (const YCPString &text)
 Sets the title for application. More...
 
static YCPValue evaluateCallback (const YCPTerm &term, bool to_wfm)
 

Static Protected Member Functions

static YCPValue doUserInput (const char *builtin_name, long timeout_millisec, bool wait, bool detailed)
 

Static Protected Attributes

static std::deque< YCPValue > _fakeUserInputQueue
 

Member Function Documentation

◆ AskForExistingDirectory()

YCPValue YCP_UI::AskForExistingDirectory ( const YCPString &  startDir,
const YCPString &  headline 
)
static

Ask user for existing directory.

Opens a directory selection box and prompt the user for an existing directory.

Parameters
stringstartDir is the initial directory that is displayed.
stringheadline is an explanatory text for the directory selection box. Graphical UIs may omit that if no window manager is running.
Returns
string Returns the selected directory name or nil if the user canceled the operation.

◆ AskForExistingFile()

YCPValue YCP_UI::AskForExistingFile ( const YCPString &  startDir,
const YCPString &  filter,
const YCPString &  headline 
)
static

Ask user for existing file.

Opens a file selection box and prompt the user for an existing file.

Parameters
stringstartWith is the initial directory or file.
stringfilter is one or more blank-separated file patterns, e.g. "*.png *.jpg"
stringheadline is an explanatory text for the file selection box. Graphical UIs may omit that if no window manager is running.
Returns
string Returns the selected file name or nil if the user canceled the operation.

◆ AskForSaveFileName()

YCPValue YCP_UI::AskForSaveFileName ( const YCPString &  startDir,
const YCPString &  filter,
const YCPString &  headline 
)
static

Ask user for a file to save data to.

Opens a file selection box and prompt the user for a file to save data to. Automatically asks for confirmation if the user selects an existing file.

Parameters
stringstartWith is the initial directory or file.
stringfilter is one or more blank-separated file patterns, e.g. "*.png *.jpg"
stringheadline is an explanatory text for the file selection box. Graphical UIs may omit that if no window manager is running.
Returns
string Returns the selected file name or nil if the user canceled the operation.

◆ Beep()

void YCP_UI::Beep ( )
static

Beeps the system bell.

Beeps the system bell. This is implemented by the frontend, which may do a visual beep if the system is set up that way (eg. for accessiblity purposes).

Returns
void

◆ BusyCursor()

void YCP_UI::BusyCursor ( )
static

Sets the mouse cursor to the busy cursor.

Sets the mouse cursor to the busy cursor, if the UI supports such a feature.

This should normally not be necessary. The UI handles mouse cursors itself: When input is possible (i.e. inside UserInput() ), there is automatically a normal cursor, otherwise, there is the busy cursor. Override this at your own risk.

Returns
void

◆ ChangeWidget()

YCPValue YCP_UI::ChangeWidget ( const YCPValue &  widgetId,
const YCPValue &  property,
const YCPValue &  new_value 
)
static

Changes widget contents.

Changes a property of a widget of the topmost dialog. id specified the widget to change, property specifies the property that should be changed, newvalue gives the new value.

For example in order to change the label of an InputField with id name to "anything", you write <tt>ChangeWidget(id(<tt>name),Label, "anything" ).

Parameters
symbolwidgetId Can also be specified as `id( any widgetId )
symbolproperty
anynewValue
Returns
boolean Returns true on success.

◆ CheckShortcuts()

void YCP_UI::CheckShortcuts ( )
static

Performs an explicit shortcut check after postponing shortcut checks.

Performs an explicit shortcut check after postponing shortcut checks. Use this after calling PostponeShortcutCheck().

The normal sequence looks like this:

PostponeShortcutChecks(); ReplaceWidget( ... ); ReplaceWidget( ... ); ... ReplaceWidget( ... ); CheckShortcuts(); ... UserInput();

Returns
void

◆ CloseDialog()

YCPValue YCP_UI::CloseDialog ( )
static

Closes an open dialog.

Closes the most recently opened dialog. It is an error to call CloseDialog if no dialog is open.

Returns
boolean Returns true on success.

◆ CloseUI()

void YCP_UI::CloseUI ( )
static

Closes NCurses and enables stdout.

Returns
void

◆ doUserInput()

YCPValue YCP_UI::doUserInput ( const char *  builtin_name,
long  timeout_millisec,
bool  wait,
bool  detailed 
)
staticprotected

Mid-level handler for the user input related UI commands: UserInput() TimeoutUserInput() WaitForEvent() PollInput()

'builtin_name' is the name of the specific UI builtin command (to use the correct name in the log file).

'timeout_millisec' is the timeout in milliseconds to use (0 for "wait forever").

'wait' specifies if this should wait until an event is available if there is none yet.

'detailed' specifies if a full-fledged event map is desired as return value (WaitForEvent()) or one simple YCPValue (an ID).

◆ DumpWidgetTree()

void YCP_UI::DumpWidgetTree ( )
static

Debugging function.

Debugging function: Dumps the widget tree of the current dialog to the log file.

Returns
void

◆ evaluateCallback()

YCPValue YCP_UI::evaluateCallback ( const YCPTerm &  term,
bool  to_wfm 
)
static

Not really a UI built-in: This implements the WFM or SCR callback command.

This is used for a callback mechanism. The expression will be sent to the WFM interpreter and evaluated there. USE WITH CAUTION.

Parameters
blockexpression
Returns
any

◆ FakeUserInput()

void YCP_UI::FakeUserInput ( const YCPValue &  nextInput)
static

Fakes User Input.

Prepares a fake value for the next call to UserInput() - i.e. the next UserInput() will return exactly this value. This is only useful in connection with macros.

If called without a parameter, the next call to UserInput() will return "nil".

Optional Argument: any nextUserInput

Returns
void

◆ GetDisplayInfo()

YCPMap YCP_UI::GetDisplayInfo ( )
static

Gets Display Info.

Gets information about the current display and the UI's capabilities.

Function output might differ according to the system where called.

Returns
map <string any>="">

◆ GetLanguage()

YCPString YCP_UI::GetLanguage ( const YCPBoolean &  stripEncoding)
static

Gets Language.

Retrieves the current language setting from of the user interface. Since YaST2 is a client server architecture, we distinguish between the language setting of the user interface and that of the configuration modules. If the module or the translator wants to know which language the user currently uses, it can call GetLanguage. The return value is an ISO language code, such as "de" or "de_DE".

If "strip_encoding" is set to "true", all encoding or similar information is cut off, i.e. everything from the first "." or "@" on. Otherwise the current contents of the "LANG" environment variable is returned (which very likely ends with ".UTF-8" since this is the encoding YaST2 uses internally).

Parameters
booleanstrip_encoding
Returns
string

◆ GetProductName()

YCPString YCP_UI::GetProductName ( )
static

Gets Product Name.

Returns the current product name ("SuSE Linux", "United Linux", etc.) for display in dialogs. This can be set with SetProductName().

Note: In help texts in RichText widgets, a predefined macro &product; can be used for the same purpose.

Returns
string Product Name Usage: sformat( "Welcome to %1", GetProductName() );

◆ Glyph()

YCPString YCP_UI::Glyph ( const YCPSymbol &  symbol)
static

Returns a special character (a 'glyph')

Returns a special character (a 'glyph') according to the symbol specified.

Not all UIs may be capable of displaying every glyph; if a specific UI doesn't support it, a textual representation (probably in plain ASCII) will be returned.

This is also why there is only a limited number of predefined glyphs: An ASCII equivalent is required which is sometimes hard to find for some characters defined in Unicode / UTF-8.

Please note the value returned may consist of more than one character; for example, Glyph( `ArrowRight ) may return something like "-&gt;".

If an unknown glyph symbol is specified, 'nil' is returned.

Parameters
symbolglyph
Returns
string

◆ HasSpecialWidget()

YCPValue YCP_UI::HasSpecialWidget ( const YCPSymbol &  widget)
static

Checks for support of a special widget type.

Checks for support of a special widget type. Use this prior to creating a widget of this kind. Do not use this to check for ordinary widgets like PushButton etc. - just the widgets where the widget documentation explicitly states it is an optional widget not supported by all UIs.

Returns true if the UI supports the special widget and false if not.

◆ MakeScreenShot()

void YCP_UI::MakeScreenShot ( const YCPString &  filename)
static

Makes Screen Shot.

Makes a screen shot if the specific UI supports that. The Qt UI opens a file selection box if filename is empty.

Parameters
stringfilename
Returns
void

◆ NormalCursor()

void YCP_UI::NormalCursor ( )
static

Sets the mouse cursor to the normal cursor.

Sets the mouse cursor to the normal cursor (after BusyCursor), if the UI supports such a feature.

This should normally not be necessary. The UI handles mouse cursors itself: When input is possible (i.e. inside UserInput() ), there is automatically a normal cursor, otherwise, there is the busy cursor. Override this at your own risk.

Returns
void

◆ OpenContextMenu()

YCPBoolean YCP_UI::OpenContextMenu ( const YCPTerm &  term)
static

Opens a context menu when the users right clickes a widget

Example: OpenContextMenu( menu( [item(id(folder), "&Entry1" ), menu( "&Submenu1", [item(id(text), "&Entry2" ), item(id(`image), "&Entry3" ) ]) ] ));

Parameters
itemListlist of menu items
Returns
bool Returns true when the context menu was shown, on error (e.g. not supported by ui) false is returned.

◆ OpenDialog()

YCPBoolean YCP_UI::OpenDialog ( const YCPTerm &  opts,
const YCPTerm &  dialogTerm 
)
static

Opens a Dialog with options.

Id of widget: OpenDialog_with_options Same as the OpenDialog with one argument, but you can specify options with a term of the form `opt.

The `mainDialog option creates a "main window" dialog: The dialog will get a large "default size". In the Qt UI, this typically means 800x600 pixels large (or using a -geometry command line argument if present) or full screen. In the NCurses UI, this is always full screen.

defaultsize</tt> is an alias for <tt>mainDialog.

`wizardDialog is a main dialog that will contain a wizard widget. For UIs that don't support this kind of specialized dialog, this is equivalent to `mainDialog – see also the HasWizardDialogSupport entry of the map returned by UI::GetDisplayInfo().

The `warncolor option displays the entire dialog in a bright warning color.

The `infocolor option displays the dialog in a color scheme that is distinct from the normal colors, but not as bright as warncolor.

The `decorated option is now obsolete, but still accepted to keep old code working.

The `centered option is now obsolete, but still accepted to keep old code working.

Parameters
termoptions
termwidget
Returns
boolean true if success, false if error

Usage: OpenDialog( opt(defaultsize ), `Label( "Hello, World!" ) )

◆ OpenUI()

void YCP_UI::OpenUI ( )
static

Opens NCurses and disables stdout.

To mix TUI (NCurses) with stdio, enclose the UI parts within an OpenUI/CloseUI pair.

Returns
void

◆ PlayMacro()

void YCP_UI::PlayMacro ( const YCPString &  filename)
static

Plays a recorded macro.

Executes everything in macro file "macroFileName". Any errors are sent to the log file only. The macro can be terminated only from within the macro file.

Parameters
stringmacroFileName
Returns
void

◆ PollInput()

YCPValue YCP_UI::PollInput ( )
static

Poll Input.

Doesn't wait but just looks if the user has clicked some button, has closed the window or has activated some widget that has the `notify option set. Returns the id of the widget that has been selected or `cancel if the user selected the implicit cancel button (for example he closes the window). Returns nil if no user input has occured.

Returns
any

◆ PostponeShortcutCheck()

void YCP_UI::PostponeShortcutCheck ( )
static

Postpones Shortcut Check.

Postpone keyboard shortcut checking during multiple changes to a dialog.

Normally, keyboard shortcuts are checked automatically when a dialog is created or changed. This can lead to confusion, however, when multiple changes to a dialog (repeated ReplaceWidget() calls) cause unwanted intermediate states that may result in shortcut conflicts while the dialog is not final yet. Use this function to postpone this checking until all changes to the dialog are done and then explicitly check with CheckShortcuts(). Do this before the next call to UserInput() or PollInput() to make sure the dialog doesn't change "on the fly" while the user tries to use one of those shortcuts.

The next call to UserInput() or PollInput() will automatically perform that check if it hasn't happened yet, any an error will be issued into the log file.

Use only when really necessary. The automatic should do well in most cases.

The normal sequence looks like this:

PostponeShortcutChecks(); ReplaceWidget( ... ); ReplaceWidget( ... ); ... ReplaceWidget( ... ); CheckShortcuts(); ... UserInput();

Returns
void

◆ QueryWidget()

YCPValue YCP_UI::QueryWidget ( const YCPValue &  widgetId,
const YCPValue &  property 
)
static

Queries Widget contents.

Queries a property of a widget of the topmost dialog. For example in order to query the current text of an InputField with id name, you write <tt>QueryWidget(id(<tt>name),Value ). In some cases the propery can be given as term in order to further specify it. An example is QueryWidget( id(table ), `Item( 17 ) ) for a table where you query a certain item.

Parameters
symbolwidgetId Can also be specified as `id( any id )
symbol|termproperty
Returns
any

◆ RecalcLayout()

void YCP_UI::RecalcLayout ( )
static

Recalculates Layout.

Recompute the layout of the current dialog.

This is a very expensive operation.

Use this after changing widget properties that might affect their size - like the a Label widget's value. Call this once (!) after changing all such widget properties.

Returns
void

◆ Recode()

YCPValue YCP_UI::Recode ( const YCPString &  fromEncoding,
const YCPString &  toEncoding,
const YCPString &  text 
)
static

Recodes encoding of string from or to "UTF-8" encoding.

Recodes encoding of string from or to "UTF-8" encoding. One of from/to must be "UTF-8", the other should be an iso encoding specifier (i.e. "ISO-8859-1" for western languages, "ISO-8859-2" for eastern languages, etc. )

Parameters
stringfromEncoding
stringtoEncoding
stringtext
Returns
any

◆ RecordMacro()

void YCP_UI::RecordMacro ( const YCPString &  fileName)
static

Records Macro into a file.

Begins recording a macro. Write the macro contents to file "macroFilename".

Parameters
stringmacroFileName
Returns
void

◆ RedrawScreen()

void YCP_UI::RedrawScreen ( )
static

Redraws the screen.

Redraws the screen after it very likely has become garbled by some other output.

This should normally not be necessary: The (specific) UI redraws the screen automatically whenever required. Under rare circumstances, however, the screen might have changes due to circumstances beyond the UI's control: For text based UIs, for example, system commands that cause output to every tty might make this necessary. Call this in the YCP code after such a command.

Returns
void

◆ ReplaceWidget()

YCPBoolean YCP_UI::ReplaceWidget ( const YCPValue &  widgetId,
const YCPTerm &  term 
)
static

Replaces a complete widget (or widget subtree) with an other widget (or widget tree). You can only replace the widget contained in a ReplacePoint. As parameters to ReplaceWidget specify the id of the ReplacePoint and the new widget.

Parameters
symbolid
termnewWidget
Returns
true if success, false if failed

◆ RunInTerminal()

YCPInteger YCP_UI::RunInTerminal ( const YCPString &  module)
static

runs external program in the same terminal

Use this builtin if you want to run an external program from the NCcurses UI as a separate process. It saves the current window layout and runs the external program in the same terminal. When done, it restores the original window layout and returns the exit code of the external program. When called from the Qt UI, an error message is printed to the log.

Parameters
stringexternal_program return integer

Usage: RunInTerminal("/bin/bash")

◆ RunPkgSelection()

YCPValue YCP_UI::RunPkgSelection ( const YCPValue &  widgetId)
static

Initializes and run the PackageSelector widget.

Not to be used outside the package selection

Initialize and run the PackageSelector widget identified by 'pkgSelId'.

Black magic to everybody outside. ;- )

Parameters
anypkgSelId
Returns
any Returns `cancel if the user wishes to cancel his selections.

◆ SetApplicationTitle()

YCPValue YCP_UI::SetApplicationTitle ( const YCPString &  text)
static

Sets the title for application.

The argument is a string to display. Empty string means clear the title.

Parameters
stringtitle string to display.

◆ SetConsoleFont()

void YCP_UI::SetConsoleFont ( const YCPString &  magic,
const YCPString &  font,
const YCPString &  screen_map,
const YCPString &  unicode_map,
const YCPString &  encoding 
)
static

Sets Console Font.

Switches the text console to the specified font. See the setfont(8) command and the console HowTo for details.

See also
setfont(8)
Parameters
stringconsole_magic
stringfont
stringscreen_map
stringunicode_map
stringlanguage
Returns
void

Usage: SetConsoleFont( "( K", "lat2u-16.psf", "latin2u.scrnmap", "lat2u.uni", "latin1" )

◆ SetFocus()

YCPBoolean YCP_UI::SetFocus ( const YCPValue &  widgetId)
static

Sets Focus to the specified widget.

Sets the keyboard focus to the specified widget. Notice that not all widgets can accept the keyboard focus; this is limited to interactive widgets like PushButtton, InputField, SelectionBox etc. - manager widgets like VBox, HBox etc. will not accept the keyboard focus. They will not propagate the keyboard focus to some child widget that accepts the focus. Instead, an error message will be emitted into the log file.

Parameters
symbolwidgetId
Returns
boolean Returns true on success (i.e. the widget accepted the focus).

◆ SetFunctionKeys()

void YCP_UI::SetFunctionKeys ( const YCPMap &  functionKeyMap)
static

Sets the (default) function keys for a number of buttons.

This function receives a map with button labels and the respective function key number that should be used if on other opt(key_F.. ) is specified.

Any keyboard shortcuts in those labels are silently ignored so this is safe to use even if the UI's internal shortcut manager rearranges shortcuts.

Each call to this function overwrites the data of any previous calls.

Parameters
mapfkeys
Returns
void Usage: SetFunctionKeys( $[ "Back": 8, "Next": 10, ... ] );

◆ SetKeyboard()

void YCP_UI::SetKeyboard ( )
static

Sets Keyboard.

Returns
void Usage: SetKeyboard()

◆ SetLanguage()

void YCP_UI::SetLanguage ( const YCPString &  lang,
const YCPString &  encoding = YCPNull() 
)
static

Sets the language of the UI.

Tells the UI that the user has selected another language. If the UI has any language dependend output that language setting is honored. lang is an ISO language string, such as de or de_DE. It is required to specify an encoding scheme, since not all user interfaces are capable of UTF-8.

Parameters
stringlang Language selected by user Optional Argument: string encoding
Returns
void

Usage: SetLanguage( "de_DE@euro" ) Usage: SetLanguage( "en_GB" )

◆ SetProductName()

void YCP_UI::SetProductName ( const YCPString &  name)
static

Sets Product Name.

Sets the current product name ("SuSE Linux", "United Linux", etc.) for displaying in dialogs and in RichText widgets (for help text) with the RichText &product; macro.

This product name should be concise and meaningful to the user and not cluttered with detailed version information. Don't use something like "SuSE Linux 12.3-i786 Professional". Use something like "SuSE Linux" instead.

This information can be retrieved with the GetProductName() builtin.

Parameters
stringprod
Returns
void

Usage: SetProductName( "SuSE HyperWall" );

◆ SetReleaseNotes()

YCPValue YCP_UI::SetReleaseNotes ( const YCPMap &  relnotes)
static

Sets the Release Notes to be displayed by a special-purpose button.

The argument is a map from product names (strings) to the actual relase notes (rich text strings)

Parameters
maprelnotes maps product names to their release notes

◆ StopRecordMacro()

void YCP_UI::StopRecordMacro ( )
static

Stops recording macro.

Stops macro recording. This is only necessary if you don't wish to record everything until the program terminates.

Returns
void

◆ TextMode()

YCPBoolean YCP_UI::TextMode ( )
static

Check if the UI is running in text (NCurses) mode.

This checks if a text mode UI (NCurses) is currently running. Please notice that this is almost always bad style. The purpose of the YaST2 UI is to have an abstraction layer to avoid this kind of check.

When you find yourself using this built-in, please check if there is really no other way. In particular, NEVER rely on this check to make any assumptions on the UI's capabilities. Rather, use the map entries from UI::GetDisplayInfo() or UI::HasSpecialWidget().

If you feel you must make a difference between text mode and GUI mode for a dialog's layout, please check if that dialog is not simply overcrowded and thus should be redesigned - it is very likely that it is also overly complex.

Also keep in mind that layout units are UI independent; a spacing should consume about the same amount of space in all UIs. A Qt UI 800x600 main window corresponds to 80x25 layout units, i.e. the typical NCurses terminal size.

Returns
true if text mode, false if GUI (Qt / Gtk).

◆ TimeoutUserInput()

YCPValue YCP_UI::TimeoutUserInput ( const YCPInteger &  timeout)
static

User Input with Timeout.

Waits for the user to click some button, close the window or activate some widget that has the `notify option set or until the specified timeout is expired. The return value is the id of the widget that has been selected or `cancel if the user selected the implicit cancel button (for example he closes the window). Upon timeout, `timeout is returned.

Parameters
integertimeout_millisec
Returns
any

◆ UserInput()

YCPValue YCP_UI::UserInput ( )
static

User Input.

Waits for the user to click some button, close the window or activate some widget that has the `notify option set. The return value is the id of the widget that has been selected or `cancel if the user selected the implicit cancel button (for example he closes the window).

Returns
any

◆ WaitForEvent()

YCPValue YCP_UI::WaitForEvent ( const YCPInteger &  timeout = YCPNull())
static

Waits for Event.

Extended event handling - very much like UserInput(), but returns much more detailed information about the event that occured in a map.

Optional Argument: timeout_millisec

Returns
map

◆ WidgetExists()

YCPBoolean YCP_UI::WidgetExists ( const YCPValue &  widgetId)
static

Checks whether or not a widget with the given ID currently exists.

Checks whether or not a widget with the given ID currently exists in the current dialog. Use this to avoid errors in the log file before changing the properties of widgets that might or might not be there.

Parameters
symbolwidgetId
Returns
boolean

◆ WizardCommand()

YCPValue YCP_UI::WizardCommand ( const YCPTerm &  command)
static

Runs a wizard command.

Issues a command to a wizard widget with ID 'wizardId'.

This builtin is not for general use. Use the Wizard.ycp module instead.

For available wizard commands see file YCPWizardCommandParser.cc . If the current UI does not provide a wizard widget, 'false' is returned. It is safe to call this even for UIs that don't provide a wizard widget. In this case, all calls to this builtin simply return 'false'.

Parameters
termwizardCommand
Returns
boolean Returns true on success.

Member Data Documentation

◆ _fakeUserInputQueue

std::deque< YCPValue > YCP_UI::_fakeUserInputQueue
staticprotected

Queue for synthetic (faked) user input events. Filled with FakeUserInput(), consumed with UserInput() and related.


The documentation for this class was generated from the following files: