Class: Roebe::GUI::Libui::WlanInterface

Inherits:
Object
  • Object
show all
Includes:
Gtk::WlanInterfaceBase
Defined in:
lib/roebe/gui/libui/wlan_interface/wlan_interface.rb

Overview

Roebe::GUI::Libui::WlanInterface

Instance Method Summary collapse

Constructor Details

#initializeWlanInterface

#

initialize

#


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/roebe/gui/libui/wlan_interface/wlan_interface.rb', line 26

def initialize
  reset
  create_skeleton
  @main_window = ui_margined_main_window(
    TITLE, WIDTH, HEIGHT, 0
  )
  outer_vbox = ui_padded_vbox
  label = ui_label('Wlan Interface')

  outer_vbox.minimal(
    label
  )
  @entry_for_essid = ui_entry
  _ = two_elements_hbox(
    ui_text(' Use this ESSID: '),
    @entry_for_essid,
    layout_to_use: :minimal
  )
  outer_vbox.minimal(_)

  _ = two_elements_hbox(
    ui_text(' Use this wlan-interface name: '),
    ui_entry('wlan0'),
    layout_to_use: :minimal
  )
  outer_vbox.minimal(_)

  # ======================================================================= #
  # Add the "Assume laptop" button next:
  # ======================================================================= #
  button_assume_laptop = ui_button('Assume laptop')
  button_assume_laptop.on_clicked {
    @entry_for_essid.set_text(
      @wlan.main_essid?
    )
  }
  outer_vbox.minimal(
    button_assume_laptop
  )
  outer_vbox.minimal(
    text('Run the following commands:')
  )
  hbox = ui_padded_hbox
  hbox.minimal(ui_text('1'))
  hbox.minimal(ui_button('ip link set wlan0 up'))
  outer_vbox.minimal(hbox)

  hbox = ui_padded_hbox
  hbox.minimal(ui_text('2'))
  hbox.minimal(ui_button('wpa_passphrase 1aaa >> /etc/wpa_supplicant.conf'))
  outer_vbox.minimal(hbox)

  hbox = ui_padded_hbox
  hbox.minimal(ui_text('3'))
  hbox.minimal(ui_button('wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf'))
  outer_vbox.minimal(hbox)

  hbox = ui_padded_hbox
  hbox.minimal(ui_text('4'))
  hbox.minimal(ui_button('dhclient wlan0'))
  outer_vbox.minimal(hbox)

  button_scan_for_available_ESSIDs = ui_button('Scan for available ESSIDs')
  button_scan_for_available_ESSIDs.on_clicked {
    scan_for_available_essids
  }
  outer_vbox.minimal(button_scan_for_available_ESSIDs)
  outer_vbox.minimal(
    ui_text('Available ESSIDs')
  )

  @main_window.child = outer_vbox
  @main_window.intelligent_exit
end

Instance Method Details

#create_buttonsObject

#

create_buttons

#


133
134
# File 'lib/roebe/gui/libui/wlan_interface/wlan_interface.rb', line 133

def create_buttons
end

#create_skeletonObject

#

create_skeleton

#


126
127
128
# File 'lib/roebe/gui/libui/wlan_interface/wlan_interface.rb', line 126

def create_skeleton
  create_buttons
end

#resetObject

#

reset (reset tag)

#


119
120
121
# File 'lib/roebe/gui/libui/wlan_interface/wlan_interface.rb', line 119

def reset
  reset_the_shared_module
end

#scan_for_available_essids(array = @wlan.available_essid_devices?) ⇒ Object

#

scan_for_available_essids

#


104
105
106
107
108
109
110
111
112
113
114
# File 'lib/roebe/gui/libui/wlan_interface/wlan_interface.rb', line 104

def scan_for_available_essids(
    array = @wlan.available_essid_devices?
  )
  do_scan_for_available_essids
  e 'Todo: populate the combo box with the available ESSIDs next.'
  unless array.empty?
    # array.each {|this_text|
    #   @combo_box_entry_available_essids.append_text(this_text)
    # }
  end
end