Module: HardwareInformation::GUI::Gtk::ShowInputDevicesModule

Includes:
Gtk::BaseModule, PurchasedHardware
Included in:
ShowInputDevices
Defined in:
lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect
TITLE =
#

TITLE

#
'Show Input Devices'
WIDTH =
#

WIDTH

#
1600
HEIGHT =
#

HEIGHT

#
860
FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS =
#

FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS

#
:hack_20

Constants included from PurchasedHardware

PurchasedHardware::COLOUR_PURCHASED_AT_THIS_DATE, PurchasedHardware::LINUX_YAML, PurchasedHardware::MAIN_DIV

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PurchasedHardware

add_bought_at, add_to_the_total_cost, body_css_class, body_css_style, bought_at?, file_my_hardware, hash_yearly_purchases_made?, linux_yaml_directory?, #main_dataset?, my_hardware, return_dataset_from_the_file_computer_hardware, title?, total_cost?

Class Method Details

.run(i = ARGV) ⇒ Object

#

HardwareInformation::GUI::Gtk::ShowInputDevicesModule.run

#


175
176
177
178
179
180
181
182
183
184
185
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 175

def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  _ = ::HardwareInformation::GUI::Gtk::ShowInputDevices.new(i)
  r = ::Gtk.run
  r << _
  r.determine_the_title_from_the_child_widget
  r.set_size_request(_.width?, _.height?)
  r.top_left_then_run
end

Instance Method Details

#border_size?Boolean

#

border_size?

#

Returns:

  • (Boolean)


100
101
102
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 100

def border_size?
  2
end

#connect_skeletonObject

#

connect_skeleton (connect tag)

#


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 113

def connect_skeleton
  Thread.abort_on_exception = true
  result = `xinput --list --short`.to_s.strip
  @text_buffer = gtk_text_buffer
  text_view = gtk_text_view(@text_buffer)
  text_view.set_text(result.to_s)
  scrolled_window = gtk_scrolled_window(text_view) { :always }
  scrolled_window.set_size_request(1200, 400)
  scrolled_window.set_font(FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS)
  frame = gtk_frame(scrolled_window)
  frame.set_text('Show input devices')
  frame.set_border_width(10)
  frame.set_font :hack_24
  frame.make_bold
  maximal(frame, 20)
  add(gtk_separator)
  mini_hbox = gtk_hbox
  entry_for_listing_props = gtk_entry(
    'xinput --list-props "Logitech USB Optical Mouse"'
  )
  button_activate_the_entry_for_listing_props = gtk_button('_run')
  button_activate_the_entry_for_listing_props.hint = 
    'This will run the content on the left side.'
  button_activate_the_entry_for_listing_props.set_size_request(100, 30)
  button_activate_the_entry_for_listing_props.css_class('bblack2')
  button_activate_the_entry_for_listing_props.on_clicked {
    do_fill_up_text_buffer2_with_this_content_from_that_entry(
      entry_for_listing_props
    )
  }
  mini_hbox.maximal(entry_for_listing_props, 2)
  mini_hbox.minimal(button_activate_the_entry_for_listing_props, 2)
  add(mini_hbox)
  @text_buffer2 = gtk_text_buffer
  text_view2 = gtk_text_view(@text_buffer2)
  scrolled_window2 = gtk_scrolled_window(text_view2) { :always }
  scrolled_window2.set_size_request(1200, 300)
  scrolled_window2.set_font(FONT_TO_USE_FOR_THE_SCROLLED_WINDOWS)
  add(scrolled_window2)
end

#create_skeletonObject

#

create_skeleton (create tag)

#


107
108
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 107

def create_skeleton
end

#do_fill_up_text_buffer2_with_this_content_from_that_entry(entry_to_use) ⇒ Object

#

do_fill_up_text_buffer2_with_this_content_from_that_entry

#


157
158
159
160
161
162
163
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 157

def do_fill_up_text_buffer2_with_this_content_from_that_entry(
    entry_to_use
  )
  _ = entry_to_use.text?
  result = `#{_}`.to_s.strip
  @text_buffer2.set_text(result)
end

#initialize(optional_file = nil, run_already = true) ⇒ Object

#

initialize

#


55
56
57
58
59
60
61
62
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 55

def initialize(
    optional_file = nil,
    run_already   = true
  )
  super(:vertical)
  reset
  run if run_already
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


93
94
95
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 93

def padding?
  2
end

#resetObject

#

reset (reset tag)

#


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 67

def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title  = TITLE
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  set_use_this_font(:dejavu_condensed_21)
  use_gtk_paradise_project_css_file
  infer_the_size_automatically
end

#runObject

#

run (run tag)

#


168
169
170
# File 'lib/hardware_information/gui/shared_code/show_input_devices/show_input_devices_module.rb', line 168

def run
  create_skeleton_then_connect_skeleton
end