Module: Yast::AutoinstallAutoinstDialogsInclude

Defined in:
../../src/include/autoinstall/autoinst_dialogs.rb

Instance Method Summary (collapse)

Instance Method Details

- (String) DiskSelectionDialog

Disk selection dialog

Returns:

  • (String)

    device



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File '../../src/include/autoinstall/autoinst_dialogs.rb', line 82

def DiskSelectionDialog
  Builtins.y2milestone("Selecting disk manually....")
  tm = Storage.GetTargetMap
  contents = Dummy()

  if Ops.greater_than(Builtins.size(tm), 0)
    buttonbox = VBox()

    i = 0
    Builtins.foreach(tm) do |tname, tdata|
      if Storage.IsRealDisk(tdata)
        tlinename = Ops.get_string(tdata, "name", "?")
        tline = Ops.add(
          Ops.add(Ops.add("&", Ops.add(i, 1)), ":    "),
          tlinename
        )
        sel = Storage.GetPartDisk == tname &&
          Storage.GetPartMode != "CUSTOM"
        buttonbox = Builtins.add(
          buttonbox,
          Left(RadioButton(Id(tname), tline, sel))
        )
        i = Ops.add(i, 1)
      end
    end

    buttonbox = Builtins.add(buttonbox, VSpacing(0.8))


    # This dialog selects the target disk for the installation.
    # Below this label, all targets are listed that can be used as
    # installation target

    # heading text
    contents = Frame(
      _("Choose a hard disk"),
      RadioButtonGroup(
        Id(:options),
        VBox(VSpacing(0.4), HSquash(buttonbox), VSpacing(0.4))
      )
    )
  else
    contents = Label(_("No disks found."))
  end

  # There are several hard disks found. Linux is completely installed on
  # one hard disk - this selection is done here
  # "Preparing Hard Disk - Step 1" is the description of the dialog what to
  # do while the following locale is the help description
  # help part 1 of 1
  help_text = _(
    "<p>\n" +
      "All hard disks automatically detected on your system\n" +
      "are shown here. Select the hard disk on which to install &product;.\n" +
      "</p>"
  )
  buttons = HBox(
    PushButton(Id(:ok), Opt(:default), Label.OKButton),
    PushButton(Id(:abort), Label.AbortButton)
  )



  ask_device_dialog = HBox(
    VSpacing(15), # force dialog height
    VBox(
      HSpacing(30), # force help text width
      RichText(help_text)
    ),
    HSpacing(3),
    VBox(
      VSpacing(1),
      Heading(_("Hard Disk Selection")),
      contents,
      VStretch(),
      buttons
    ),
    HSpacing(3)
  )

  UI.OpenDialog(Opt(:decorated), ask_device_dialog)

  ret = nil
  option = ""
  begin
    ret = UI.UserInput
    Builtins.y2milestone("ret=%1", ret)
    if ret == :ok
      option = Convert.to_string(
        UI.QueryWidget(Id(:options), :CurrentButton)
      )
      Builtins.y2milestone("selected disk: %1", option)
      if option == nil
        # there is a selection from that one option has to be
        # chosen - at the moment no option is chosen
        Popup.Message(_("Select one of the options to continue."))
        ret = nil
      end
    end
  end until ret == :ok || ret == :abort

  UI.CloseDialog
  option
end

- (Object) initialize_autoinstall_autoinst_dialogs(include_target)



11
12
13
14
15
# File '../../src/include/autoinstall/autoinst_dialogs.rb', line 11

def initialize_autoinstall_autoinst_dialogs(include_target)
  textdomain "autoinst"
  Yast.import "Label"
  Yast.import "Storage"
end

- (String) ProfileSourceDialog(original)

Shows a dialog when 'control file' can't be found

Parameters:

  • original (String)

    Original value

Returns:

  • (String)

    new value



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File '../../src/include/autoinstall/autoinst_dialogs.rb', line 20

def ProfileSourceDialog(original)
  helptext = _(
    "<p>\n" +
      "A profile for this machine could not be found or retrieved.\n" +
      "Check that you entered the correct location\n" +
      "on the command line and try again. Because of this error, you\n" +
      "can only enter a URL to a profile and not to a directory. If you\n" +
      "are using rules or host name-based control files, restart the\n" +
      "installation process and make sure the control files are accessible.</p>\n"
  )
  title = _("System Profile Location")

  UI.OpenDialog(
    Opt(:decorated),
    HBox(
      HWeight(30, RichText(helptext)),
      HStretch(),
      HSpacing(1),
      HWeight(
        70,
        VBox(
          Heading(title),
          VSpacing(1),
          VStretch(),
          MinWidth(60,
            Left(TextEntry(Id(:uri), _("&Profile Location:"), original))
          ),
          VSpacing(1),
          VStretch(),
          HBox(
            PushButton(Id(:retry), Opt(:default), Label.RetryButton),
            PushButton(Id(:abort), Label.AbortButton)
          )
        )
      )
    )
  )

  uri = ""
  while true
    ret = Convert.to_symbol(UI.UserInput)

    if ret == :abort && Popup.ConfirmAbort(:painless)
      break
    elsif ret == :retry
      uri = Convert.to_string(UI.QueryWidget(Id(:uri), :Value))
      if uri == ""
        next
      else
        break
      end
    end
  end

  UI.CloseDialog
  uri
end