Module: Cosmos

Defined in:
lib/cosmos/top_level.rb,
lib/cosmos/gui/qt.rb,
lib/cosmos/version.rb,
lib/cosmos/io/stderr.rb,
lib/cosmos/io/stdout.rb,
lib/cosmos/gui/qt_tool.rb,
lib/cosmos/io/json_drb.rb,
lib/cosmos/io/json_rpc.rb,
lib/cosmos/win32/excel.rb,
lib/cosmos/win32/win32.rb,
lib/cosmos/script/tools.rb,
lib/cosmos/io/raw_logger.rb,
lib/cosmos/script/limits.rb,
lib/cosmos/script/replay.rb,
lib/cosmos/script/script.rb,
lib/cosmos/system/system.rb,
lib/cosmos/system/target.rb,
lib/cosmos/utilities/crc.rb,
lib/cosmos/utilities/csv.rb,
lib/cosmos/packets/limits.rb,
lib/cosmos/packets/packet.rb,
lib/cosmos/script/extract.rb,
lib/cosmos/streams/stream.rb,
lib/cosmos/script/commands.rb,
lib/cosmos/io/buffered_file.rb,
lib/cosmos/io/json_drb_rack.rb,
lib/cosmos/io/serial_driver.rb,
lib/cosmos/packets/commands.rb,
lib/cosmos/script/scripting.rb,
lib/cosmos/script/telemetry.rb,
lib/cosmos/utilities/logger.rb,
lib/cosmos/win32/win32_main.rb,
lib/cosmos/io/io_multiplexer.rb,
lib/cosmos/packets/structure.rb,
lib/cosmos/packets/telemetry.rb,
lib/cosmos/script/api_shared.rb,
lib/cosmos/utilities/sleeper.rb,
lib/cosmos/ccsds/ccsds_packet.rb,
lib/cosmos/ccsds/ccsds_parser.rb,
lib/cosmos/gui/dialogs/splash.rb,
lib/cosmos/io/json_drb_object.rb,
lib/cosmos/io/raw_logger_pair.rb,
lib/cosmos/gui/opengl/gl_light.rb,
lib/cosmos/gui/opengl/gl_scene.rb,
lib/cosmos/gui/opengl/gl_shape.rb,
lib/cosmos/gui/text/completion.rb,
lib/cosmos/packets/packet_item.rb,
lib/cosmos/tools/replay/replay.rb,
lib/cosmos/config/config_parser.rb,
lib/cosmos/gui/line_graph/lines.rb,
lib/cosmos/gui/opengl/gl_bounds.rb,
lib/cosmos/gui/opengl/gl_viewer.rb,
lib/cosmos/gui/opengl/stl_shape.rb,
lib/cosmos/gui/text/ruby_editor.rb,
lib/cosmos/interfaces/interface.rb,
lib/cosmos/processors/processor.rb,
lib/cosmos/utilities/quaternion.rb,
lib/cosmos/gui/opengl/moon_model.rb,
lib/cosmos/gui/opengl/stl_reader.rb,
lib/cosmos/packets/packet_config.rb,
lib/cosmos/script/cmd_tlm_server.rb,
lib/cosmos/streams/serial_stream.rb,
lib/cosmos/utilities/message_log.rb,
lib/cosmos/conversions/conversion.rb,
lib/cosmos/gui/dialogs/pry_dialog.rb,
lib/cosmos/gui/opengl/earth_model.rb,
lib/cosmos/gui/opengl/gl_material.rb,
lib/cosmos/gui/opengl/gl_viewport.rb,
lib/cosmos/gui/widgets/dart_frame.rb,
lib/cosmos/io/posix_serial_driver.rb,
lib/cosmos/io/win32_serial_driver.rb,
lib/cosmos/packets/structure_item.rb,
lib/cosmos/tools/test_runner/test.rb,
lib/cosmos/gui/dialogs/dart_dialog.rb,
lib/cosmos/packets/binary_accessor.rb,
lib/cosmos/packets/limits_response.rb,
lib/cosmos/tools/launcher/launcher.rb,
lib/cosmos/tools/tlm_viewer/screen.rb,
lib/cosmos/gui/dialogs/about_dialog.rb,
lib/cosmos/gui/dialogs/legal_dialog.rb,
lib/cosmos/gui/utilities/screenshot.rb,
lib/cosmos/interfaces/udp_interface.rb,
lib/cosmos/tools/cmd_tlm_server/api.rb,
lib/cosmos/config/meta_config_parser.rb,
lib/cosmos/gui/choosers/file_chooser.rb,
lib/cosmos/gui/dialogs/select_dialog.rb,
lib/cosmos/gui/line_graph/line_graph.rb,
lib/cosmos/gui/utilities/analyze_log.rb,
lib/cosmos/interfaces/linc_interface.rb,
lib/cosmos/tools/table_manager/table.rb,
lib/cosmos/gui/choosers/float_chooser.rb,
lib/cosmos/gui/choosers/value_chooser.rb,
lib/cosmos/gui/dialogs/details_dialog.rb,
lib/cosmos/gui/dialogs/set_tlm_dialog.rb,
lib/cosmos/packets/packet_item_limits.rb,
lib/cosmos/utilities/simulated_target.rb,
lib/cosmos/gui/choosers/string_chooser.rb,
lib/cosmos/gui/dialogs/calendar_dialog.rb,
lib/cosmos/gui/dialogs/progress_dialog.rb,
lib/cosmos/gui/dialogs/tlm_edit_dialog.rb,
lib/cosmos/gui/widgets/dart_meta_frame.rb,
lib/cosmos/interfaces/serial_interface.rb,
lib/cosmos/interfaces/stream_interface.rb,
lib/cosmos/packets/parsers/xtce_parser.rb,
lib/cosmos/streams/tcpip_client_stream.rb,
lib/cosmos/streams/tcpip_socket_stream.rb,
lib/cosmos/tools/cmd_sender/cmd_params.rb,
lib/cosmos/tools/cmd_sender/cmd_sender.rb,
lib/cosmos/tools/tlm_viewer/tlm_viewer.rb,
lib/cosmos/tools/tlm_viewer/tlm_viewer.rb,
lib/cosmos/gui/choosers/integer_chooser.rb,
lib/cosmos/gui/dialogs/exception_dialog.rb,
lib/cosmos/gui/dialogs/tlm_graph_dialog.rb,
lib/cosmos/gui/widgets/packet_log_frame.rb,
lib/cosmos/packet_logs/ccsds_log_reader.rb,
lib/cosmos/packets/parsers/macro_parser.rb,
lib/cosmos/packets/parsers/state_parser.rb,
lib/cosmos/tools/cmd_tlm_server/routers.rb,
lib/cosmos/tools/launcher/launcher_tool.rb,
lib/cosmos/tools/tlm_grapher/plots/plot.rb,
lib/cosmos/gui/choosers/combobox_chooser.rb,
lib/cosmos/gui/dialogs/packet_log_dialog.rb,
lib/cosmos/gui/line_graph/overview_graph.rb,
lib/cosmos/gui/text/completion_line_edit.rb,
lib/cosmos/gui/text/completion_text_edit.rb,
lib/cosmos/interfaces/protocols/protocol.rb,
lib/cosmos/packet_logs/packet_log_reader.rb,
lib/cosmos/packet_logs/packet_log_writer.rb,
lib/cosmos/packets/parsers/limits_parser.rb,
lib/cosmos/packets/parsers/packet_parser.rb,
lib/cosmos/tools/data_viewer/data_viewer.rb,
lib/cosmos/tools/test_runner/test_runner.rb,
lib/cosmos/tools/tlm_grapher/tlm_grapher.rb,
lib/cosmos/conversions/generic_conversion.rb,
lib/cosmos/gui/choosers/telemetry_chooser.rb,
lib/cosmos/gui/dialogs/cmd_details_dialog.rb,
lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb,
lib/cosmos/gui/dialogs/scroll_text_dialog.rb,
lib/cosmos/gui/dialogs/tlm_details_dialog.rb,
lib/cosmos/packets/parsers/xtce_converter.rb,
lib/cosmos/processors/watermark_processor.rb,
lib/cosmos/tools/launcher/launcher_config.rb,
lib/cosmos/tools/table_manager/table_item.rb,
lib/cosmos/gui/dialogs/find_replace_dialog.rb,
lib/cosmos/gui/widgets/realtime_button_bar.rb,
lib/cosmos/processors/statistics_processor.rb,
lib/cosmos/tools/cmd_sequence/cmd_sequence.rb,
lib/cosmos/tools/cmd_tlm_server/commanding.rb,
lib/cosmos/tools/cmd_tlm_server/interfaces.rb,
lib/cosmos/tools/tlm_grapher/plots/xy_plot.rb,
lib/cosmos/tools/tlm_viewer/widgets/widget.rb,
lib/cosmos/conversions/processor_conversion.rb,
lib/cosmos/conversions/unix_time_conversion.rb,
lib/cosmos/gui/dialogs/interface_raw_dialog.rb,
lib/cosmos/gui/line_graph/line_graph_dialog.rb,
lib/cosmos/gui/line_graph/line_graph_popups.rb,
lib/cosmos/gui/opengl/texture_mapped_sphere.rb,
lib/cosmos/interfaces/dart_status_interface.rb,
lib/cosmos/packets/parsers/processor_parser.rb,
lib/cosmos/tools/cmd_sequence/sequence_item.rb,
lib/cosmos/tools/cmd_sequence/sequence_list.rb,
lib/cosmos/tools/cmd_tlm_server/connections.rb,
lib/cosmos/tools/data_viewer/dump_component.rb,
lib/cosmos/tools/data_viewer/text_component.rb,
lib/cosmos/tools/script_runner/script_audit.rb,
lib/cosmos/tools/table_manager/table_config.rb,
lib/cosmos/tools/table_manager/table_parser.rb,
lib/cosmos/tools/test_runner/results_writer.rb,
lib/cosmos/conversions/polynomial_conversion.rb,
lib/cosmos/gui/dialogs/exception_list_dialog.rb,
lib/cosmos/gui/line_graph/line_graph_drawing.rb,
lib/cosmos/gui/line_graph/line_graph_scaling.rb,
lib/cosmos/interfaces/protocols/crc_protocol.rb,
lib/cosmos/interfaces/tcpip_client_interface.rb,
lib/cosmos/interfaces/tcpip_server_interface.rb,
lib/cosmos/tools/cmd_extractor/cmd_extractor.rb,
lib/cosmos/tools/config_editor/config_editor.rb,
lib/cosmos/tools/launcher/launcher_multitool.rb,
lib/cosmos/tools/opengl_builder/scene_config.rb,
lib/cosmos/tools/packet_viewer/packet_viewer.rb,
lib/cosmos/tools/script_runner/script_runner.rb,
lib/cosmos/tools/tlm_extractor/tlm_extractor.rb,
lib/cosmos/utilities/low_fragmentation_array.rb,
lib/cosmos/packet_logs/packet_log_writer_pair.rb,
lib/cosmos/packets/parsers/packet_item_parser.rb,
lib/cosmos/tools/cmd_tlm_server/router_thread.rb,
lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb,
lib/cosmos/interfaces/cmd_tlm_server_interface.rb,
lib/cosmos/interfaces/protocols/burst_protocol.rb,
lib/cosmos/interfaces/protocols/fixed_protocol.rb,
lib/cosmos/processors/new_packet_log_processor.rb,
lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb,
lib/cosmos/tools/cmd_tlm_server/gui/replay_tab.rb,
lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb,
lib/cosmos/tools/cmd_tlm_server/packet_logging.rb,
lib/cosmos/tools/cmd_tlm_server/replay_backend.rb,
lib/cosmos/tools/limits_monitor/limits_monitor.rb,
lib/cosmos/tools/opengl_builder/opengl_builder.rb,
lib/cosmos/tools/tlm_viewer/widgets/led_widget.rb,
lib/cosmos/interfaces/protocols/length_protocol.rb,
lib/cosmos/packets/parsers/format_string_parser.rb,
lib/cosmos/tools/cmd_tlm_server/background_task.rb,
lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb,
lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb,
lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb,
lib/cosmos/conversions/new_packet_log_conversion.rb,
lib/cosmos/conversions/received_count_conversion.rb,
lib/cosmos/interfaces/simulated_target_interface.rb,
lib/cosmos/tools/cmd_sender/cmd_sender_text_edit.rb,
lib/cosmos/tools/cmd_tlm_server/background_tasks.rb,
lib/cosmos/tools/cmd_tlm_server/interface_thread.rb,
lib/cosmos/tools/table_manager/table_item_parser.rb,
lib/cosmos/tools/test_runner/test_runner_chooser.rb,
lib/cosmos/tools/tlm_extractor/text_item_chooser.rb,
lib/cosmos/tools/tlm_grapher/plots/singlexy_plot.rb,
lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb,
lib/cosmos/gui/widgets/full_text_search_line_edit.rb,
lib/cosmos/interfaces/protocols/override_protocol.rb,
lib/cosmos/interfaces/protocols/template_protocol.rb,
lib/cosmos/packets/parsers/limits_response_parser.rb,
lib/cosmos/tools/table_manager/table_manager_core.rb,
lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb,
lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/spacer_widget.rb,
lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb,
lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb,
lib/cosmos/tools/config_editor/config_editor_frame.rb,
lib/cosmos/tools/data_viewer/data_viewer_component.rb,
lib/cosmos/tools/handbook_creator/handbook_creator.rb,
lib/cosmos/tools/script_runner/script_runner_frame.rb,
lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb,
lib/cosmos/conversions/unix_time_seconds_conversion.rb,
lib/cosmos/interfaces/protocols/terminated_protocol.rb,
lib/cosmos/tools/config_editor/system_config_dialog.rb,
lib/cosmos/tools/script_runner/script_runner_config.rb,
lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb,
lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelled_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb,
lib/cosmos/conversions/packet_time_seconds_conversion.rb,
lib/cosmos/conversions/unix_time_formatted_conversion.rb,
lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb,
lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb,
lib/cosmos/tools/tlm_grapher/plot_editors/plot_editor.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb,
lib/cosmos/conversions/segmented_polynomial_conversion.rb,
lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb,
lib/cosmos/interfaces/protocols/preidentified_protocol.rb,
lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb,
lib/cosmos/conversions/packet_time_formatted_conversion.rb,
lib/cosmos/conversions/received_time_seconds_conversion.rb,
lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb,
lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb,
lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb,
lib/cosmos/conversions/received_time_formatted_conversion.rb,
lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb,
lib/cosmos/tools/handbook_creator/handbook_creator_config.rb,
lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/backgroundbutton_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb,
lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb,
lib/cosmos/tools/tlm_grapher/data_objects/singlexy_data_object.rb,
lib/cosmos/tools/tlm_grapher/plot_editors/singlexy_plot_editor.rb,
lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb,
lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb,
lib/cosmos/tools/tlm_grapher/plot_editors/linegraph_plot_editor.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tab.rb,
lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb,
lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb,
lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb,
lib/cosmos/tools/tlm_grapher/data_object_editors/data_object_editor.rb,
lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb,
lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb,
lib/cosmos/tools/tlm_grapher/plot_gui_objects/singlexy_plot_gui_object.rb,
lib/cosmos/tools/tlm_grapher/plot_gui_objects/linegraph_plot_gui_object.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_plot_editor.rb,
lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_logfile_thread.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb,
lib/cosmos/tools/tlm_grapher/data_object_editors/singlexy_data_object_editor.rb,
lib/cosmos/tools/tlm_grapher/data_object_editors/linegraph_data_object_editor.rb,
lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb,
lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_data_object_editor.rb,
lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb,
lib/cosmos/tools/table_manager/table_manager.rb,
lib/cosmos/gui/utilities/script_module_gui.rb,
lib/cosmos/io/udp_sockets.rb

