Class: Cosmos::TextboxWidget

Inherits:
Qt::TextEdit show all
Includes:
AgingWidget, Widget
Defined in:
lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb

Direct Known Subclasses

BlockWidget

Instance Attribute Summary

Attributes included from AgingWidget

#coloring

Attributes included from Widget

#item, #item_name, #limits_set, #limits_state, #packet, #packet_name, #polling_period, #screen, #settings, #target_name, #value, #value_type

Instance Method Summary collapse

Methods included from AgingWidget

included, #process_aging_settings, #setup_aging

Methods included from Widget

#context_menu, #get_tooltip_text, included, #set_setting, #set_subsetting, #shutdown, #update_widget

Methods inherited from Qt::TextEdit

#setColors

Constructor Details

#initialize(parent_layout, target_name, packet_name, item_name, width = 200, height = 100, value_type = :CONVERTED) ⇒ TextboxWidget

Returns a new instance of TextboxWidget.



21
22
23
24
25
26
27
# File 'lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb', line 21

def initialize(parent_layout, target_name, packet_name, item_name, width = 200, height = 100, value_type = :CONVERTED)
  super(target_name, packet_name, item_name, value_type)
  setup_aging
  setFixedSize(width.to_i, height.to_i)
  setReadOnly(true)
  parent_layout.addWidget(self) if parent_layout
end

Instance Method Details

#format_value(data) ⇒ Object



29
30
31
# File 'lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb', line 29

def format_value(data)
  data.to_s
end

#process_settingsObject



40
41
42
43
# File 'lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb', line 40

def process_settings
  super
  process_aging_settings
end

#value=(data) ⇒ Object



33
34
35
36
37
38
# File 'lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb', line 33

def value=(data)
  scroll_pos = self.verticalScrollBar.value
  self.text = super(data, format_value(data))
  self.setColors(@foreground, @background)
  self.verticalScrollBar.value = scroll_pos
end