Class: Y2Network::Widgets::Driver

Inherits:
CWM::CustomWidget
  • Object
show all
Includes:
Yast::Logger
Defined in:
src/lib/y2network/widgets/driver.rb

Overview

Widget to select the driver and to specify its options

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ Driver


31
32
33
34
35
# File 'src/lib/y2network/widgets/driver.rb', line 31

def initialize(builder)
  textdomain "network"
  @builder = builder
  self.handle_all_events = true
end

Instance Method Details

#contentsObject


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'src/lib/y2network/widgets/driver.rb', line 37

def contents
  Frame(
    _("&Kernel Module"),
    HBox(
      HSpacing(0.5),
      VBox(
        VSpacing(0.4),
        HBox(
          kernel_module_widget,
          HSpacing(0.5),
          kernel_options_widget
        ),
        VSpacing(0.4)
      ),
      HSpacing(0.5)
    )
  )
end

#handle(event) ⇒ Object


60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'src/lib/y2network/widgets/driver.rb', line 60

def handle(event)
  return unless event["ID"] == "kernel_module" && event["EventReason"] == "ValueChanged"
  return nil if @old_kernel_module == kernel_module_widget.value

  if kernel_module_widget.value == :auto
    disable_kernel_options
  else
    enable_kernel_options
  end

  @old_kernel_module = kernel_module_widget.value

  nil
end

#initObject


56
57
58
# File 'src/lib/y2network/widgets/driver.rb', line 56

def init
  disable_kernel_options if @builder.driver == :auto
end

#storeObject


75
76
77
78
79
80
81
82
# File 'src/lib/y2network/widgets/driver.rb', line 75

def store
  @builder.driver =
    if kernel_module_widget.value == :auto
      :auto
    else
      Y2Network::Driver.new(kernel_module_widget.value, kernel_options_widget.value)
    end
end