Class: Installation::Console::Gui

Inherits:
Object
  • Object
show all
Defined in:
src/lib/installation/console/gui.rb

Overview

the installer console implementation for the graphical (Qt) UI

Instance Method Summary collapse

Instance Method Details

#run(&block) ⇒ Object

open a console and run a block in it



23
24
25
26
27
28
# File 'src/lib/installation/console/gui.rb', line 23

def run(&block)
  start
  redirect(&block)
ensure
  stop
end

#run_yast_module(*args) ⇒ Object

helper for running an YaST module in console



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
# File 'src/lib/installation/console/gui.rb', line 31

def run_yast_module(*args)
  # we cannot run any YaST module if there is a popup displayed, the module
  # would be displayed *below* the popup making it inaccessible :-(
  # make sure a wizard dialog is at the top
  return unless wizard_dialog?

  begin
    # get the window ID of the currently active window (the xterm window)
    window = `#{SWITCHER}`.chomp
  rescue Errno::ENOENT
    # if the switcher is missing display a short help
    puts "Starting an YaST configuration module..."
    puts
    puts "After it is finished (by pressing [Next]/[Back]/[Abort])"
    puts "press Alt+Tab to get back to this console."

    # wait a bit so the user can read the message above
    sleep(5)
  end

  Yast::WFM.call(*args)

  # automatically switch the window focus from YaST back to the xterm window
  system("#{SWITCHER} #{Shellwords.escape(window)}") if window
end