YaST2 Developers Documentation: yast2

yast2

modules/Popup.ycp
Commonly used popup dialogs
  • Gabriele Strattner
  • Stefan Hundhammer
  • Arvin Schnell

This module has an unstable interface.

Contains commonly used popup dialogs for general usage, e.g. Popup::YesNo(), Popup::ContinueCancel().
See also README.popups

Imports

  • Directory
  • Icon
  • Label
  • Mode
  • String

Global Functions

Local Functions

local popupLayoutInternalTypeWithLabel (string headline, string message, string icon_name, term button_box, string label, boolean richtext, integer width, integer height) -> term

Internal function that returns a popup dialog with an additional label.

Parameters:
headline headline to show or Popup::NoHeadline()
message message text to show
icon_name icon name (with full path) or Popup::NoIcon()
button_box term with one or more buttons
label second label with id `label which can be used e.g. for time out value displaying
richtext
width
height
Return value:
the layout contents as a term
local popupLayoutInternal (string headline, string message, string icon_name, term button_box) -> term

Internal function - wrapper for popupLayoutInternalTypeWithLabel call

Parameters:
headline
message
icon_name
button_box
local popupLayoutInternalRich (string headline, string message, string icon_name, term button_box, integer width, integer height) -> term

Internal function - wrapper for popupLayoutInternalTypeWithLabel call

Parameters:
headline
message
icon_name
button_box
width
height
local anyTimedMessageTypeInternal (string headline, string message, string icon_name, integer timeout, boolean richtext, integer width, integer height) -> void

Internal version of AnyTimedMessage

Show a message with optional headline above and wait until user clicked "OK" or until a timeout runs out.

Parameters:
headline optional headline or Popup::NoHeadline()
message the message (maybe multi-line) to display.
icon_name icon name (with full path) or Popup::NoIcon()
timeout After timeout seconds dialog will be automatically closed
richtext
width
height
local anyTimedMessageInternal (string headline, string message, string icon_name, integer timeout) -> void

Internal function - wrapper for anyTimedMessageTypeInternal call

Parameters:
headline
message
icon_name
timeout
local anyTimedRichMessageInternal (string headline, string message, string icon_name, integer timeout, integer width, integer height) -> void

Internal function - wrapper for anyTimedMessageTypeInternal call

Parameters:
headline
message
icon_name
timeout
width
height
global NoHeadline () -> string

Indicator for empty headline for popups that can optionally have one

This is really just an alias for the empty string "", but it is slightly better readable.

Return value:
empty string ("")
global NoIcon () -> string

Indicator for empty icon for popups that can have one - for code readability.

local AnyQuestionButtonBox (string yes_button_message, string no_button_message, symbol focus) -> term

Button box for the AnyQuestion Dialog (internal function).

Parameters:
yes_button_message label on affirmative buttons (on left side)
no_button_message label on negating button (on right side)
focus `focus_yes (first button) or `focus_no (second button)
Return value:
button box
global AnyQuestion (string headline, string message, string yes_button_message, string no_button_message, symbol focus) -> boolean

Generic question popup with two buttons.

Style guide hint: The first button has to have the semantics of "yes", "OK", "continue" etc., the second its opposite ("no", "cancel", ...). NEVER use this generic question popup to simply exchange the order of yes/no, continue/cancel or ok/cancel buttons!

Parameters:
headline headline or Popup::NoHeadline()
message message string
yes_button_message label on affirmative buttons (on left side)
no_button_message label on negating button (on right side)
focus `focus_yes (first button) or `focus_no (second button)
Return value:
true: first button has been clicked false: second button has been clicked
Example
 Popup::AnyQuestion( Label::WarningMsg(), "Do really want to ...?", "Install", "Don't do it", `focus_no );
See
YesNo ContinueCancel
global ErrorAnyQuestion (string headline, string message, string yes_button_message, string no_button_message, symbol focus) -> boolean

