Class: Cosmos::XyDataObjectAdder
- Inherits:
-
Qt::Widget
- Object
- Qt::Base
- Qt::Widget
- Cosmos::XyDataObjectAdder
- Defined in:
- lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb
Overview
Widget for adding a X-Y data object to a plot
Direct Known Subclasses
Instance Attribute Summary collapse
-
#add_data_object_callback ⇒ Object
Callback called when the add button is pressed - call(data_object).
Instance Method Summary collapse
-
#add_data_object ⇒ Object
Adds a data object when the add button is pressed.
-
#initialize(parent, orientation = Qt::Horizontal) ⇒ XyDataObjectAdder
constructor
A new instance of XyDataObjectAdder.
-
#update ⇒ Object
Update choices.
Constructor Details
#initialize(parent, orientation = Qt::Horizontal) ⇒ XyDataObjectAdder
Returns a new instance of XyDataObjectAdder.
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 |
# File 'lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb', line 30 def initialize(parent, orientation = Qt::Horizontal) super(parent) if orientation == Qt::Horizontal @overall_frame = Qt::HBoxLayout.new else @overall_frame = Qt::VBoxLayout.new end @overall_frame.setContentsMargins(0,0,0,0) # Chooser for packet and y item @telemetry_chooser = TelemetryChooser.new(self, orientation, true, false, true, true) @telemetry_chooser.update @overall_frame.addWidget(@telemetry_chooser) @telemetry_chooser.target_changed_callback = method(:packet_changed_callback) @telemetry_chooser.packet_changed_callback = method(:packet_changed_callback) @telemetry_chooser.item_label.text = 'Y Item:' # Chooser for x item x_item_names = @telemetry_chooser.item_names @x_item_name = ComboboxChooser.new(self, 'X Item:', x_item_names) @x_item_name.set_current('RECEIVED_TIMESECONDS') @overall_frame.addWidget(@x_item_name) # Button to add data object @add_data_object_button = Qt::PushButton.new('Add XY Data Object') @add_data_object_button.connect(SIGNAL('clicked()')) do add_data_object() end @overall_frame.addWidget(@add_data_object_button) setLayout(@overall_frame) @add_data_object_callback = nil end |
Instance Attribute Details
#add_data_object_callback ⇒ Object
Callback called when the add button is pressed - call(data_object)
25 26 27 |
# File 'lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb', line 25 def add_data_object_callback @add_data_object_callback end |
Instance Method Details
#add_data_object ⇒ Object
Adds a data object when the add button is pressed
74 75 76 77 78 79 80 81 82 |
# File 'lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb', line 74 def add_data_object data_object = XyDataObject.new data_object.target_name = @telemetry_chooser.target_name data_object.packet_name = @telemetry_chooser.packet_name data_object.y_item_name = @telemetry_chooser.item_name data_object.x_item_name = @x_item_name.string @add_data_object_callback.call(data_object) if @add_data_object_callback end |
#update ⇒ Object
Update choices
66 67 68 69 70 71 |
# File 'lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb', line 66 def update @telemetry_chooser.update x_item_names = @telemetry_chooser.item_names @x_item_name.update_items(x_item_names, false) @x_item_name.set_current('RECEIVED_TIMESECONDS') end |