Overview

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

Defined Under Namespace

Modules: AgingWidget, Api, ApiShared, CanvasClickable, ExcelColumnConstants, Extract, LayoutWidget, MultiWidget, Script, ScriptAudit, Version, Widget Classes: AboutDialog, AnalyzeLog, ArrayWidget, BackgroundTask, BackgroundTasks, BackgroundbuttonWidget, BinaryAccessor, BlockWidget, BufferedFile, BurstProtocol, ButtonWidget, CSV, CalendarDialog, CanvasWidget, CanvasdotWidget, CanvasellipseWidget, CanvasimageWidget, CanvasimagevalueWidget, CanvaslabelWidget, CanvaslabelvalueWidget, CanvaslineWidget, CanvaslinevalueWidget, CanvasvalueWidget, CcsdsLogReader, CcsdsPacket, CcsdsParser, CheckError, CheckbuttonWidget, CmdDetailsDialog, CmdExtractor, CmdParamTableItemDelegate, CmdParams, CmdRawDialog, CmdSender, CmdSenderTextEdit, CmdSequence, CmdTlmServer, CmdTlmServerConfig, CmdTlmServerGui, CmdTlmServerInterface, ComboBoxItemDelegate, ComboboxChooser, ComboboxWidget, Commanding, Commands, Completion, CompletionLineEdit, CompletionTextEdit, ConfigEditor, ConfigEditorFrame, ConfigParser, Connections, Conversion, Crc, Crc16, Crc32, Crc64, CrcProtocol, DartDialog, DartFrame, DartMetaFrame, DartStatusInterface, DataObject, DataObjectEditor, DataViewer, DataViewerComponent, DetailsDialog, DumpComponent, EarthModel, ExcelSpreadsheet, ExceptionDialog, ExceptionListDialog, FatalError, FileChooser, FindReplaceDialog, FixedProtocol, FloatChooser, FloatChooserDoubleValidator, FocusComboBox, FormatStringParser, FormatfontvalueWidget, FormatvalueWidget, FullTextSearchLineEdit, GenericConversion, GlBounds, GlLight, GlMaterial, GlScene, GlShape, GlViewer, GlViewport, HandbookCreator, HandbookCreatorConfig, HexDumpDialog, HorizontalWidget, HorizontalboxWidget, HorizontallineWidget, HousekeepingDataObject, HousekeepingDataObjectAdder, HousekeepingDataObjectEditor, IgnorePacketProtocol, IntegerChooser, IntegerChooserIntValidator, Interface, InterfaceRawDialog, InterfaceThread, Interfaces, InterfacesTab, IoMultiplexer, JsonDRb, JsonDRbObject, JsonDRbUnknownError, JsonDrbRack, JsonRpc, JsonRpcError, JsonRpcErrorResponse, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccessResponse, LabelWidget, LabelformatvalueWidget, LabelledWidget, LabelprogressbarWidget, LabeltrendlimitsbarWidget, LabelvalueWidget, LabelvaluedescWidget, LabelvaluelimitsbarWidget, LabelvaluelimitscolumnWidget, LabelvaluerangebarWidget, LabelvaluerangecolumnWidget, Launcher, LauncherConfig, LauncherMultitool, LauncherTool, LedWidget, LegalDialog, LengthProtocol, Limits, LimitsGroupsBackgroundTask, LimitsItems, LimitsMonitor, LimitsParser, LimitsResponse, LimitsResponseParser, LimitsWidget, LimitsbarWidget, LimitscolorWidget, LimitscolumnWidget, LincHandshake, LincHandshakeCommand, LincInterface, LineGraph, LineGraphDialog, LinegraphDataObject, LinegraphDataObjectEditor, LinegraphPlot, LinegraphPlotEditor, LinegraphPlotGuiObject, LinegraphWidget, Lines, Logger, LoggingTab, LowFragmentationArray, MacroParser, MatrixbycolumnsWidget, MessageLog, MetaConfigParser, MoonModel, NewPacketLogConversion, NewPacketLogProcessor, OpenGLBuilder, OverrideProtocol, OverviewGraph, OverviewTabbedPlots, Packet, PacketConfig, PacketItem, PacketItemLimits, PacketItemParser, PacketLogDialog, PacketLogFrame, PacketLogFrameListWidget, PacketLogReader, PacketLogWriter, PacketLogWriterPair, PacketLogging, PacketParser, PacketTimeFormattedConversion, PacketTimeSecondsConversion, PacketViewer, PacketsTab, Plot, PlotEditor, PolynomialConversion, PosixSerialDriver, PreidentifiedProtocol, Processor, ProcessorConversion, ProcessorParser, ProgressDialog, ProgressbarWidget, Protocol, PryDialog, PryLineEdit, QtTool, Quaternion, RadiobuttonWidget, RangebarWidget, RangecolumnWidget, RawDialog, RawLogger, RawLoggerPair, RealtimeButtonBar, ReceivedCountConversion, ReceivedTimeFormattedConversion, ReceivedTimeSecondsConversion, Replay, ReplayBackend, ReplayTab, ResultsWriter, RouterThread, Routers, RubyEditor, SceneConfig, Screen, Screenshot, ScreenshotbuttonWidget, ScriptRunner, ScriptRunnerConfig, ScriptRunnerDialog, ScriptRunnerFrame, ScrollTextDialog, ScrollwindowWidget, SectionheaderWidget, SegmentedPolynomialConversion, SelectDialog, SequenceItem, SequenceList, SerialDriver, SerialInterface, SerialStream, ServerProxy, SetTlmDialog, SimulatedTarget, SimulatedTargetInterface, SinglexyDataObject, SinglexyDataObjectAdder, SinglexyDataObjectEditor, SinglexyPlot, SinglexyPlotEditor, SinglexyPlotGuiObject, SkipTestCase, Sleeper, SpacerWidget, Splash, StateParser, StatisticsProcessor, StatusTab, Stderr, Stdout, StlReader, StlShape, StopScript, Stream, StreamInterface, StringChooser, Structure, StructureItem, System, SystemConfigDialog, TabbedPlotsConfig, TabbedPlotsDartThread, TabbedPlotsDataObjectEditor, TabbedPlotsLogfileThread, TabbedPlotsPlotEditor, TabbedPlotsRealtimeThread, TabbedPlotsTab, TabbedPlotsTool, TabbookWidget, TabitemWidget, Table, TableConfig, TableItem, TableItemParser, TableManager, TableManagerCore, TableParser, Target, TargetsTab, TcpipClientInterface, TcpipClientStream, TcpipServerInterface, TcpipSocketStream, Telemetry, TelemetryChooser, TemplateProtocol, TerminatedProtocol, Test, TestResult, TestRunner, TestRunnerChooser, TestStatus, TestSuite, TextComponent, TextItemChooser, TextboxWidget, TextfieldWidget, TextureMappedSphere, TimegraphWidget, TitleWidget, TlmDetailsDialog, TlmEditDialog, TlmExtractor, TlmExtractorConfig, TlmExtractorProcessor, TlmGraphDialog, TlmGrapher, TlmRawDialog, TlmViewer, TlmViewerConfig, TrendbarWidget, TrendlimitsbarWidget, UdpInterface, UdpReadSocket, UdpReadWriteSocket, UdpWriteSocket, UnassignedTestSuite, UnixTimeConversion, UnixTimeFormattedConversion, UnixTimeSecondsConversion, ValueChooser, ValueWidget, ValuelimitsbarWidget, ValuelimitscolumnWidget, ValuerangebarWidget, ValuerangecolumnWidget, VerticalWidget, VerticalboxWidget, WatermarkProcessor, Win32, Win32API, Win32SerialDriver, XtceConverter, XtceParser, XyDataObject, XyDataObjectAdder, XyDataObjectEditor, XyPlot, XyPlotEditor, XyPlotGuiObject

