Class: Y2Network::Dialogs::AddInterface
- Inherits:
-
CWM::Dialog
- Object
- CWM::Dialog
- Y2Network::Dialogs::AddInterface
- Defined in:
- src/lib/y2network/dialogs/add_interface.rb
Overview
Dialog which starts new device creation
Instance Method Summary collapse
-
#abort_button ⇒ Object
as it is a sub dialog it can only cancel and cannot abort.
-
#back_button ⇒ Object
no back button for add dialog.
- #contents ⇒ Object
-
#initialize(default: nil) ⇒ AddInterface
constructor
A new instance of AddInterface.
-
#run ⇒ Y2Network::InterfaceConfigBuilder?
Returns new builder when type selected or nil if canceled.
-
#should_open_dialog? ⇒ Boolean
always open new dialog.
- #title ⇒ Object
Constructor Details
#initialize(default: nil) ⇒ AddInterface
Returns a new instance of AddInterface.
31 32 33 34 35 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 31 def initialize(default: nil) @type_widget = Widgets::InterfaceType.new(default: default ? default.short_name : nil) textdomain "network" end |
Instance Method Details
#abort_button ⇒ Object
as it is a sub dialog it can only cancel and cannot abort
75 76 77 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 75 def Yast::Label.CancelButton end |
#back_button ⇒ Object
no back button for add dialog
70 71 72 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 70 def "" end |
#contents ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 42 def contents HVCenter( HSquash( HBox( @type_widget ) ) ) end |
#run ⇒ Y2Network::InterfaceConfigBuilder?
Returns new builder when type selected or nil if canceled
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 54 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
80 81 82 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 80 def should_open_dialog? true end |
#title ⇒ Object
37 38 39 40 |
# File 'src/lib/y2network/dialogs/add_interface.rb', line 37 def title # Translators: Dialog headline: adding a configuration of a network interface _("Add Interface Configuration") end |