Generic error question popup with two buttons.

Style guide hint: The first button has to have the semantics of "yes", "OK", "continue" etc., the second its opposite ("no", "cancel", ...). NEVER use this generic question popup to simply exchange the order of yes/no, continue/cancel or ok/cancel buttons!

Parameters:
headline headline or Popup::NoHeadline()
message message string
yes_button_message label on affirmative buttons (on left side)
no_button_message label on negating button (on right side)
focus `focus_yes (first button) or `focus_no (second button)
Return value:
true: first button has been clicked false: second button has been clicked
Example
 Popup::ErrorAnyQuestion( Label::WarningMsg(), "Do really want to ...?", "Install", "Don't do it", `focus_no );
See
YesNo ContinueCancel
global TimedAnyQuestion (string headline, string message, string yes_button_message, string no_button_message, symbol focus, integer timeout_seconds) -> boolean

Timed question popup with two buttons and time display

Parameters:
headline headline or Popup::NoHeadline()
message message string
yes_button_message label on affirmative buttons (on left side)
no_button_message label on negating button (on right side)
focus `focus_yes (first button) or `focus_no (second button)
timeout_seconds timeout, if 0, normal behaviour
Return value:
True if Yes, False if no
See
AnyQuestion
global TimedErrorAnyQuestion (string headline, string message, string yes_button_message, string no_button_message, symbol focus, integer timeout_seconds) -> boolean

Timed error question popup with two buttons and time display

Parameters:
headline headline or Popup::NoHeadline()
message message string
yes_button_message label on affirmative buttons (on left side)
no_button_message label on negating button (on right side)
focus `focus_yes (first button) or `focus_no (second button)
timeout_seconds timeout, if 0, normal behaviour
Return value:
True if Yes, False if no
See
AnyQuestion
global ContinueCancelHeadline (string headline, string message) -> boolean

Dialog which displays the "message" and has a Continue and a Cancel button.

This popup should be used to confirm possibly dangerous actions and if it's useful to display a short headline (without headline Popup::ContinueCancel() can be used). The default button is Continue.

Returns true if Continue is clicked.

Parameters:
headline short headline or Popup::NoHeadline()
message message string
Return value:
Example
 Popup::ContinueCancelHeadline ( "Short Header", "Going on with action....?" );
See
ContinueCancel YesNo AnyQuestion
global ContinueCancel (string message) -> boolean

Dialog which displays the "message" and has a Continue and a Cancel button.

This popup should be used to confirm possibly dangerous actions. The default button is Continue. Returns true if Continue is clicked.

Parameters:
message message string
Return value:
Example
 Popup::ContinueCancel ( "Please insert required CD-ROM." );
See
AnyQuestion
global YesNoHeadline (string headline, string message) -> boolean

This dialog displays "message" (a question) and has a Yes and a No button.

It should be used for decisions about two about equivalent paths, not for simple confirmation - use "Popup::ContinueCancel()" for those. A short headline can be displayed (without headline you can use Popup::YesNo()).

The default button is Yes.

Returns true if Yes is clicked.

Parameters:
headline short headline or Popup::NoHeadline()
message message string
Return value:
true if [Yes] has been pressed
Example
  Popup::YesNoHeadline ( "Resize Windows Partition?", "... explanation of dangers ..." );
See
YesNo AnyQuestion
global YesNo (string message) -> boolean

Display a yes/no question and wait for answer.

Should be used for decisions about two about equivalent paths, not for simple confirmation - use "Popup::ContinueCancel()" for those. The default button is Yes. Returns true if Yes is clicked.

Parameters:
message message string
Return value:
true if [Yes] has been pressed
Example
  Popup::YesNo ( "Create a backup of the config files?" );
See
YesNoHeadline ContinueCancel AnyQuestion
global LongText (string headline, term richtext, integer hdim, integer vdim) -> void

Show a long text that might need scrolling.

Pass a RichText widget with the parameters appropriate for your text - i.e. without special parameters for HTML-like text or with `opt(`plainText) for plain ASCII text without HTML tags.

Parameters:
headline short headline
richtext text input is `Richtext()
hdim initial horizontal dimension of the popup
vdim initial vertical dimension of the popup
Example
 Popup::LongText ( "Package description", `Richtext("

Hello, this is a long description .....

"), 50, 20 );
global AnyQuestionRichText (string headline, string richtext, integer hdim, integer vdim, string yes_button_message, string no_button_message, symbol focus) -> boolean

Show a question that might need scrolling.

Parameters:
headline short headline
richtext text input as a rich text
hdim initial horizontal dimension of the popup
vdim initial vertical dimension of the popup
yes_button_message message on the left/true button
no_button_message message on the right/false button
focus `focus_yes, `focus_no, `focus_none
Return value:
left button pressed?
global ConfirmAbort (symbol severity) -> boolean

Confirmation for "Abort" button during installation.

According to the "severity" parameter an appropriate text will be displayed indicating what the user has to expect when he really aborts now.

Parameters:
severity `painless, `incomplete, `unusable
Return value:
Example
 Popup::ConfirmAbort ( `painless );
global ReallyAbort (boolean have_changes) -> boolean

Confirmation popup when user clicked "Abort".

Set "have changes" to "true" when there are changes that will be lost. Note: If there are none, it is good policy to ask for confirmation anyway, but of course with "have_changes" set to "false" so the user isn't warned about changes that might be lost.

Parameters:
have_changes true: There are changes that will be lost false: No changes
Return value:
true: "abort" confirmed; false: don't abort
local anyMessageDetailsInternalType (string headline, string message, string details, string icon_name, boolean richtext, integer width, integer height) -> void

Generic message popup with Details button - internal

Show a message with optional headline above and wait until user clicked "OK" or "Details". On "Details", show window with detailed information.

Parameters:
headline optional headline or Popup::NoHeadline()
message the message (maybe multi-line) to display.
details the detailed information text
icon_name
richtext
width
height
local anyMessageInternalType (string headline, string message, string icon_name, boolean richtext, integer width, integer height) -> void

Generic message popup - internal

Show a message with optional headline above and wait until user clicked "OK".

Parameters:
headline optional headline or Popup::NoHeadline()
message the message (maybe multi-line) to display.
icon_name
richtext
width
height
local anyMessageInternal (string headline, string message, string icon_name) -> void

Internal function - wrapper for anyMessageInternal call

Parameters:
headline
message
icon_name
local anyMessageInternalRich (string headline, string message, string icon_name, integer width, integer height) -> void

Internal function - wrapper for anyMessageInternal call

Parameters:
headline
message
icon_name
width
height
local anyMessageDetailsInternal (string headline, string message, string details, string icon_name) -> void

Internal function - wrapper for anyMessageDetailsInternalType call

Parameters:
headline
message
details
icon_name
local anyRichMessageInternal (string headline, string message, string icon_name, integer width, integer height) -> void

Generic message popup - internal

Show a message with optional headline above and wait until user clicked "OK".

Parameters:
headline optional headline or Popup::NoHeadline()
message the message (maybe multi-line) to display.
icon_name
width
height
global AnyMessage (string headline, string message) -> void

Generic message popup

Show a message with optional headline above and wait until user clicked "OK".

Parameters:
headline optional headline or Popup::NoHeadline()
message the message (maybe multi-line) to display.
global ClearFeedback () -> void

Clear feedback message

global ShowFeedback (string headline, string message) -> void

Show popup with a headline and a message for feedback

Parameters:
headline headline of Feedback popup
message the feedback message
global Message (string message) -> void

Show a simple message and wait until user clicked "OK".

Parameters:
message message string
Example
  Popup::Message("This is an information about ... ." );
See
AnyMessage Notify Warning Error
global LongMessage (string message) -> void

Show a long message and wait until user clicked "OK".

Parameters:
message message string (may contain rich text tags)
global LongMessageGeometry (string message, integer width, integer height) -> void

Show a long message and wait until user clicked "OK". Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
width width of the popup window
height height of the popup window
global TimedMessage (string message, integer timeout_seconds) -> void

Show a message and wait until user clicked "OK" or time is out

Parameters:
message message string
timeout_seconds time out in seconds
global TimedLongMessage (string message, integer timeout_seconds) -> void

Show a long message and wait until user clicked "OK" or time is out.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
global TimedLongMessageGeometry (string message, integer timeout_seconds, integer width, integer height) -> void

Show a long message and wait until user clicked "OK" or time is out. Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
width width of the popup window
height height of the popup window
global MessageDetails (string message, string details) -> void

Show a message with Details button and wait until user clicked "OK".

Parameters:
message message string
details detailed information string
Example
  Popup::MessageDetails("This is an information about ... .", "This service is intended to...");
See
Message
global Warning (string message) -> void

Show a warning message and wait until user clicked "OK".

Parameters:
message warning message string
Example
 Popup::Warning("Something is wrong. Please check your configuration." );
See
Message Notify Error AnyMessage
global LongWarning (string message) -> void

Show a long warning and wait until user clicked "OK".

Parameters:
message message string (may contain rich text tags)
global LongWarningGeometry (string message, integer width, integer height) -> void

Show a long warning and wait until user clicked "OK". Size of the popup window is adjustable

Parameters:
message message string (may contain rich text tags)
width width of the popup window
height height of the popup window
global TimedWarning (string message, integer timeout_seconds) -> void

Show a warning message and wait specified amount of time or until user clicked "OK".

Parameters:
message warning message string
timeout_seconds time out in seconds
Return value:
See
Warning
global TimedLongWarning (string message, integer timeout_seconds) -> void

Show a long warning message and wait until user clicked "OK" or time is out.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
global TimedLongWarningGeometry (string message, integer timeout_seconds, integer width, integer height) -> void

Show a long warning and wait until user clicked "OK" or time is out. Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
width width of the popup window
height height of the popup window
global WarningDetails (string message, string details) -> void

Show a warning with Details button and wait until user clicked "OK".

Parameters:
message warning message string
details detailed information string
Example
 Popup::WarningDetails("Something is wrong. Please check your configuration.", "possible problem is in..." );
See
Message
global Error (string message) -> void

Show an error message and wait until user clicked "OK".

Parameters:
message error message string
Example
  Popup::Error("The configuration was not succesful." );
See
Message Notify Warning AnyMessage
global LongError (string message) -> void

Show a long error and wait until user clicked "OK".

Parameters:
message message string (may contain rich text tags)
global LongErrorGeometry (string message, integer width, integer height) -> void

Show a long error message and wait until user clicked "OK". Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
width width of the popup window
height height of the popup window
global TimedError (string message, integer timeout_seconds) -> void

Show an error message and wait specified amount of time or until user clicked "OK".

Parameters:
message error message string
timeout_seconds time out in seconds
Return value:
See
Error
global TimedLongError (string message, integer timeout_seconds) -> void

Show a long error message and wait until user clicked "OK" or time is out.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
global TimedLongErrorGeometry (string message, integer timeout_seconds, integer width, integer height) -> void

Show a long error message and wait until user clicked "OK" or time is out. Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
width width of the popup window
height height of the popup window
global ErrorDetails (string message, string details) -> void

Show an error message with Details button and wait until user clicked "OK".

Parameters:
message error message string
details detailed information string
Example
  Popup::ErrorDetails("The configuration was not succesful.", "Service failed to start");
See
Message
global Notify (string message) -> void

Show a notification message and wait until user clicked "OK".

Parameters:
message notify message string
Example
  Popup::Notify("Your printer is ready for use." );
See
Message AnyMessage
global LongNotify (string message) -> void

Show a long notify message and wait until user clicked "OK".

Parameters:
message message string (may contain rich text tags)
global LongNotifyGeometry (string message, integer width, integer height) -> void

Show a long notify message and wait until user clicked "OK". Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
width width of the popup window
height height of the popup window
global TimedNotify (string message, integer timeout_seconds) -> void

Show a long notify message and wait until user clicked "OK" or the time is out.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
global TimedLongNotify (string message, integer timeout_seconds) -> void

Show a long error message and wait until user clicked "OK" or time is out.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
global TimedLongNotifyGeometry (string message, integer timeout_seconds, integer width, integer height) -> void

Show a long notify message and wait until user clicked "OK" or time is out. Size of the popup window is adjustable.

Parameters:
message message string (may contain rich text tags)
timeout_seconds time out in seconds
width width of the popup window
height height of the popup window
global NotifyDetails (string message, string details) -> void

Show a notify message with Details button and wait until user clicked "OK".

Parameters:
message error message string
details detailed information string
See
Message
global TimedOKCancel (string message, integer timeout_seconds) -> boolean

Display a message with a timeout

Display a message with a timeout and return when the user clicks "OK", "Cancel" or when the timeout expires ("OK" is assumed then).

There is also a "stop" button that will stop the countdown. If the user clicks that, the popup will wait forever (or until "OK" or "Cancel" is clicked, of course).

Parameters:
message message to display
timeout_seconds the timeout in seconds
Return value:
true --> "OK" or timer expired
false --> "Cancel"
Example
 boolean ret = Popup::TimedOKCancel("This is a timed message", 2 );
global AnyQuestion3 (string headline, string message, string yes_button_message, string no_button_message, string retry_button_message, symbol focus) -> symbol

Generic question popup with three buttons.

Parameters:
headline headline or Popup::NoHeadline()
message message string
yes_button_message label on affirmative button (on left side)
no_button_message label on negating button (middle)
retry_button_message label on retry button (on right side)
focus `focus_yes (first button), `focus_no (second button) or `focus_retry (third button)
Return value:
- `yes: first button has been clicked - `no: second button has been clicked - `retry: third button has been clicked
Example
 Popup::AnyQuestion3( Label::WarningMsg(), _("... failed"), _("Continue"), _("Cancel"), _("Retry"), `focus_yes );
See
AnyQuestion
global ModuleError (string text) -> symbol

Special error popup for YCP modules that don't work.

The user can choose one of: - "back" - go back to the previous module - "next" - skip this faulty module and directly go to the next one - "again" - try it again (after fixing something in the code, of course) - "cancel" - exit program

Parameters:
text string
Return value:
`back, `again, `cancel, `next
Example
 Popup::ModuleError( "The module " + symbolof(argterm) + " does not work." );
global AnyTimedMessage (string headline, string message, integer timeout) -> void

Generic message popup

Show a message with optional headline above and wait until user clicked "OK" or until a timeout runs out.

Parameters:
headline optional headline or Popup::NoHeadline()
message the message (maybe multi-line) to display.
timeout After timeout seconds dialog will be automatically closed
Return value:
global ShowTextTimed (string headline, string text, integer timeout) -> void

Show the contents of an entire file in a popup.

Parameters:
headline headline text
text text to show
timeout text to show
Example
 Popup::ShowText ("Boot Messages", "kernel panic", 10);
global ShowText (string headline, string text) -> void

Show the contents of an entire file in a popup.

Parameters:
headline headline text
text text to show
Example
 Popup::ShowText ("Boot Messages", "kernel panic");
global ShowFile (string headline, string filename) -> void

Show the contents of an entire file in a popup.

Notice: This is a WFM function, NOT an UI function!

Parameters:
headline headline text
filename filename with path of the file to show
Example
 Popup::ShowFile ("Boot Messages", "/var/log/boot.msg");