Class: Yast::InstWelcomeClient

Inherits:
Client
  • Object
show all
Defined in:
src/lib/installation/clients/inst_welcome.rb

Instance Method Summary collapse

Instance Method Details

#mainObject


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
77
78
79
80
81
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
# File 'src/lib/installation/clients/inst_welcome.rb', line 29

def main
  Yast.import "UI"
  textdomain "installation"
  Yast.import "Wizard"
  Yast.import "Directory"
  Yast.import "GetInstArgs"
  Yast.import "RichText"
  Yast.import "CustomDialogs"
  Yast.import "Language"

  argmap = GetInstArgs.argmap

  default_patterns = ["welcome.%1.txt", "welcome.txt"]

  directory = argmap["directory"] || Directory.datadir

  directory = Directory.custom_workflow_dir + directory if Ops.get_string(argmap, "directory",
    "") != ""

  patterns = argmap["patterns"] || default_patterns

  welcome = CustomDialogs.load_file_locale(
    patterns,
    directory,
    Language.language
  )
  Builtins.y2debug("welcome map: %1", welcome)

  display = UI.GetDisplayInfo
  space = display["TextMode"] ? 1 : 3

  # dialog caption
  caption = _("Welcome")

  # welcome text 1/4
  text = _("<p><b>Welcome!</b></p>") +
    # welcome text 2/4
    _(
      "<p>There are a few more steps to take before your system is ready to\n" \
      "use. YaST will now guide you through some basic configuration.  Click\n" \
      "<b>Next</b> to continue. </p>\n" \
      "            \n"
    )

  # welcome text
  welcome_text = welcome["text"]
  welcome_text = text if !welcome_text || welcome_text.empty?

  # help ttext
  help = _(
    "<p>Click <b>Next</b> to perform the\nbasic configuration of the system.</p>\n"
  )

  if Builtins.regexpmatch(welcome_text, "</.*>")
    rt = RichText(Id(:welcome_text), welcome_text)
  else
    Builtins.y2debug("plain text")
    rt = RichText(Id(:welcome_text), Opt(:plainText), welcome_text)
  end

  contents = VBox(
    VSpacing(space),
    HBox(
      HSpacing(2 * space),
      rt,
      HSpacing(2 * space)
    ),
    VSpacing(2)
  )

  Wizard.SetContents(
    caption,
    contents,
    help,
    GetInstArgs.enable_back,
    GetInstArgs.enable_next
  )
  Wizard.SetFocusToNextButton

  ret = nil
  loop do
    ret = UI.UserInput

    break if ret != :abort
    break if Popup.ReallyAbort(:painless)
  end

  ret
end