Class: Cosmos::TlmEditDialog
- Defined in:
- lib/cosmos/gui/dialogs/tlm_edit_dialog.rb
Overview
TlmEditDialog class
Instance Method Summary collapse
-
#initialize(parent, target_name, packet_name, item_name) ⇒ TlmEditDialog
constructor
A new instance of TlmEditDialog.
Constructor Details
#initialize(parent, target_name, packet_name, item_name) ⇒ TlmEditDialog
Returns a new instance of TlmEditDialog.
23 24 25 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 |
# File 'lib/cosmos/gui/dialogs/tlm_edit_dialog.rb', line 23 def initialize (parent, target_name, packet_name, item_name) begin begin limits_enabled = limits_enabled?(target_name, packet_name, item_name) rescue RuntimeError # Error most likely due to LATEST packet - Ignore limits_enabled = nil end unless limits_enabled.nil? dialog = Qt::Dialog.new(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) dialog.setWindowTitle("Edit Settings for #{target_name} #{packet_name} #{item_name}") dialog_layout = Qt::VBoxLayout.new dialog_layout.addWidget(Qt::Label.new("Warning: Edits affect all COSMOS tools, not just this application!")) check_layout = Qt::HBoxLayout.new check_label = Qt::Label.new("Limits Checking Enabled:") checkbox = Qt::CheckBox.new checkbox.setChecked(limits_enabled) check_label.setBuddy(checkbox) check_layout.addWidget(check_label) check_layout.addWidget(checkbox) dialog_layout.addLayout(check_layout) = Qt::HBoxLayout.new ok = Qt::PushButton.new("Ok") ok.connect(SIGNAL('clicked()')) do dialog.accept() end .addWidget(ok) cancel = Qt::PushButton.new("Cancel") cancel.connect(SIGNAL('clicked()')) do dialog.reject() end .addWidget(cancel) dialog_layout.addLayout() dialog.setLayout(dialog_layout) dialog.show dialog.raise if dialog.exec == Qt::Dialog::Accepted if checkbox.isChecked() enable_limits(target_name, packet_name, item_name) else disable_limits(target_name, packet_name, item_name) end end dialog.dispose else Qt::MessageBox.information(parent, "Edit Settings for #{target_name} #{packet_name} #{item_name}", 'No Editable Fields for this Item') end rescue DRb::DRbConnError #Just do nothing end end |