YaST2 Developers Documentation: yast2



functions
files
intro

yast2

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

Imports

  • Label
  • Mode

Global Functions

Local Functions

local createPopupLayoutInternal (string headline, string message, term button_box) -> term

Internal function that actually creates a popup dialog layout.

Parameters:
headline headline to show or Popup::NoHeadline()
message message text to show
button_box term with one or more buttons
Return value:
the layout contents as a term

local createPopupLayoutInternalWithLabel (string headline, string message, term button_box, string label) -> term

Internal function that actually creates a popup dialog with additional label.

Parameters:
headline headline to show or Popup::NoHeadline()
message message text to show
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
Return value:
the layout contents as a term

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 ("")

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 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
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:
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:
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

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 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.
See:
Message Notify Warning Error

global ClearFeedback () -> void

Clear feddback message

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

Show popup with a headline and a message for feedback

Parameters:
headline
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 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 Notify (string message) -> void

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

TODO no more header

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

global TimedMessage (string message, integer timeout_seconds) -> void

Display a message with a timeout and return when the user clicks "OK" or when the timeout expires. There is also a "stop" button that will stop the countdown. If the user clicks that, the popup will wait forever (or until "OK" is clicked, of course).

Parameters:
message message to display
timeout_seconds the timeout in seconds
Example:
  Popup::TimedMessage("This is a timed message", 2 );

global TimedOKCancel (string message, integer timeout_seconds) -> boolean

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".

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 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 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 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
Example:
  Popup::ShowText ("Boot Messages", "kernel panic");

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");

YaST2 Developers Documentation