Class: Y2Network::Widgets::BlinkButton

Inherits:
CWM::CustomWidget
  • Object
show all
Defined in:
src/lib/y2network/widgets/blink_button.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ BlinkButton

Returns a new instance of BlinkButton.



29
30
31
32
33
# File 'src/lib/y2network/widgets/blink_button.rb', line 29

def initialize(settings)
  super()
  textdomain "network"
  @settings = settings
end

Instance Method Details

#contentsObject



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

def contents
  Frame(
    _("Show Visible Port Identification"),
    HBox(
      # translators: how many seconds will card be blinking
      IntField(
        Id(:blink_time),
        _("Seconds") + ":",
        0,
        100,
        5
      ),
      VBox(
        VSpacing(),
        PushButton(Id(:blink_button), _("Blink"))
      )
    )
  )
end

#handleObject



55
56
57
58
59
60
61
62
63
64
# File 'src/lib/y2network/widgets/blink_button.rb', line 55

def handle
  device = @settings.name
  timeout = Yast::UI.QueryWidget(:blink_time, :Value)
  log.info "blink, blink ... #{timeout} seconds on #{device} device"
  cmd = "/usr/sbin/ethtool -p #{device.shellescape} #{timeout.to_i}"
  res = Yast::SCR.Execute(Yast::Path.new(".target.bash_output"), cmd)
  log.info "#{cmd} : #{res}"

  nil
end

#helpObject



66
67
68
69
70
71
72
73
74
# File 'src/lib/y2network/widgets/blink_button.rb', line 66

def help
  _(
    "<p><b>Show visible port identification</b> allows you to physically " \
    "identify now configured NIC. \n" \
    "Set appropriate time, click <b>Blink</b> and LED diodes on you " \
    "NIC will start blinking for selected time.\n" \
    "</p>"
  )
end