Class: UI::Dialog
- Inherits:
-
Object
- Object
- UI::Dialog
- Includes:
- EventDispatcher, Yast::I18n, Yast::Logger, Yast::UIShortcuts
- Defined in:
- library/general/src/lib/ui/dialog.rb
Overview
Base class for dialogs in Yast. Includes useful modules and provides glue between them
Direct Known Subclasses
Class Method Summary collapse
-
.run ⇒ Object
Runs dialog and return value of last handler from EventDispatcher.
Instance Method Summary collapse
- #close_dialog ⇒ Object protected
- #create_dialog ⇒ Object protected
-
#dialog_content ⇒ Yast::Term
protected
Abstract method to specify content of dialog.
-
#dialog_options ⇒ Yast::Term?
protected
Optional abstract method to specify options for dialog.
-
#initialize ⇒ Dialog
constructor
A new instance of Dialog.
- #run ⇒ Object
Methods included from EventDispatcher
#cancel_handler, #event_loop, #finish_dialog, #user_input
Constructor Details
Class Method Details
.run ⇒ Object
Runs dialog and return value of last handler from EventDispatcher
41 42 43 |
# File 'library/general/src/lib/ui/dialog.rb', line 41 def self.run new.run end |
Instance Method Details
#close_dialog ⇒ Object (protected)
70 71 72 |
# File 'library/general/src/lib/ui/dialog.rb', line 70 def close_dialog Yast::UI.CloseDialog end |
#create_dialog ⇒ Object (protected)
61 62 63 64 65 66 67 68 |
# File 'library/general/src/lib/ui/dialog.rb', line 61 def create_dialog dialog_opts = if dialog_opts Yast::UI.OpenDialog(dialog_opts, dialog_content) else Yast::UI.OpenDialog(dialog_content) end end |
#dialog_content ⇒ Yast::Term (protected)
Abstract method to specify content of dialog.
83 84 85 |
# File 'library/general/src/lib/ui/dialog.rb', line 83 def dialog_content raise NoMethodError, "Missing implementation for abstract method dialog content for #{self}" end |
#dialog_options ⇒ Yast::Term? (protected)
Optional abstract method to specify options for dialog.
77 |
# File 'library/general/src/lib/ui/dialog.rb', line 77 def ; end |
#run ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'library/general/src/lib/ui/dialog.rb', line 49 def run raise "Failed to create dialog. See logs" unless create_dialog begin event_loop ensure close_dialog end end |