Class: CWM::Dialog
- Inherits:
-
Object
- Object
- CWM::Dialog
- Includes:
- Yast::I18n, Yast::Logger, Yast::UIShortcuts
- Defined in:
- library/cwm/src/lib/cwm/dialog.rb
Overview
An OOP API and the pieces missing from Yast::CWM.show:
- creating and closing a wizard dialog
- Back/Abort/Next buttons
- Help introduction for dialog
Direct Known Subclasses
Defined Under Namespace
Classes: FakeHelp
Class Method Summary collapse
-
.run(*args, **kws) ⇒ Object
A shortcut for
.new(*args).run
.
Instance Method Summary collapse
-
#abort_button ⇒ String?
The :abort button.
-
#abort_handler ⇒ Boolean
Handler when the abort button is used.
-
#back_button ⇒ String?
The :back button.
-
#back_handler ⇒ Boolean
Handler when the back button is used.
- #contents ⇒ CWM::WidgetTerm
-
#disable_buttons ⇒ Array<Symbol>
Buttons to disable (:back, :next.
-
#help ⇒ String
Introduction for help.
-
#initialize(*args, **kws) ⇒ Dialog
constructor
Constructor (empty to just allow passing extra options).
-
#next_button ⇒ String?
The :next button.
-
#next_handler ⇒ Boolean
Handler when the next button is used.
-
#run ⇒ Symbol
The entry point.
- #should_open_dialog? ⇒ Boolean
-
#skip_store_for ⇒ Array<Symbol>
Events for which
store
won't be called, see Yast::CWMClass#show. -
#title ⇒ String?
The dialog title.
Constructor Details
#initialize(*args, **kws) ⇒ Dialog
Constructor (empty to just allow passing extra options)
30 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 30 def initialize(*args, **kws); end |
Class Method Details
.run(*args, **kws) ⇒ Object
A shortcut for .new(*args).run
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 33 def self.run(*args, **kws) # Argument delegation is handled differently since ruby 2.7: # # An empty Hash argument is automatically converted and absorbed into **kws, and the delegation # call removes the empty keyword hash, so no argument is passed to target. In ruby 2.6 and before, # an empty hash is passed: # # * Ruby 2.6 or before: run("foo") passes new("foo", {}) # * Ruby 2.7 or later: run("foo") passes new("foo") # # See https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/ dialog = kws.empty? ? new(*args) : new(*args, **kws) dialog.run end |
Instance Method Details
#abort_button ⇒ String?
The :abort button
73 74 75 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 73 def nil end |
#abort_handler ⇒ Boolean
Handler when the abort button is used
If returns false, then it does not abort.
118 119 120 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 118 def abort_handler true end |
#back_button ⇒ String?
The :back button
66 67 68 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 66 def nil end |
#back_handler ⇒ Boolean
Handler when the back button is used
If returns false, then it does not go back.
109 110 111 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 109 def back_handler true end |
#contents ⇒ CWM::WidgetTerm
27 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 27 abstract_method :contents |
#disable_buttons ⇒ Array<Symbol>
Returns Buttons to disable (:back, :next.
91 92 93 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 91 def [] end |
#help ⇒ String
text should be marked for translation
Introduction for help. This help text will be displayed before widget specific help. Default implementation is empty. If dialog want its help it need to overwrite the method with own text.
127 128 129 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 127 def help "" end |
#next_button ⇒ String?
The :next button
80 81 82 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 80 def nil end |
#next_handler ⇒ Boolean
Handler when the next button is used
If returns false, then it does not go next.
100 101 102 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 100 def next_handler true end |
#run ⇒ Symbol
The entry point. Will open (and close) a wizard dialog unless one already exists.
51 52 53 54 55 56 57 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 51 def run if should_open_dialog? wizard_create_dialog { cwm_show } else cwm_show end end |
#should_open_dialog? ⇒ Boolean
59 60 61 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 59 def should_open_dialog? !Yast::Wizard.IsWizardDialog end |
#skip_store_for ⇒ Array<Symbol>
Returns Events for which store
won't be called, see Yast::CWMClass#show.
86 87 88 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 86 def skip_store_for [] end |
#title ⇒ String?
Returns The dialog title. nil
: keep the existing title.
22 23 24 |
# File 'library/cwm/src/lib/cwm/dialog.rb', line 22 def title nil end |