Class: CWM::Dialog

Inherits:
Object
  • Object
show all
Includes:
Yast::I18n, Yast::Logger, Yast::UIShortcuts
Defined in:
library/cwm/src/lib/cwm/dialog.rb

Overview

An OOP API and the pieces missing from Yast::CWM.show:

  • creating and closing a wizard dialog
  • Back/Abort/Next buttons
  • Help introduction for dialog

Direct Known Subclasses

Popup

Defined Under Namespace

Classes: FakeHelp

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(*args) ⇒ Object

A shortcut for .new(*args).run


30
31
32
# File 'library/cwm/src/lib/cwm/dialog.rb', line 30

def self.run(*args)
  new(*args).run
end

Instance Method Details

#abort_buttonString?

The :abort button

Returns:

  • (String, nil)

    button label, nil to use the default label, "" to omit the button


59
60
61
# File 'library/cwm/src/lib/cwm/dialog.rb', line 59

def abort_button
  nil
end

#abort_handlerBoolean

Handler when the abort button is used

If returns false, then it does not abort.

Returns:

  • (Boolean)

104
105
106
# File 'library/cwm/src/lib/cwm/dialog.rb', line 104

def abort_handler
  true
end

#back_buttonString?

The :back button

Returns:

  • (String, nil)

    button label, nil to use the default label, "" to omit the button


52
53
54
# File 'library/cwm/src/lib/cwm/dialog.rb', line 52

def back_button
  nil
end

#back_handlerBoolean

Handler when the back button is used

If returns false, then it does not go back.

Returns:

  • (Boolean)

95
96
97
# File 'library/cwm/src/lib/cwm/dialog.rb', line 95

def back_handler
  true
end

#contentsCWM::WidgetTerm

Returns:


27
# File 'library/cwm/src/lib/cwm/dialog.rb', line 27

abstract_method :contents

#disable_buttonsArray<Symbol>

Returns Buttons to disable (:back, :next.

Returns:

  • (Array<Symbol>)

    Buttons to disable (:back, :next


77
78
79
# File 'library/cwm/src/lib/cwm/dialog.rb', line 77

def disable_buttons
  []
end

#helpString

Note:

text should be marked for translation

Introduction for help. This help text will be displayed before widget specific help. Default implementation is empty. If dialog want its help it need to overwrite the method with own text.

Returns:

  • (String)

    help text with rich text formatting


113
114
115
# File 'library/cwm/src/lib/cwm/dialog.rb', line 113

def help
  ""
end

#next_buttonString?

The :next button

Returns:

  • (String, nil)

    button label, nil to use the default label, "" to omit the button


66
67
68
# File 'library/cwm/src/lib/cwm/dialog.rb', line 66

def next_button
  nil
end

#next_handlerBoolean

Handler when the next button is used

If returns false, then it does not go next.

Returns:

  • (Boolean)

86
87
88
# File 'library/cwm/src/lib/cwm/dialog.rb', line 86

def next_handler
  true
end

#runSymbol

The entry point. Will open (and close) a wizard dialog unless one already exists.

Returns:

  • (Symbol)

37
38
39
40
41
42
43
# File 'library/cwm/src/lib/cwm/dialog.rb', line 37

def run
  if should_open_dialog?
    wizard_create_dialog { cwm_show }
  else
    cwm_show
  end
end

#should_open_dialog?Boolean

Returns:

  • (Boolean)

45
46
47
# File 'library/cwm/src/lib/cwm/dialog.rb', line 45

def should_open_dialog?
  !Yast::Wizard.IsWizardDialog
end

#skip_store_forArray<Symbol>

Returns Events for which store won't be called, see Yast::CWMClass#show.

Returns:


72
73
74
# File 'library/cwm/src/lib/cwm/dialog.rb', line 72

def skip_store_for
  []
end

#titleString?

Returns The dialog title. nil: keep the existing title.

Returns:

  • (String, nil)

    The dialog title. nil: keep the existing title.


22
23
24
# File 'library/cwm/src/lib/cwm/dialog.rb', line 22

def title
  nil
end