Class: Cosmos::ButtonWidget

Inherits:
Qt::PushButton
  • Object
show all
Includes:
Widget
Defined in:
lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb

Instance Attribute Summary

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 Widget

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

Constructor Details

#initialize(parent_layout, button_text, string_to_eval) ⇒ ButtonWidget

Returns a new instance of ButtonWidget.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb', line 22

def initialize (parent_layout, button_text, string_to_eval)
  super()
  setText(button_text.to_s)
  connect(SIGNAL('clicked()')) do
    begin
      @screen.instance_eval(string_to_eval.to_s)
    rescue DRb::DRbConnError
      Qt::MessageBox.warning(parent.parentWidget, 'Error', "Error Connecting to Command and Telemetry Server")
    rescue Exception => error
      Qt::MessageBox.warning(parent.parentWidget, 'Error', "#{error.class} : #{error.message}")
    end
  end
  parent_layout.addWidget(self) if parent_layout
end