Constant Summary collapse

BIN_FILE_PATTERN =
"Bin Files (*.bin);;All Files (*)"
TXT_FILE_PATTERN =
"Txt Files (*.txt);;All Files (*)"
CSV_FILE_PATTERN =
"Csv Files (*.csv);;All Files (*)"
CMD_FILE_PATTERN =
"Cmd Log Files (*cmd*.bin);;Bin Files (*.bin);;All Files (*)"
TLM_FILE_PATTERN =
"Tlm Log Files (*tlm*.bin);;Bin Files (*.bin);;All Files (*)"
COLORS =
{}
BRUSHES =
{}
PALETTES =
{}
PENS =
{}
FONTS =
{}
FONT_METRICS =
{}
CURSORS =
{}
GREEN =
getColor(0, 150, 0)
YELLOW =
getColor(190, 135, 0)
RED =
getColor(Qt::red)
BLUE =
getColor(0, 100, 255)
PURPLE =
getColor(200, 0, 200)
BLACK =
getColor(Qt::black)
WHITE =
getColor(Qt::white)
BLACK_NO_BRUSH =
Qt::Brush.new(Cosmos::BLACK, Qt::NoBrush)
DEFAULT_PALETTE =
Qt::Palette.new
RED_PALETTE =
Qt::Palette.new(Qt::red)
DASHLINE_PEN =
Qt::Pen.new(Qt::DashLine)
VERSION =
'4.5.0'
BASE_PWD =
Dir.pwd
COSMOS_MUTEX =

