Sha256: aab46c0ede71102967d674aab7d6c18f7e3b08216764640046f86132e18e043f
Contents?: true
Size: 1.33 KB
Versions: 24
Compression:
Stored size: 1.33 KB
Contents
# encoding: ascii-8bit # Copyright 2014 Ball Aerospace & Technologies Corp. # All Rights Reserved. # # This program is free software; you can modify and/or redistribute it # under the terms of the GNU General Public License # as published by the Free Software Foundation; version 3 with # attribution addendums as found in the LICENSE.txt # This file contains the implementation of the ButtonWidget class. require 'cosmos' require 'cosmos/tools/tlm_viewer/widgets/widget' require 'cosmos/gui/utilities/script_module_gui' module Cosmos # Run user defined code in the GUI thread context. This means that user # code should not block or take too long to execute as it will freeze # the TlmViewer screen. class ButtonWidget < Qt::PushButton include Widget 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 end end
Version data entries
24 entries across 24 versions & 1 rubygems