Class: Y2Network::Dialogs::AddInterface

Inherits:
CWM::Dialog
  • Object
show all
Defined in:
src/lib/y2network/dialogs/add_interface.rb

Overview

Dialog which starts new device creation

Instance Method Summary collapse

Constructor Details

#initialize(default: nil) ⇒ AddInterface

Returns a new instance of AddInterface.



31
32
33
34
35
36
# File 'src/lib/y2network/dialogs/add_interface.rb', line 31

def initialize(default: nil)
  super()
  @type_widget = Widgets::InterfaceType.new(default: default ? default.short_name : nil)

  textdomain "network"
end

Instance Method Details

#abort_buttonObject

as it is a sub dialog it can only cancel and cannot abort



76
77
78
# File 'src/lib/y2network/dialogs/add_interface.rb', line 76

def abort_button
  Yast::Label.CancelButton
end

#back_buttonObject

no back button for add dialog



71
72
73
# File 'src/lib/y2network/dialogs/add_interface.rb', line 71

def back_button
  ""
end

#contentsObject



43
44
45
46
47
48
49
50
51
# File 'src/lib/y2network/dialogs/add_interface.rb', line 43

def contents
  HVCenter(
    HSquash(
      HBox(
        @type_widget
      )
    )
  )
end

#runY2Network::InterfaceConfigBuilder?

Returns new builder when type selected or nil if canceled

Returns:



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'src/lib/y2network/dialogs/add_interface.rb', line 55

def run
  ret = super
  log.info "AddInterface result #{ret}"
  ret = :back if ret == :abort

  return if ret == :back

  # TODO: use factory to get proper builder
  builder = InterfaceConfigBuilder.for(InterfaceType.from_short_name(@type_widget.result))
  proposed_name = Yast::Lan.yast_config.interfaces.free_name(@type_widget.result)
  builder.name = proposed_name

  builder
end

#should_open_dialog?Boolean

always open new dialog

Returns:

  • (Boolean)


81
82
83
# File 'src/lib/y2network/dialogs/add_interface.rb', line 81

def should_open_dialog?
  true
end

#titleObject



38
39
40
41
# File 'src/lib/y2network/dialogs/add_interface.rb', line 38

def title
  # Translators: Dialog headline: adding a configuration of a network interface
  _("Add Interface Configuration")
end