Global mutex for the Cosmos module

Mutex.new
PATH =

Path to COSMOS Gem based on location of top_level.rb

File.expand_path(File.join(File.dirname(__FILE__), '../..'))
COSMOS_MARSHAL_HEADER =

Header to put on all marshal files created by COSMOS

"ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}] COSMOS #{COSMOS_VERSION}"
USERPATH =

Initialize to nil before searching

nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_to_search_path(path, front = true) ⇒ Object

Adds a path to the global Ruby search path

Parameters:

  • path (String)

    Directory path



134
135
136
137
138
139
140
141
142
143
144
# File 'lib/cosmos/top_level.rb', line 134

def self.add_to_search_path(path, front = true)
  Cosmos.set_working_dir do
    path = File.expand_path(path)
    $:.delete(path)
    if front
      $:.unshift(path)
    else # Back
      $: << path
    end
  end
end

.catch_fatal_exceptionObject

Catch fatal exceptions within the block This is intended to catch exceptions before the GUI is available



554
555
556
557
558
559
560
561
562
563
# File 'lib/cosmos/top_level.rb', line 554

def self.catch_fatal_exception
  begin
    yield
  rescue Exception => error
    unless error.class == SystemExit or error.class == Interrupt
      Logger.level = Logger::FATAL
      Cosmos.handle_fatal_exception(error, false)
    end
  end
end

.check_log_configuration(packet_log_reader, log_filename) ⇒ Object

Try to change to a configuration in a packet log reader



255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/cosmos/gui/qt.rb', line 255

def self.check_log_configuration(packet_log_reader, log_filename)
  config_change_success, change_error = packet_log_reader.open(log_filename)
  unless config_change_success
    Qt.execute_in_main_thread(true) do
      if change_error
        Qt::MessageBox.warning(Qt::Application.instance.activeWindow, 'Warning', "When opening: #{log_filename}\n\nAn error occurred when changing to saved configuration:\n#{packet_log_reader.configuration_name}\n\n#{change_error.formatted}\n\nUsing default configuration")
      else
        Qt::MessageBox.warning(Qt::Application.instance.activeWindow, 'Warning', "When opening: #{log_filename}\n\nThe following saved configuration was not found:\n#{packet_log_reader.configuration_name}\n\nUsing default configuration")
      end
    end
  end
end

.close_socket(socket) ⇒ Object

Close a socket in a manner that ensures that any reads blocked in select will unblock across platforms

Parameters:

  • socket

    The socket to close



793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/cosmos/top_level.rb', line 793

def self.close_socket(socket)
  if socket
    # Calling shutdown and then sleep seems to be required
    # to get select to reliably unblock on linux
    begin
      socket.shutdown(:RDWR)
      sleep(0)
    rescue Exception
      # Oh well we tried
    end
    begin
      socket.close unless socket.closed?
    rescue Exception
      # Oh well we tried
    end
  end
end

.create_log_file(filename, log_dir = nil) {|file| ... } ⇒ String|nil

Opens a timestamped log file for writing. The opened file is yielded back to the block.

Parameters:

  • filename (String)

    String to append to the exception log filename. The filename will start with a date/time stamp.

  • log_dir (String) (defaults to: nil)

    By default this method will write to the COSMOS default log directory. By setting this parameter you can override the directory the log will be written to.

Yield Parameters:

  • file (File)

    The log file

Returns:

  • (String|nil)

    The fully pathed log file name or nil if there was an error creating the log file.



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/cosmos/top_level.rb', line 423

def self.create_log_file(filename, log_dir = nil)
  log_file = nil
  Cosmos.set_working_dir do
    begin
      # The following code goes inside a begin rescue because it reads the
      # system.txt configuration file. If this has an error we won't be able
      # to determine the log path but we still want to write the log.
      log_dir = System.instance.paths['LOGS'] unless log_dir
      # Make sure the log directory exists
      raise unless File.exist?(log_dir)
    rescue Exception
      log_dir = nil # Reset log dir since it failed above
      # First check for ./logs
      log_dir = './logs' if File.exist?('./logs')
      # Prefer ./outputs/logs if it exists
      log_dir = './outputs/logs' if File.exist?('./outputs/logs')
      # If all else fails just use the local directory
      log_dir = '.' unless log_dir
    end
    log_file = File.join(log_dir,
                         File.build_timestamped_filename([filename]))
    # Check for the log file existing. This could happen if this method gets
    # called more than once in the same second.
    if File.exist?(log_file)
      sleep 1.01 # Sleep before rebuilding the timestamp to get something unique
      log_file = File.join(log_dir,
                           File.build_timestamped_filename([filename]))
    end
    begin
      COSMOS_MUTEX.synchronize do
        begin
          file = File.open(log_file, 'w')
          yield file
        ensure
          file.close unless file.closed?
          File.chmod(0444, log_file) # Make file read only
        end
      end
    rescue Exception
      # Ensure we always return
    end
    log_file = File.expand_path(log_file)
  end
  return log_file
end

.data_path(name) ⇒ Object

Searches the COSMOS::USERPATH/config/data directory and then the core COSMOS/data directory for the given file name. Returns the absolute file path or nil if the file could not be found. This allows for user configuration files to override COSMOS data file defaults.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/cosmos/top_level.rb', line 150

