Class: Installation::Console::Menu

Inherits:
CWM::Dialog
  • Object
show all
Defined in:
src/lib/installation/console/menu.rb

Overview

the main dialog for configuring the installer

testing in a running system: Y2DIR=./src ruby -I src/lib -r installation/console/menu.rb -e \ 'Yast.ui_component="qt";Yast.import("Wizard");Yast::Wizard.CreateDialog; \ ::Installation::Console::Menu.run'

Instance Method Summary collapse

Constructor Details

#initializeMenu

Returns a new instance of Menu.



37
38
39
40
# File 'src/lib/installation/console/menu.rb', line 37

def initialize
  super
  textdomain "installation"
end

Instance Method Details

#abort_buttonObject

hide abort button



79
80
81
# File 'src/lib/installation/console/menu.rb', line 79

def abort_button
  ""
end

#back_buttonObject

hide back button



84
85
86
# File 'src/lib/installation/console/menu.rb', line 84

def back_button
  ""
end

#can_start?Boolean

Is the toplevel dialog a wizard dialog? We cannot display the dialog in Qt UI if a popup is currently displayed...

Returns:

  • (Boolean)


100
101
102
103
104
105
106
107
108
109
# File 'src/lib/installation/console/menu.rb', line 100

def can_start?
  return true if Yast::UI.TextMode || Yast::Wizard.IsWizardDialog

  # TRANSLATORS: error message
  Yast::Report.Error(_("The installer configuration dialog cannot be displayed"\
                       " when a popup window is visible.\nClose the popup first and then" \
                       " repeat the action."))

  false
end

#contentsObject

the content of the dialog



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'src/lib/installation/console/menu.rb', line 57

def contents
  # load the plugins
  Plugins.load_plugins

  # collect the plugin widgets
  widgets = MenuPlugin.widgets
  # insert a small spacing between the widgets depending on the list size,
  # no spacing in ncurses if there are too many widgets
  # (the size is rounded down to 0)
  spacing = (widgets.size > 10) ? 0.4 : 1
  # this is a "join" for an Array...
  widgets = widgets.flat_map { |w| [w, VSpacing(spacing)] }.tap(&:pop)

  VBox(*widgets)
end

#helpObject



93
94
95
96
# File 'src/lib/installation/console/menu.rb', line 93

def help
  _("<p>This is a special configuration menu which allows configuring " \
    "the system during installation or tweak some installation options.</p>")
end

#next_buttonObject

show [OK] button



74
75
76
# File 'src/lib/installation/console/menu.rb', line 74

def next_button
  Yast::Label.OKButton
end

#runObject



47
48
49
50
51
52
53
54
# File 'src/lib/installation/console/menu.rb', line 47

def run
  return nil unless can_start?

  loop do
    ret = super
    break if [:next, :back, :abort, :close].include?(ret)
  end
end

#should_open_dialog?Boolean

create a new Wizard dialog to hide the installation steps on the left side

Returns:

  • (Boolean)


89
90
91
# File 'src/lib/installation/console/menu.rb', line 89

def should_open_dialog?
  true
end

#titleObject



42
43
44
45
# File 'src/lib/installation/console/menu.rb', line 42

def title
  # TRANSLATORS: dialog title
  _("Configuration")
end