Class: UI::InstallationDialog

Inherits:
Dialog
  • Object
show all
Defined in:
library/general/src/lib/ui/installation_dialog.rb

Overview

Subclass of UI::Dialog to be used by installation steps.

When used in YaST normal mode, it opens a one-step wizard to allow manual testing of the dialog

Examples:

simple dialog to set a setting

Yast.import "Bar"
class FooDialog < UI::InstallationDialog
  def initialize
    super
    textdomain "example"
  end

  def dialog_content
    InputField(Id(:foo), "Value for Foo", Yast::Bar.foo)
  end

  def dialog_title
    "Foo"
  end

  def help_text
    "<p>Set the value for foo here.</p>
  end

  def next_handler
    Yast::Bar.foo = Yast::UI.QueryWidget(Id(:foo), :Value)
    super
  end
end

# In the installation client
FooDialog.run

Instance Method Summary collapse

Methods inherited from Dialog

#dialog_content, #dialog_options, #run, run

Methods included from EventDispatcher

#event_loop, #finish_dialog, #user_input

Constructor Details

#initializeInstallationDialog


58
59
60
61
62
63
64
65
# File 'library/general/src/lib/ui/installation_dialog.rb', line 58

def initialize
  super
  Yast.import "Mode"
  Yast.import "Wizard"
  Yast.import "GetInstArgs"
  Yast.import "Popup"
  @_wizard_opened = false
end

Instance Method Details

#abort_handlerObject

Handler for the 'abort' event

The default implementation ask the user for confirmation


93
94
95
# File 'library/general/src/lib/ui/installation_dialog.rb', line 93

def abort_handler
  finish_dialog(:abort) if Yast::Popup.ConfirmAbort(:painless)
end

#accept_handlerObject

Handler for the 'accept' event

Used when the dialog is called from a proposal, by default it simply calls the handler for 'next'


71
72
73
# File 'library/general/src/lib/ui/installation_dialog.rb', line 71

def accept_handler
  next_handler
end

#back_handlerObject

Handler for the 'back' event


81
82
83
# File 'library/general/src/lib/ui/installation_dialog.rb', line 81

def back_handler
  finish_dialog(:back)
end

#cancel_handlerObject

Handler for the 'cancel' event


86
87
88
# File 'library/general/src/lib/ui/installation_dialog.rb', line 86

def cancel_handler
  finish_dialog(:cancel)
end

#close_dialogObject (protected)


140
141
142
143
144
145
# File 'library/general/src/lib/ui/installation_dialog.rb', line 140

def close_dialog
  return unless @_wizard_opened

  @_wizard_opened = false
  Yast::Wizard.CloseDialog
end

#create_dialogObject (protected)

Reimplementation of UI::Dialog#create_dialog for the installer

It ignores UI::Dialog#dialog_options


121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'library/general/src/lib/ui/installation_dialog.rb', line 121

def create_dialog
  log.info "This is an InstallationDialog, ignoring #dialog_options" if dialog_options

  # Allow manual testing
  if !Yast::Wizard.IsWizardDialog
    @_wizard_opened = true
    Yast::Wizard.CreateDialog
  end

  Yast::Wizard.SetContents(
    dialog_title,
    dialog_content,
    help_text,
    Yast::GetInstArgs.enable_back,
    Yast::GetInstArgs.enable_next || Yast::Mode.normal
  )
  true
end

#dialog_titleString (protected)

Headline for the dialog


107
108
109
# File 'library/general/src/lib/ui/installation_dialog.rb', line 107

def dialog_title
  ""
end

#help_textString (protected)

Text to display when the help button is pressed


114
115
116
# File 'library/general/src/lib/ui/installation_dialog.rb', line 114

def help_text
  ""
end

#next_handlerObject

Handler for the 'next' event


76
77
78
# File 'library/general/src/lib/ui/installation_dialog.rb', line 76

def next_handler
  finish_dialog(:next)
end

#title_iconString (protected)

Optional title icon


102
# File 'library/general/src/lib/ui/installation_dialog.rb', line 102

def title_icon; end