def self.data_path(name)
  # Check USERPATH
  filename = File.join(::Cosmos::USERPATH, 'config', 'data', name)
  return filename if File.exist? filename

  # Check extensions
  begin
    Bundler.load.specs.each do |spec|
      spec_name_split = spec.name.split('-')
      if spec_name_split.length > 1 and spec_name_split[0] == 'cosmos'
        filename = File.join(spec.gem_dir, 'config', 'data', name)
        return filename if File.exist? filename
      end
    end
  rescue Bundler::GemfileNotFound
    # No Gemfile - so no gem based extensions
  end

  # Check CORE
  filename = File.join(::Cosmos::PATH, 'data', name)
  return filename if File.exist? filename

  # Check relative to executing file
  begin # path raises so begin rescue it
    filename = Cosmos.path($0, ['config', 'data', name])
    return filename if File.exist? filename
  rescue
    # Couldn't find the file so return nil below
  end
  nil
end

.define_user_path(start_dir = Dir.pwd) ⇒ Object

Searches for the /config/system and /config/targets directories to define the USERPATH constant

Parameters:

  • start_dir (String) (defaults to: Dir.pwd)

    Path to start the search for the /config/system and /config/targets directories. The search will continue by moving up directories until the root directory is reached.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/cosmos/top_level.rb', line 80

def self.define_user_path(start_dir = Dir.pwd)
  current_dir = File.expand_path(start_dir)
  while true
    if File.exist?(File.join(current_dir, 'config', 'system')) and
       File.exist?(File.join(current_dir, 'config', 'targets'))
      disable_warnings do
        Cosmos.const_set(:USERPATH, current_dir)
      end
      break
    else
      old_current_dir = current_dir
      current_dir = File.expand_path(File.join(current_dir, '..'))
      if old_current_dir == current_dir
        # Hit the root dir - give up
        break
      end
    end
  end
end

.disable_warningsObject

Disables the Ruby interpreter warnings such as when redefining a constant



66
67
68
69
70
71
72
# File 'lib/cosmos/top_level.rb', line 66

def self.disable_warnings
  saved_verbose = $VERBOSE
  $VERBOSE = nil
  yield
ensure
  $VERBOSE = saved_verbose
end

.get_default_fontObject

Get the default font for the platform (Windows, Mac, Linux)



199
200
201
202
203
204
205
# File 'lib/cosmos/gui/qt.rb', line 199

def self.get_default_font
  if Kernel.is_windows?
    Cosmos.getFont("Courier", 10)
  else
    Cosmos.getFont("Courier", 14)
  end
end

.get_default_small_fontObject

Get the default small font for the platform (Windows, Mac, Linux)



190
191
192
193
194
195
196
# File 'lib/cosmos/gui/qt.rb', line 190

def self.get_default_small_font
  if Kernel.is_windows?
    Cosmos.getFont("courier", 9)
  else
    Cosmos.getFont("courier", 12)
  end
end

.get_icon(name, fail_blank = true) ⇒ Object

Load the applications icon



248
249
250
251
252
# File 'lib/cosmos/gui/qt.rb', line 248

def self.get_icon(name, fail_blank = true)
  icon = Qt::Icon.new(Cosmos.data_path(name))
  icon = nil if icon.isNull && !fail_blank
  return icon
end

.getBrush(color) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cosmos/gui/qt.rb', line 124

def self.getBrush(color)
  return nil unless color
  return color if color.is_a? Qt::Brush
  brush = nil
  color = Cosmos.getColor(color)
  brush = BRUSHES[color]
  unless brush
    if color.is_a? Qt::LinearGradient
      brush = Qt::Brush.new(color)
    else
      brush = Qt::Brush.new(color, Qt::SolidPattern)
    end
    BRUSHES[color] = brush
  end
  brush
end

.getColor(color_r, color_g = nil, color_b = nil) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/cosmos/gui/qt.rb', line 100

def self.getColor(color_r, color_g = nil, color_b = nil)
  return color_r if (color_r.is_a? Qt::Color) || (color_r.is_a? Qt::Pen) || (color_r.is_a? Qt::LinearGradient)

  color = nil
  key = color_r
  key = key.to_i if key.is_a? Qt::Enum

  if color_r && color_g && color_b
    key = (color_r.to_i << 24) + (color_g.to_i << 16) + (color_b.to_i << 8)
  end

  if Cosmos::COLORS[key]
    color = Cosmos::COLORS[key]
  else
    if color_r && color_g && color_b
      color = Qt::Color.new(color_r.to_i, color_g.to_i, color_b.to_i)
    else
      color = Qt::Color.new(color_r)
    end
    Cosmos::COLORS[key] = color
  end
  color
end

.getCursor(shape) ⇒ Object



216
217
218
219
220
221
222
223
224
225
# File 'lib/cosmos/gui/qt.rb', line 216

def self.getCursor(shape)
  key = shape
  key = shape.to_i if shape.is_a? Qt::Enum
  cursor = CURSORS[key]
  unless cursor
    cursor = Qt::Cursor.new(shape)
    CURSORS[key] = cursor
  end
  cursor
end

.getFont(font_face, font_size, font_attrs = nil, font_italics = false) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/cosmos/gui/qt.rb', line 171

def self.getFont(font_face, font_size, font_attrs = nil, font_italics = false)
  FONTS[font_face] ||= {}
  FONTS[font_face][font_size] ||= {}
  FONTS[font_face][font_size][font_attrs] ||= {}
  font = FONTS[font_face][font_size][font_attrs][font_italics]
  unless font
    if font_attrs && font_italics
      font = Qt::Font.new(font_face, font_size, font_attrs, font_italics)
    elsif font_attrs
      font = Qt::Font.new(font_face, font_size, font_attrs)
    else
      font = Qt::Font.new(font_face, font_size)
    end
    FONTS[font_face][font_size][font_attrs][font_italics] = font
  end
  font
end

.getFontMetrics(font) ⇒ Object



207
208
209
210
211
212
213
214
# File 'lib/cosmos/gui/qt.rb', line 207

def self.getFontMetrics(font)
  font_metrics = FONT_METRICS[font]
  unless font_metrics
    font_metrics = Qt::FontMetrics.new(font)
    FONT_METRICS[font] = font_metrics
  end
  font_metrics
end

.getPalette(foreground, background) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/cosmos/gui/qt.rb', line 141

def self.getPalette(foreground, background)
  foreground = Cosmos.getColor(foreground)
  background = Cosmos.getColor(background)
  PALETTES[foreground] ||= {}
  p = PALETTES[foreground][background]
  unless p
    p = Qt::Palette.new
    p.setColor(Qt::Palette::Text, foreground)
    p.setColor(Qt::Palette::Base, background)
    p.setColor(Qt::Palette::Window, background)
    PALETTES[foreground][background] = p
  end
  p
end

.getPen(color = nil) ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/cosmos/gui/qt.rb', line 156

def self.getPen(color = nil)
  color = Cosmos.getColor(color) if color
  pen = nil
  pen = PENS[color]
  unless pen
    if color
      pen = Qt::Pen.new(color)
    else
      pen = Qt::Pen.new
    end
    PENS[color] = pen
  end
  pen
end

.handle_critical_exception(error, try_gui = true) ⇒ Object

CriticalErrors are errors that need to be brought to a user’s attention but do not cause an exit. A good example is if the packet log writer fails and can no longer write the log file. Write a message to the Logger, write an exception file, and popup a GUI window if try_gui. Ensure the GUI only comes up once so this method can be called over and over by failing code.

