Class: Yast2::Popup
- Inherits:
-
Object
- Object
- Yast2::Popup
- Extended by:
- Yast::I18n, Yast::UIShortcuts
- Defined in:
- library/general/src/lib/yast2/popup.rb
Overview
Note:
as the UI is not easy to test, it is recommended to run
examples/popup_series_tester.sh
after modifying this code,
to tests common combinations of options.
Note:
for RSpec tests, require "yast2/popup_rspec"
for easier mocking
that still does argument verifications.
Class responsible for showing popups. It has a small but consistent API. Intended as a replacement for Yast::Popup module.
Constant Summary collapse
- LINES_THRESHOLD =
Number of lines to switch to richtext widget for richtext: false
20
- RICHTEXT_WIDTH =
60
- RICHTEXT_HEIGHT =
10
- LABEL_MINWIDTH =
Minimum width for auto wrapped labels. This value is used when the label has longer lines.
60
Class Method Summary collapse
-
.show(message, details: "", headline: "", timeout: 0, focus: nil, buttons: :ok, richtext: false, style: :notice) ⇒ Symbol
Show a popup, wait for a button press (or a timeout), return the button ID.
Class Method Details
.show(message, details: "", headline: "", timeout: 0, focus: nil, buttons: :ok, richtext: false, style: :notice) ⇒ Symbol
Show a popup, wait for a button press (or a timeout), return the button ID.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'library/general/src/lib/yast2/popup.rb', line 79 def show(, details: "", headline: "", timeout: 0, focus: nil, buttons: :ok, richtext: false, style: :notice) textdomain "base" = () headline = generate_headline(headline) # add default focus button before adding details, as details should not be focussed focus = .keys.first if focus.nil? () unless details.empty? () if timeout > 0 check_arguments!(, details, timeout, focus, ) content_res = content(body(headline, , richtext, timeout), ) event_loop(content_res, focus, timeout, details, style) end |