Class: Registration::UI::WizardClient

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n, Yast::Logger
Defined in:
src/lib/registration/ui/wizard_client.rb

Overview

The base class for several clients using the Wizard module with exception handling.

Instance Method Summary collapse

Constructor Details

#initializeWizardClient


28
29
30
# File 'src/lib/registration/ui/wizard_client.rb', line 28

def initialize
  textdomain "registration"
end

Instance Method Details

#mainSymbol

Run the main workflow, opens a Wizard dialog if not present and handles raised exceptions


35
36
37
38
39
40
41
42
43
44
45
# File 'src/lib/registration/ui/wizard_client.rb', line 35

def main
  # create the Wizard dialog if needed
  wizard_present = Yast::Wizard.IsWizardDialog
  Yast::Wizard.CreateDialog unless wizard_present

  begin
    run
  ensure
    Yast::Wizard.CloseDialog unless wizard_present
  end
end

#runSymbol

Run the main workflow, handles exceptions raised during the client call.


50
51
52
53
54
55
56
57
58
59
# File 'src/lib/registration/ui/wizard_client.rb', line 50

def run
  ret = run_sequence
  log.info "Sequence result: #{ret}"
  ret
rescue => e
  log.error "Caught error: #{e.class}: #{e.message.inspect}, #{e.backtrace}"
  # TRANSLATORS: error message, %s are details
  Yast::Report.Error(_("Internal error: %s") % e.message)
  return :abort
end

#run_sequenceSymbol

This is main workflow sequence, it needs to be redefined in the derived class.

Raises:

  • (NotImplementedError)

63
64
65
# File 'src/lib/registration/ui/wizard_client.rb', line 63

def run_sequence
  raise NotImplementedError, "method run_sequence() must be defined in the derived class"
end