Parameters:

  • error (Exception)

    The exception to handle

  • try_gui (Boolean) (defaults to: true)

    Whether to try and create a GUI exception popup



597
598
599
600
601
602
603
604
605
# File 'lib/cosmos/top_level.rb', line 597

def self.handle_critical_exception(error, try_gui = true)
  Logger.error "Critical Exception! #{error.formatted}"
  if defined? ExceptionDialog and !ExceptionDialog.dialog_open? and $qApp
    log_file = self.write_exception_file(error)
    if try_gui
      Qt.execute_in_main_thread(true) {|| ExceptionDialog.new(nil, error, '', false, false, log_file)}
    end
  end
end

.handle_fatal_exception(error, try_gui = true) ⇒ Object

Write a message to the Logger, write an exception file, and popup a GUI window if try_gui. Finally ‘exit 1’ is called to end the calling program.

Parameters:

  • error (Exception)

    The exception to handle

  • try_gui (Boolean) (defaults to: true)

    Whether to try and create a GUI exception popup



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# File 'lib/cosmos/top_level.rb', line 570

def self.handle_fatal_exception(error, try_gui = true)
  $cosmos_fatal_exception = error
  log_file = self.write_exception_file(error)
  Logger.level = Logger::FATAL unless try_gui
  Logger.fatal "Fatal Exception! Exiting..."
  Logger.fatal error.formatted
  if defined? ExceptionDialog and try_gui and $qApp
    Qt.execute_in_main_thread(true) {||ExceptionDialog.new(nil, error, '', true, false, log_file)}
  else
    if $stdout != STDOUT
      $stdout = STDOUT
      Logger.fatal "Fatal Exception! Exiting..."
      Logger.fatal error.formatted
    end
    sleep 1 # Allow the messages to be printed and then crash
    exit 1
  end
end

.hash_files(filenames, additional_data = nil, hashing_algorithm = 'MD5') ⇒ Digest::<algorithm>

Runs a hash algorithm over one or more files and returns the Digest object. Handles windows/unix new line differences but changes in whitespace will change the hash sum.

Usage:

digest = Cosmos.hash_files(files, additional_data, hashing_algorithm)
digest.digest # => the 16 bytes of digest
digest.hexdigest # => the formatted string in hex

Parameters:

  • filenames (Array<String>)

    List of files to read and calculate a hashing sum on

  • additional_data (String) (defaults to: nil)

    Additional data to add to the hashing sum

  • hashing_algorithm (String) (defaults to: 'MD5')

    Hashing algorithm to use

Returns:

  • (Digest::<algorithm>)

    The hashing sum object



399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/cosmos/top_level.rb', line 399

def self.hash_files(filenames, additional_data = nil, hashing_algorithm = 'MD5')
  digest = Digest.const_get(hashing_algorithm).send('new')

  Cosmos.set_working_dir do
    filenames.each do |filename|
      # Read the file's data and add to the running hashing sum
      digest << File.read(filename).gsub(/\r/,'')
    end
  end
  digest << additional_data if additional_data
  digest
end

.kill_thread(owner, thread, graceful_timeout = 1, timeout_interval = 0.01, hard_timeout = 1) ⇒ Object

Attempt to gracefully kill a thread

Parameters:

  • owner

    Object that owns the thread and may have a graceful_kill method

  • thread

    The thread to gracefully kill

  • graceful_timeout (defaults to: 1)

    Timeout in seconds to wait for it to die gracefully

  • timeout_interval (defaults to: 0.01)

    How often to poll for aliveness

  • hard_timeout (defaults to: 1)

    Timeout in seconds to wait for it to die ungracefully



753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
# File 'lib/cosmos/top_level.rb', line 753

def self.kill_thread(owner, thread, graceful_timeout = 1, timeout_interval = 0.01, hard_timeout = 1)
  if thread
    if owner and owner.respond_to? :graceful_kill
      if Thread.current != thread
        owner.graceful_kill
        end_time = Time.now.sys + graceful_timeout
        while thread.alive? && ((end_time - Time.now.sys) > 0)
          sleep(timeout_interval)
        end
      else
        Logger.warn "Threads cannot graceful_kill themselves"
      end
    elsif owner
      Logger.info "Thread owner #{owner.class} does not support graceful_kill"
    end
    if thread.alive?
      # If the thread dies after alive? but before backtrace, bt will be nil.
      bt = thread.backtrace

      # Graceful failed
      msg =  "Failed to gracefully kill thread:\n"
      msg << "  Caller Backtrace:\n  #{caller().join("\n  ")}\n"
      msg << "  \n  Thread Backtrace:\n  #{bt.join("\n  ")}\n" if bt
      msg << "\n"
      Logger.warn msg
      thread.kill
      end_time = Time.now.sys + hard_timeout
      while thread.alive? && ((end_time - Time.now.sys) > 0)
        sleep(timeout_interval)
      end
    end
    if thread.alive?
      Logger.error "Failed to kill thread"
    end
  end
end

.load_cosmos_icon(name = 'COSMOS_64x64.png') ⇒ Object

Load the applications icon



240
241
242
243
244
245
# File 'lib/cosmos/gui/qt.rb', line 240

def self.load_cosmos_icon(name='COSMOS_64x64.png')
  icon = Cosmos.get_icon(name, false)
  icon = Cosmos.get_icon('COSMOS_64x64.png', false) unless icon
  Qt::Application.instance.setWindowIcon(icon) if icon
  return icon
end

.marshal_dump(marshal_filename, obj) ⇒ Object

Creates a marshal file by serializing the given obj

Parameters:

  • marshal_filename (String)

    Name of the marshal file to create

  • obj (Object)

    The object to serialize to the file



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/cosmos/top_level.rb', line 231

def self.marshal_dump(marshal_filename, obj)
  begin
    Cosmos.set_working_dir do
      File.open(marshal_filename, 'wb') do |file|
        file.write(COSMOS_MARSHAL_HEADER)
        file.write(Marshal.dump(obj))
      end
    end
  rescue Exception => exception
    begin
      Cosmos.set_working_dir do
        File.delete(marshal_filename)
      end
    rescue Exception
      # Oh well - we tried
    end
    if exception.class == TypeError and exception.message =~ /Thread::Mutex/
      original_backtrace = exception.backtrace
      exception = exception.exception("Mutex exists in a packet.  Note: Packets must not be read during class initializers for Conversions, Limits Responses, etc.: #{exception}")
      exception.set_backtrace(original_backtrace)
    end
    self.handle_fatal_exception(exception)
  end
end

.marshal_load(marshal_filename) ⇒ Object

Loads the marshal file back into a Ruby object

Parameters:

  • marshal_filename (String)

    Name of the marshal file to load



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/cosmos/top_level.rb', line 259

def self.marshal_load(marshal_filename)
  begin
    cosmos_marshal_header = nil
    data = nil
    Cosmos.set_working_dir do
      File.open(marshal_filename, 'rb') do |file|
        cosmos_marshal_header = file.read(COSMOS_MARSHAL_HEADER.length)
        data = file.read
      end
    end
    if cosmos_marshal_header == COSMOS_MARSHAL_HEADER
      return Marshal.load(data)
    else
      Logger.warn "Marshal load failed with invalid marshal file: #{marshal_filename}"
      return nil
    end
  rescue Exception => exception
    Cosmos.set_working_dir do
      if File.exist?(marshal_filename)
        Logger.error "Marshal load failed with exception: #{marshal_filename}\n#{exception.formatted}"
      else
        Logger.info "Marshal file does not exist: #{marshal_filename}"
      end

      # Try to delete the bad marshal file
      begin
        File.delete(marshal_filename)
      rescue Exception
        # Oh well - we tried
      end
      self.handle_fatal_exception(exception) if File.exist?(marshal_filename)
    end
    return nil
  end
