Class: UI::Wizards::Layout

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

Overview

Class to configure a wizard layout

There are four possible layouts:

  • With a left sidebar which is usually used to place the installation steps.
  • With a left tree.
  • Without a sidebar/tree and with the title of the dialogs on the left.
  • Without a sidebar/tree and with the title of the dialogs on top.

Moreover, for each layout, a top banner can be added.

Examples:

layout1 = UI::Wizards::Layout.with_steps
layout2 = UI::Wizards::Layout.with_title_on_left
layout3 = UI::Wizards::Layout.with_title_on_top

layout3.show_banner

layout1.open_wizard do
  # ...
end

Defined Under Namespace

Classes: Mode

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#modeMode (readonly)

Layout mode

Returns:


159
160
161
# File 'library/general/src/lib/ui/wizards/layout.rb', line 159

def mode
  @mode
end

Class Method Details

.from_product_featuresLayout

Creates a new layout according to the product features

Returns:


151
152
153
# File 'library/general/src/lib/ui/wizards/layout.rb', line 151

def from_product_features
  new.send(:load_product_features)
end

.with_stepsLayout

Creates a new layout with a left sidebar

Returns:


123
124
125
# File 'library/general/src/lib/ui/wizards/layout.rb', line 123

def with_steps
  new(Mode.steps)
end

.with_title_on_leftObject

Creates a new layout without a sidebar/tree and with the title of the dialogs on the left


137
138
139
# File 'library/general/src/lib/ui/wizards/layout.rb', line 137

def with_title_on_left
  new(Mode.title_on_left)
end

.with_title_on_topLayout

Creates a new layout without a sidebar/tree and with the title of the dialogs on top

Returns:


144
145
146
# File 'library/general/src/lib/ui/wizards/layout.rb', line 144

def with_title_on_top
  new(Mode.title_on_top)
end

.with_treeLayout

Creates a new layout with a left tree

Returns:


130
131
132
# File 'library/general/src/lib/ui/wizards/layout.rb', line 130

def with_tree
  new(Mode.tree)
end

Instance Method Details

#banner?Boolean

Whether the layout includes a banner

Returns:

  • (Boolean)

174
175
176
# File 'library/general/src/lib/ui/wizards/layout.rb', line 174

def banner?
  @banner
end

#close_wizardObject

Closes the wizard


191
192
193
# File 'library/general/src/lib/ui/wizards/layout.rb', line 191

def close_wizard
  Yast::Wizard.CloseDialog
end

#hide_bannerObject

Configures the layout to not show a banner


167
168
169
# File 'library/general/src/lib/ui/wizards/layout.rb', line 167

def hide_banner
  @banner = false
end

#open_wizard { ... } ⇒ Object

Opens a new wizard according to the layout configuration

Yields:

  • Code to run after opening the wizard. The wizard is automatically closed.


181
182
183
184
185
186
187
188
# File 'library/general/src/lib/ui/wizards/layout.rb', line 181

def open_wizard(&block)
  Yast::Wizard.OpenWithLayout(self)

  return unless block_given?

  block.call
  close_wizard
end

#show_bannerObject

Configures the layout to show a banner


162
163
164
# File 'library/general/src/lib/ui/wizards/layout.rb', line 162

def show_banner
  @banner = true
end