end

.open_file_browser(path) ⇒ Object

Open a platform specific file browser at the given path

Parameters:

  • path (String)

    Directory path



671
672
673
674
675
676
677
678
679
# File 'lib/cosmos/top_level.rb', line 671

def self.open_file_browser(path)
  if Kernel.is_windows?
    self.run_process("start #{path}")
  elsif Kernel.is_mac?
    self.run_process("open #{path}")
  else
    self.run_process("xdg-open #{path}")
  end
end

.open_in_text_editor(filename) ⇒ Object

Parameters:

  • filename (String)

    Name of the file to open in the editor



682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
# File 'lib/cosmos/top_level.rb', line 682

def self.open_in_text_editor(filename)
  if filename
    if ENV['COSMOS_TEXT']
      self.run_process("#{ENV['COSMOS_TEXT']} \"#{filename}\"")
    else
      if Kernel.is_windows?
        if File.extname(filename).to_s.downcase == '.csv'
          self.run_process("cmd /c \"start wordpad \"#{filename.gsub('/','\\')}\"\"")
        else
          self.run_process("cmd /c \"start \"\" \"#{filename.gsub('/','\\')}\"\"")
        end
      elsif Kernel.is_mac?
        self.run_process("open -a TextEdit \"#{filename}\"")
      else
        which_gedit = `which gedit 2>&1`.chomp
        if which_gedit.to_s.strip == "" or which_gedit =~ /Command not found/i or which_gedit =~ /no .* in/i
          # No gedit
          ['xterm', 'gnome-terminal', 'urxvt', 'rxvt'].each do |terminal|
            which_terminal = `which #{terminal} 2>&1`.chomp
            next if which_terminal.to_s.strip == "" or which_terminal =~ /Command not found/i or which_terminal =~ /no .* in/i
            editor = ENV['VISUAL']
            editor = ENV['EDITOR'] unless editor
            editor = 'vi' unless editor
            self.run_process("#{terminal} -e \"#{editor} '#{filename}'\"")
            break
          end
        else
          # Have gedit
          self.run_process("gedit \"#{filename}\"")
        end
      end
    end
  end
end

.open_in_web_browser(filename) ⇒ Object

Parameters:

  • filename (String)

    Name of the file to open in the web browser



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# File 'lib/cosmos/top_level.rb', line 718

def self.open_in_web_browser(filename)
  if filename
    if Kernel.is_windows?
      self.run_process("cmd /c \"start \"\" \"#{filename.gsub('/','\\')}\"\"")
    elsif Kernel.is_mac?
      self.run_process("open -a Safari \"#{filename}\"")
    else
      which_firefox = `which firefox`.chomp
      if which_firefox =~ /Command not found/i or which_firefox =~ /no .* in/i
        raise "Firefox not found"
      else
        system_call = "#{which_firefox} \"#{filename}\""
      end
      self.run_process(system_call)
    end
  end
end

.path(calling_file, *paths) ⇒ Object

Returns a path to a cosmos file. Prefers files in USERPATH but will look relative to calling_file if not present in USERPATH

Parameters:

  • calling_file (String)

    Should be __FILE__ from the calling file

  • paths (Array<String>)

    Partial paths like in File.join



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/cosmos/top_level.rb', line 186

def self.path(calling_file, *paths)
  partial_path = File.join(*paths)

  # First look in the Cosmos::USERPATH
  user_path = File.join(Cosmos::USERPATH, partial_path)
  return user_path if File.exist?(user_path)

  # Check cosmos extensions
  begin
    Bundler.load.specs.each do |spec|
      spec_name_split = spec.name.split('-')
      if spec_name_split.length > 1 and spec_name_split[0] == 'cosmos'
        filename = File.join(spec.gem_dir, partial_path)
        return filename if File.exist? filename
      end
    end
  rescue Bundler::GemfileNotFound
    # No Gemfile - so no gem based extensions
  end

  # Then look relative to the calling file
  if Pathname.new(calling_file).absolute?
    current_dir = File.dirname(calling_file)
  else
    current_dir = File.join(BASE_PWD, calling_file)
  end
  loop do
    test_path = File.join(current_dir, partial_path)
    if File.exist?(test_path)
      return test_path
    else
      old_current_dir = current_dir
      current_dir = File.expand_path(File.join(current_dir, '..'))
      if old_current_dir == current_dir
        # Hit the root dir - give up
        raise "Could not find path to #{File.join(*paths)}"
      end
    end
  end
end

.play_wav_file(wav_filename) ⇒ Object

Play a wav file

Parameters:

  • wav_filename

    filename of the wav file



813
814
815
816
817
818
819
820
821
822
823
# File 'lib/cosmos/top_level.rb', line 813

def self.play_wav_file(wav_filename)
  if defined? Qt and wav_filename
    Qt.execute_in_main_thread(true) do
      if Qt::CoreApplication.instance and Qt::Sound.isAvailable
        Cosmos.set_working_dir do
          Qt::Sound.play(wav_filename.to_s)
        end
      end
    end
  end
end

.require_class(class_name_or_class_filename, log_error = true) ⇒ Object

Require the class represented by the filename. This uses the standard Ruby convention of having a single class per file where the class name is camel cased and filename is lowercase with underscores.

Parameters:

  • class_name_or_class_filename (String)

    The name of the class or the file which contains the Ruby class to require

  • log_error (Boolean) (defaults to: true)

    Whether to log an error if we can't require the class



639
640
641
642
643
644
645
646
647
648
649
650
651
652
# File 'lib/cosmos/top_level.rb', line 639

def self.require_class(class_name_or_class_filename, log_error = true)
  if class_name_or_class_filename.downcase[-3..-1] == '.rb' or (class_name_or_class_filename[0] == class_name_or_class_filename[0].downcase)
    class_filename = class_name_or_class_filename
    class_name = class_filename.filename_to_class_name
  else
    class_name = class_name_or_class_filename
    class_filename = class_name.class_name_to_filename
  end
  return class_name.to_class if class_name.to_class and defined? class_name.to_class
  self.require_file(class_filename, log_error)
  klass = class_name.to_class
  raise "Ruby class #{class_name} not found" unless klass
  klass
end

.require_file(filename, log_error = true) ⇒ Object

Requires a file with a standard error message if it fails

Parameters:

  • filename (String)

    The name of the file to require

  • log_error (Boolean) (defaults to: true)

    Whether to log an error if we can't require the class



658
659
660
661
662
663
664
665
666
667
# File 'lib/cosmos/top_level.rb', line 658

def self.require_file(filename, log_error = true)
  begin
    require filename
  rescue Exception => err
    msg = "Unable to require #{filename} due to #{err.message}. "\
      "Ensure #{filename} is in the COSMOS lib directory."
    Logger.error msg if log_error
    raise $!, msg, $!.backtrace
  end
end

.run_cosmos_tool(tool_name, parameters = '') ⇒ Object

Runs a COSMOS tool

Parameters:

  • tool_name (String)

    COSMOS tool to execute

  • parameters (String) (defaults to: '')

    Parameters string to pass to the tool



375
376
377
378
379
380
381
382
383
# File 'lib/cosmos/top_level.rb', line 375

def self.run_cosmos_tool(tool_name, parameters = '')
  if Kernel.is_windows?
    Cosmos.run_process("rubyw tools/#{tool_name} #{parameters}")
  elsif Kernel.is_mac? and File.exist?("tools/mac/#{tool_name}.app")
    Cosmos.run_process("open tools/mac/#{tool_name}.app --args #{parameters}")
  else
    Cosmos.run_process("ruby tools/#{tool_name} #{parameters}")
  end
end

.run_process(command) ⇒ Object

Changes the current working directory to the USERPATH and then executes the command in a new Ruby Thread.

Parameters:

  • command (String)

    The command to execute via the 'system' call



299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/cosmos/top_level.rb', line 299

def self.run_process(command)
  thread = nil
  Cosmos.set_working_dir do
    thread = Thread.new do
      system(command)
    end
    # Wait for the thread and process to start
    sleep 0.01 until !thread.status.nil?
    sleep 0.1
  end
  thread
end

.run_process_check_output(command) ⇒ Object

Changes the current working directory to the USERPATH and then executes the command in a new Ruby Thread. Will show a messagebox or print the output if the process produces any output

Parameters:

  • command (String)

    The command to execute via the 'system' call



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/cosmos/top_level.rb', line 317

def self.run_process_check_output(command)
  thread = nil
  Cosmos.set_working_dir do
    thread = Thread.new do
      output, _ = Open3.capture2e(command)
      if !output.empty?
        # Ignore modalSession messages on Mac Mavericks and Qt Untested Windows 10
        new_output = ''
        output.each_line do |line|
          new_output << line if line !~ /modalSession/ && line !~ /Untested Windows version 10.0/
        end
        output = new_output

        if !output.empty?
          Logger.error output
          self.write_unexpected_file(output)
          if defined? ::Qt and $qApp
            Qt.execute_in_main_thread(false) do
              dialog = Qt::Dialog.new do |box|
                box.setWindowTitle('Unexpected text output')
                box.resize(600, 600)
                text_field = Qt::PlainTextEdit.new
                text_field.setReadOnly(true)
                orig_font = text_field.font
                text_field.setFont(Cosmos.getFont(orig_font.family, orig_font.point_size+2))
                text_field.setWordWrapMode(Qt::TextOption::NoWrap)
                text_field.appendPlainText(output)
                vframe = Qt::VBoxLayout.new
                vframe.addWidget(text_field)
                sep = Qt::Frame.new(box)
                sep.setFrameStyle(Qt::Frame::VLine | Qt::Frame::Sunken)
                vframe.addWidget(sep)
                ok = Qt::PushButton.new('OK')
                ok.setDefault(true)
                ok.connect(SIGNAL('clicked(bool)')) { box.accept }
                vframe.addWidget(ok)
                box.setLayout(vframe)
                box.show
                box.raise
              end
              dialog.exec
              dialog.dispose
            end
          end
        end
      end
    end
    # Wait for the thread and process to start
    sleep 0.01 until !thread.status.nil?
    sleep 0.1
  end
  thread
end

.safe_thread(name, retry_attempts = 0) ⇒ Object

Creates a Ruby Thread to run the given block. Rescues any exceptions and retries the threads the given number of times before handling the thread death by calling handle_fatal_exception.

Parameters:

  • name (String)

    Name of the thread

  • retry_attempts (Integer) (defaults to: 0)

    The number of times to allow the thread to restart before exiting



614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/cosmos/top_level.rb', line 614

def self.safe_thread(name, retry_attempts = 0)
  Thread.new do
    retry_count = 0
    begin
      yield
    rescue => error
      Logger.error "#{name} thread unexpectedly died. Retries: #{retry_count} of #{retry_attempts}"
      Logger.error error.formatted
      retry_count += 1
      if retry_count <= retry_attempts
        self.write_exception_file(error)
        retry
      end
      handle_fatal_exception(error)
    end
  end
end

.set_working_dir(working_dir = Cosmos::USERPATH) ⇒ Object

Temporarily set the working directory during a block



737
738
739
740
741
742
743
744
745
# File 'lib/cosmos/top_level.rb', line 737

def self.set_working_dir(working_dir = Cosmos::USERPATH)
  current_dir = Dir.pwd
  Dir.chdir(working_dir)
  begin
    yield
  ensure
    Dir.chdir(current_dir)
  end
end

.write_exception_file(exception, filename = 'exception', log_dir = nil) ⇒ String|nil

Writes a log file with information about the current configuration including the Ruby version, Cosmos version, whether you are on Windows, the COSMOS path and userpath, and the Ruby path along with the exception that is passed in.

Parameters:

  • filename (String) (defaults to: 'exception')

    String to append to the exception log filename. The filename will start with a date/time stamp.

  • log_dir (String) (defaults to: nil)

    By default this method will write to the COSMOS default log directory. By setting this parameter you can override the directory the log will be written to.

Returns:

  • (String|nil)

    The fully pathed log file name or nil if there was an error creating the log file.



481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/cosmos/top_level.rb', line 481

def self.write_exception_file(exception, filename = 'exception', log_dir = nil)
  log_file = create_log_file(filename, log_dir) do |file|
    begin
      file.puts "Exception:"
      if exception
        file.puts exception.formatted
        file.puts
      else
        file.puts "No Exception Given"
        file.puts caller.join("\n")
        file.puts
      end
      file.puts "Caller Backtrace:"
      file.puts caller().join("\n")
      file.puts

      file.puts "Ruby Version: ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]"
      file.puts "Rubygems Version: #{Gem::VERSION}"
      file.puts "Cosmos Version: #{Cosmos::VERSION}"
      file.puts "Cosmos::PATH: #{Cosmos::PATH}"
      file.puts "Cosmos::USERPATH: #{Cosmos::USERPATH}"
      file.puts ""
      file.puts "Environment:"
      file.puts "RUBYOPT: #{ENV['RUBYOPT']}"
      file.puts "RUBYLIB: #{ENV['RUBYLIB']}"
      file.puts "GEM_PATH: #{ENV['GEM_PATH']}"
      file.puts "GEMRC: #{ENV['GEMRC']}"
      file.puts "RI_DEVKIT: #{ENV['RI_DEVKIT']}"
      file.puts "GEM_HOME: #{ENV['GEM_HOME']}"
      file.puts "PATH: #{ENV['PATH']}"
      file.puts ""
      file.puts "Ruby Path:\n  #{$:.join("\n  ")}\n\n"
      file.puts "Gems:"
      Gem.loaded_specs.values.map {|x| file.puts "#{x.name} #{x.version} #{x.platform}"}
      file.puts ""
      file.puts "All Threads Backtraces:"
      Thread.list.each do |thread|
        file.puts thread.backtrace.join("\n")
        file.puts
      end
      file.puts ""
      file.puts ""
    ensure
      file.close
    end
  end
  return log_file
end

.write_unexpected_file(text, filename = 'unexpected', log_dir = nil) ⇒ String|nil

Writes a log file with information about unexpected output

@param text The unexpected output text

Parameters:

  • filename (String) (defaults to: 'unexpected')

    String to append to the exception log filename. The filename will start with a date/time stamp.

  • log_dir (String) (defaults to: nil)

    By default this method will write to the COSMOS default log directory. By setting this parameter you can override the directory the log will be written to.

Returns:

  • (String|nil)

    The fully pathed log file name or nil if there was an error creating the log file.



540
541
542
543
544
545
546
547
548
549
550
# File 'lib/cosmos/top_level.rb', line 540

def self.write_unexpected_file(text, filename = 'unexpected', log_dir = nil)
  log_file = create_log_file(filename, log_dir) do |file|
    begin
      file.puts "Unexpected Output:\n\n"
      file.puts text
    ensure
      file.close
    end
  end
  return log_file
end

Instance Method Details

#get_tooltip_textObject

Disable tooltip so that graph can be moused-over



59
60
61
# File 'lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb', line 59

def get_tooltip_text
  return nil
end