cosmos 4.2.4 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.dockerignore +2 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- data/.github/ISSUE_TEMPLATE/help---usage---general-question.md +12 -0
- data/.gitignore +2 -0
- data/.travis.yml +6 -6
- data/Dockerfile +69 -0
- data/Gemfile +1 -1
- data/Manifest.txt +130 -46
- data/README.md +9 -0
- data/Rakefile +57 -0
- data/appveyor.yml +18 -7
- data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
- data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +5 -5
- data/autohotkey/config/targets/INST/lib/sim_inst.rb +3 -1
- data/autohotkey/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +2 -4
- data/autohotkey/config/tools/table_manager/SubTables/OneDimensionalSubTable_def.txt +31 -0
- data/autohotkey/config/tools/table_manager/SubTables/TwoDimensionalSubTable_def.txt +28 -0
- data/autohotkey/config/tools/test_runner/test_runner.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner2.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner3.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -1
- data/autohotkey/lib/cmd_sequence_exporter.rb +52 -0
- data/autohotkey/procedures/collect.rb +2 -2
- data/autohotkey/procedures/collect_util.rb +1 -1
- data/autohotkey/procedures/script_test.rb +1 -1
- data/autohotkey/tools/CmdSenderAHK2 +18 -0
- data/autohotkey/tools/cmd_sender.ahk +34 -6
- data/autohotkey/tools/cmd_sender2.ahk +4 -0
- data/autohotkey/tools/cmd_sequence.ahk +36 -22
- data/autohotkey/tools/cmd_sequence2.ahk +1 -1
- data/autohotkey/tools/config_editor.ahk +5 -5
- data/autohotkey/tools/launcher.ahk +1 -0
- data/autohotkey/tools/limits_monitor.ahk +1 -1
- data/autohotkey/tools/packet_viewer.ahk +7 -6
- data/autohotkey/tools/script_runner.ahk +16 -4
- data/autohotkey/tools/test_runner.ahk +8 -8
- data/bin/cosmos +38 -1
- data/bin/cstol_converter +1 -1
- data/bin/dart_util +0 -0
- data/bin/rubysloc +73 -28
- data/bin/xtce_converter +1 -1
- data/cosmos.gemspec +7 -9
- data/data/config/_interfaces.yaml +4 -0
- data/data/config/cmd_sequence.yaml +14 -0
- data/data/config/command_modifiers.yaml +16 -1
- data/data/config/housekeeping_params.yaml +14 -0
- data/data/config/interface_modifiers.yaml +14 -2
- data/data/config/item_modifiers.yaml +11 -1
- data/data/config/launcher.yaml +12 -2
- data/data/config/param_item_modifiers.yaml +7 -2
- data/data/config/parameter_modifiers.yaml +20 -0
- data/data/config/screen.yaml +2 -0
- data/data/config/script_runner.yaml +9 -0
- data/data/config/system.yaml +152 -28
- data/data/config/table_manager.yaml +7 -0
- data/data/config/target.yaml +12 -0
- data/data/config/telemetry_modifiers.yaml +19 -2
- data/data/config/test_runner.yaml +10 -9
- data/data/config/widgets.yaml +174 -11
- data/data/crc.txt +428 -415
- data/demo/Gemfile +1 -1
- data/demo/Launcher.bat +1 -9
- data/demo/Launcher2.bat +1 -0
- data/demo/LauncherMini.bat +1 -0
- data/demo/Rakefile +2 -0
- data/demo/config/dart/Gemfile +2 -7
- data/demo/config/data/crc.txt +243 -219
- data/demo/config/system/system.txt +42 -3
- data/demo/config/system/system2.txt +34 -5
- data/demo/config/system/system_alt_ports.txt +80 -0
- data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +1 -0
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +5 -4
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +12 -7
- data/demo/config/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
- data/demo/config/targets/INST/cmd_tlm_server.txt +2 -0
- data/demo/config/targets/INST/lib/sim_inst.rb +15 -3
- data/demo/config/targets/INST/screens/adcs.txt +2 -2
- data/demo/config/targets/INST/screens/block.txt +1 -1
- data/demo/config/targets/INST/screens/commanding.txt +1 -1
- data/demo/config/targets/INST/screens/ground.txt +27 -5
- data/demo/config/targets/INST/screens/ground_error.gif +0 -0
- data/demo/config/{data/groundoff.gif → targets/INST/screens/ground_off.gif} +0 -0
- data/demo/config/{data/groundon.gif → targets/INST/screens/ground_on.gif} +0 -0
- data/demo/config/targets/INST/screens/limits.txt +69 -31
- data/demo/config/targets/INST/screens/other.txt +13 -3
- data/demo/config/targets/INST/screens/params.txt +54 -0
- data/demo/config/targets/INST/screens/satellite.gif +0 -0
- data/demo/config/targets/INST/target.txt +1 -0
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server_chain.txt +18 -0
- data/demo/config/tools/data_viewer/data_viewer.txt +3 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/demo/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/demo/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/demo/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/demo/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/demo/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/demo/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/demo/config/tools/script_runner/script_runner.txt +1 -2
- data/demo/config/tools/test_runner/test_runner.txt +3 -1
- data/demo/lib/example_background_task.rb +1 -0
- data/demo/procedures/cosmos_api_test.rb +26 -22
- data/demo/procedures/interactive.rb +22 -0
- data/demo/procedures/local_screen_example.rb +51 -0
- data/ext/cosmos/ext/cosmos_io/cosmos_io.c +32 -4
- data/ext/cosmos/ext/packet/packet.c +6 -77
- data/ext/mkrf_conf.rb +2 -2
- data/extensions/vscode/.gitignore +4 -0
- data/extensions/vscode/.vscode/launch.json +32 -0
- data/extensions/vscode/.vscode/settings.json +13 -0
- data/extensions/vscode/.vscode/tasks.json +79 -0
- data/extensions/vscode/License.txt +879 -0
- data/extensions/vscode/README.md +9 -0
- data/extensions/vscode/client/License.txt +879 -0
- data/extensions/vscode/client/README.md +39 -0
- data/extensions/vscode/client/cosmos.configuration.json +23 -0
- data/extensions/vscode/client/images/icon.png +0 -0
- data/extensions/vscode/client/package-lock.json +414 -0
- data/extensions/vscode/client/package.json +105 -0
- data/extensions/vscode/client/src/extension.ts +132 -0
- data/extensions/vscode/client/src/screen_preview.rb +25 -0
- data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
- data/extensions/vscode/client/tsconfig.json +17 -0
- data/extensions/vscode/package-lock.json +26 -0
- data/extensions/vscode/package.json +35 -0
- data/extensions/vscode/server/License.txt +879 -0
- data/extensions/vscode/server/package-lock.json +236 -0
- data/extensions/vscode/server/package.json +29 -0
- data/extensions/vscode/server/src/server.ts +59 -0
- data/extensions/vscode/server/tsconfig.json +16 -0
- data/install/Gemfile +1 -1
- data/install/Launcher.bat +1 -9
- data/install/config/dart/Gemfile +3 -8
- data/install/config/data/crc.txt +148 -132
- data/install/config/system/system.txt +36 -3
- data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/install/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/install/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/install/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/install/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/install/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/install/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/lib/cosmos/config/config_parser.rb +4 -5
- data/lib/cosmos/conversions.rb +2 -0
- data/lib/cosmos/conversions/packet_time_formatted_conversion.rb +38 -0
- data/lib/cosmos/conversions/packet_time_seconds_conversion.rb +38 -0
- data/lib/cosmos/core_ext/cosmos_io.rb +2 -1
- data/lib/cosmos/core_ext/time.rb +3 -1
- data/lib/cosmos/dart/config/boot.rb +1 -1
- data/lib/cosmos/dart/config/database.yml +2 -0
- data/lib/cosmos/dart/examples/dart_decom_client.rb +1 -1
- data/lib/cosmos/dart/examples/dart_stream_client.rb +6 -2
- data/lib/cosmos/dart/lib/dart_common.rb +13 -6
- data/lib/cosmos/dart/lib/dart_constants.rb +15 -0
- data/lib/cosmos/dart/lib/dart_database_cleaner.rb +2 -2
- data/lib/cosmos/dart/lib/dart_decom_query.rb +5 -6
- data/lib/cosmos/dart/lib/dart_decommutator.rb +64 -54
- data/lib/cosmos/dart/lib/dart_importer.rb +3 -3
- data/lib/cosmos/dart/lib/dart_master_query.rb +71 -0
- data/lib/cosmos/dart/lib/dart_packet_log_writer.rb +2 -2
- data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +165 -134
- data/lib/cosmos/dart/processes/dart.rb +4 -2
- data/lib/cosmos/dart/processes/dart_decom_server.rb +3 -3
- data/lib/cosmos/dart/processes/dart_ingester.rb +40 -1
- data/lib/cosmos/dart/processes/dart_master.rb +44 -0
- data/lib/cosmos/dart/processes/dart_util.rb +119 -4
- data/lib/cosmos/dart/spec/dart/dart_reducer_manager_spec.rb +3 -3
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +9 -5
- data/lib/cosmos/gui/dialogs/details_dialog.rb +44 -29
- data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +3 -3
- data/lib/cosmos/gui/dialogs/interface_raw_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +11 -10
- data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +4 -2
- data/lib/cosmos/gui/opengl/earth_model.rb +1 -1
- data/lib/cosmos/gui/qt.rb +13 -2
- data/lib/cosmos/gui/qt_tool.rb +71 -43
- data/lib/cosmos/gui/text/ruby_editor.rb +91 -49
- data/lib/cosmos/gui/utilities/classification_banner.rb +60 -0
- data/lib/cosmos/gui/utilities/screenshot.rb +1 -1
- data/lib/cosmos/gui/utilities/script_module_gui.rb +117 -91
- data/lib/cosmos/gui/widgets/dart_meta_frame.rb +22 -3
- data/lib/cosmos/interfaces.rb +2 -0
- data/lib/cosmos/interfaces/dart_status_interface.rb +1 -1
- data/lib/cosmos/interfaces/interface.rb +9 -1
- data/lib/cosmos/interfaces/linc_interface.rb +3 -3
- data/lib/cosmos/interfaces/protocols/burst_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/crc_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +40 -18
- data/lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb +46 -0
- data/lib/cosmos/interfaces/protocols/length_protocol.rb +5 -0
- data/lib/cosmos/interfaces/protocols/preidentified_protocol.rb +68 -23
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +9 -4
- data/lib/cosmos/interfaces/serial_interface.rb +7 -1
- data/lib/cosmos/interfaces/simulated_target_interface.rb +14 -5
- data/lib/cosmos/interfaces/stream_interface.rb +1 -1
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +13 -13
- data/lib/cosmos/io/json_drb.rb +16 -12
- data/lib/cosmos/io/json_drb_object.rb +7 -2
- data/lib/cosmos/io/json_drb_rack.rb +25 -5
- data/lib/cosmos/io/json_rpc.rb +1 -1
- data/lib/cosmos/io/posix_serial_driver.rb +60 -22
- data/lib/cosmos/io/serial_driver.rb +11 -8
- data/lib/cosmos/io/win32_serial_driver.rb +31 -3
- data/lib/cosmos/packet_logs/packet_log_reader.rb +71 -28
- data/lib/cosmos/packet_logs/packet_log_writer.rb +13 -1
- data/lib/cosmos/packets/commands.rb +30 -9
- data/lib/cosmos/packets/packet.rb +105 -34
- data/lib/cosmos/packets/packet_config.rb +60 -10
- data/lib/cosmos/packets/parsers/format_string_parser.rb +0 -1
- data/lib/cosmos/packets/parsers/state_parser.rb +0 -1
- data/lib/cosmos/packets/parsers/xtce_converter.rb +2 -0
- data/lib/cosmos/packets/parsers/xtce_parser.rb +5 -4
- data/lib/cosmos/packets/structure.rb +32 -4
- data/lib/cosmos/packets/structure_item.rb +5 -1
- data/lib/cosmos/packets/telemetry.rb +30 -4
- data/lib/cosmos/script/api_shared.rb +22 -10
- data/lib/cosmos/script/extract.rb +1 -1
- data/lib/cosmos/script/limits.rb +4 -0
- data/lib/cosmos/script/script.rb +29 -20
- data/lib/cosmos/script/scripting.rb +16 -14
- data/lib/cosmos/script/telemetry.rb +3 -1
- data/lib/cosmos/script/tools.rb +18 -8
- data/lib/cosmos/streams/serial_stream.rb +11 -6
- data/lib/cosmos/system/system.rb +214 -76
- data/lib/cosmos/system/target.rb +39 -9
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +116 -55
- data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +15 -0
- data/lib/cosmos/tools/cmd_sender/cmd_params.rb +382 -0
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +54 -340
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +74 -52
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +40 -333
- data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +16 -11
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +13 -0
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +2 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +44 -15
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +8 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +18 -20
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +13 -2
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +13 -13
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -6
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +8 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +5 -5
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +35 -20
- data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +15 -11
- data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +5 -0
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +2 -0
- data/lib/cosmos/tools/config_editor/config_editor.rb +181 -94
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +10 -9
- data/lib/cosmos/tools/config_editor/system_config_dialog.rb +158 -0
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +57 -47
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +1 -0
- data/lib/cosmos/tools/data_viewer/dump_component.rb +3 -9
- data/lib/cosmos/tools/data_viewer/text_component.rb +77 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +68 -42
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +1 -1
- data/lib/cosmos/tools/launcher/launcher.rb +2 -1
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +59 -41
- data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +42 -42
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +64 -59
- data/lib/cosmos/tools/script_runner/script_runner.rb +198 -123
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +14 -0
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +87 -35
- data/lib/cosmos/tools/table_manager/table_config.rb +5 -3
- data/lib/cosmos/tools/table_manager/table_manager.rb +48 -45
- data/lib/cosmos/tools/test_runner/test.rb +5 -2
- data/lib/cosmos/tools/test_runner/test_runner.rb +61 -38
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +24 -12
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +48 -48
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +5 -8
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +20 -16
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +3 -3
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +7 -7
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +10 -10
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +10 -3
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +6 -6
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +14 -14
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +21 -17
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +5 -8
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +94 -91
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +27 -26
- data/lib/cosmos/tools/tlm_viewer/screen.rb +76 -14
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +51 -34
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +3 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +4 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +4 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb +16 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +17 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +1 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb +40 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +12 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +79 -29
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +1 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +2 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +2 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +4 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +33 -25
- data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +4 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +5 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +6 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +10 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelled_widget.rb +58 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +2 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/led_widget.rb +108 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb +60 -10
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +22 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb +19 -13
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb +22 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +4 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +1 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +10 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +7 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +4 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +4 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/spacer_widget.rb +4 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +13 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +3 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +6 -12
- data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +5 -10
- data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +4 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +8 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +9 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +60 -47
- data/lib/cosmos/top_level.rb +37 -13
- data/lib/cosmos/utilities/ruby_lex_utils.rb +34 -30
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/excel.rb +81 -24
- data/make_gems.sh +10 -0
- data/run_gui_tests.bat +1 -0
- data/spec/conversions/packet_time_formatted_conversion_spec.rb +58 -0
- data/spec/conversions/packet_time_seconds_conversion_spec.rb +60 -0
- data/spec/core_ext/socket_spec.rb +1 -1
- data/spec/core_ext/time_spec.rb +4 -0
- data/spec/gui/utilities/script_module_gui_spec.rb +44 -63
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +5 -5
- data/spec/install/yaml_docs_spec.rb +132 -0
- data/spec/interfaces/linc_interface_spec.rb +1 -1
- data/spec/interfaces/protocols/fixed_protocol_spec.rb +20 -9
- data/spec/interfaces/protocols/ignore_packet_protocol_spec.rb +243 -0
- data/spec/interfaces/protocols/length_protocol_spec.rb +39 -0
- data/spec/interfaces/protocols/preidentified_protocol_spec.rb +227 -4
- data/spec/interfaces/protocols/template_protocol_spec.rb +78 -25
- data/spec/io/json_drb_rack_spec.rb +166 -0
- data/spec/io/json_drb_spec.rb +14 -0
- data/spec/io/json_rpc_spec.rb +4 -5
- data/spec/io/posix_serial_driver_spec.rb +81 -0
- data/spec/io/serial_driver_spec.rb +15 -13
- data/spec/io/win32_serial_driver_spec.rb +33 -3
- data/spec/packet_logs/packet_log_reader_spec.rb +106 -52
- data/spec/packets/commands_spec.rb +22 -0
- data/spec/packets/packet_config_spec.rb +29 -16
- data/spec/packets/packet_item_spec.rb +2 -2
- data/spec/packets/packet_spec.rb +39 -6
- data/spec/packets/parsers/format_string_parser_spec.rb +0 -11
- data/spec/packets/parsers/macro_parser_spec.rb +36 -36
- data/spec/packets/parsers/state_parser_spec.rb +69 -11
- data/spec/packets/structure_spec.rb +93 -2
- data/spec/packets/telemetry_spec.rb +63 -10
- data/spec/script/extract_spec.rb +4 -1
- data/spec/script/script_spec.rb +2 -3
- data/spec/script/scripting_spec.rb +2 -1
- data/spec/script/tools_spec.rb +0 -1
- data/spec/streams/tcpip_socket_stream_spec.rb +32 -27
- data/spec/system/system_spec.rb +187 -4
- data/spec/system/target_spec.rb +62 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +29 -21
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +15 -7
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +33 -0
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +25 -1
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +15 -0
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +2 -3
- data/spec/top_level/top_level_spec.rb +29 -5
- data/spec/utilities/message_log_spec.rb +6 -3
- data/tasks/gemfile_stats.rake +38 -14
- data/test/performance/config/system/system.txt +0 -0
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_tlm.txt +5 -5
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/test/performance/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/test/performance/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/test/performance/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +1 -1
- data/test/performance/procedures/cosmos_api_test.rb +1 -1
- data/test/performance/tools/identify_performance.rb +82 -0
- metadata +154 -64
- data/lib/cosmos/dart/Gemfile +0 -69
@@ -36,7 +36,7 @@ module Cosmos
|
|
36
36
|
@list = Qt::ListWidget.new
|
37
37
|
@exception_list.each_with_index do |exception, index|
|
38
38
|
string = "#{index + 1}. #{exception.class} : #{exception.message}"
|
39
|
-
Qt::ListWidgetItem.new(
|
39
|
+
Qt::ListWidgetItem.new(string, @list)
|
40
40
|
end
|
41
41
|
layout.addWidget(@list)
|
42
42
|
@list.connect(SIGNAL('itemSelectionChanged ()')) do
|
@@ -103,9 +103,9 @@ module Cosmos
|
|
103
103
|
def create_input_layout
|
104
104
|
input_layout = Qt::FormLayout.new
|
105
105
|
@find_box = Qt::LineEdit.new
|
106
|
-
input_layout.addRow(
|
106
|
+
input_layout.addRow("Fi&nd what:", @find_box)
|
107
107
|
@replace_box = Qt::LineEdit.new
|
108
|
-
replace_label = Qt::Label.new(
|
108
|
+
replace_label = Qt::Label.new("Re&place with:")
|
109
109
|
replace_label.setBuddy(@replace_box)
|
110
110
|
@replace_items << replace_label
|
111
111
|
input_layout.addRow(replace_label, @replace_box)
|
@@ -141,7 +141,7 @@ module Cosmos
|
|
141
141
|
direction_layout.addWidget(@up)
|
142
142
|
direction_layout.addWidget(down)
|
143
143
|
direction_layout.addStretch
|
144
|
-
direction = Qt::GroupBox.new(
|
144
|
+
direction = Qt::GroupBox.new("Direction")
|
145
145
|
direction.setLayout(direction_layout)
|
146
146
|
direction
|
147
147
|
end
|
@@ -43,14 +43,14 @@ module Cosmos
|
|
43
43
|
top_layout = Qt::HBoxLayout.new
|
44
44
|
text_layout = Qt::VBoxLayout.new
|
45
45
|
|
46
|
-
title_label = Qt::Label.new(
|
46
|
+
title_label = Qt::Label.new(title)
|
47
47
|
text_layout.addWidget(title_label)
|
48
48
|
@read_raw_data_time = Qt::Label.new("Read Raw Data Time: ")
|
49
49
|
text_layout.addWidget(@read_raw_data_time)
|
50
50
|
top_layout.addLayout(text_layout)
|
51
51
|
top_layout.addStretch(1)
|
52
52
|
|
53
|
-
button = Qt::PushButton.new(
|
53
|
+
button = Qt::PushButton.new("Pause")
|
54
54
|
top_layout.addWidget(button)
|
55
55
|
button.connect(SIGNAL('clicked()')) do
|
56
56
|
if button.text == "Pause"
|
@@ -20,7 +20,7 @@ module Cosmos
|
|
20
20
|
# are written back into the packet.
|
21
21
|
class SetTlmDialog < Qt::Dialog
|
22
22
|
# @return [Array<String>] Items which should not be displayed in the dialog
|
23
|
-
IGNORED_ITEMS = ['RECEIVED_TIMESECONDS', 'RECEIVED_TIMEFORMATTED', 'RECEIVED_COUNT', 'PKTID', 'CONFIG']
|
23
|
+
IGNORED_ITEMS = ['PACKET_TIMESECONDS', 'PACKET_TIMEFORMATTED', 'RECEIVED_TIMESECONDS', 'RECEIVED_TIMEFORMATTED', 'RECEIVED_COUNT', 'PKTID', 'CONFIG']
|
24
24
|
|
25
25
|
# @return [String] Errors encountered when trying to set the values back
|
26
26
|
# into the packet
|
@@ -50,15 +50,15 @@ module Cosmos
|
|
50
50
|
setWindowTitle("#{@target_name} #{@packet_name} #{@item_name} Details")
|
51
51
|
|
52
52
|
layout = Qt::VBoxLayout.new
|
53
|
-
layout.addWidget(Qt::Label.new(
|
53
|
+
layout.addWidget(Qt::Label.new("#{target_name} #{packet_name} #{item_name}"))
|
54
54
|
|
55
55
|
# Display the item values
|
56
|
-
item_values = Qt::GroupBox.new(
|
56
|
+
item_values = Qt::GroupBox.new("Item Values")
|
57
57
|
|
58
58
|
values_layout = Qt::FormLayout.new
|
59
59
|
@raw_value = Qt::LineEdit.new
|
60
60
|
@raw_value.setReadOnly(true)
|
61
|
-
values_layout.addRow(
|
61
|
+
values_layout.addRow("Raw Value:", @raw_value)
|
62
62
|
@hex_raw_value = nil
|
63
63
|
@hex_raw_num_digits = 0
|
64
64
|
case item.data_type
|
@@ -67,21 +67,21 @@ module Cosmos
|
|
67
67
|
@hex_raw_value = Qt::LineEdit.new
|
68
68
|
@hex_raw_value.setReadOnly(true)
|
69
69
|
@hex_raw_num_digits = (((item.bit_size - 1) / 8) + 1) * 2
|
70
|
-
values_layout.addRow(
|
70
|
+
values_layout.addRow("Hex Raw Value:", @hex_raw_value)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
@converted_value = Qt::LineEdit.new
|
74
74
|
@converted_value.setReadOnly(true)
|
75
|
-
values_layout.addRow(
|
75
|
+
values_layout.addRow("Converted Value:", @converted_value)
|
76
76
|
@formatted_value = Qt::LineEdit.new
|
77
77
|
@formatted_value.setReadOnly(true)
|
78
|
-
values_layout.addRow(
|
78
|
+
values_layout.addRow("Formatted Value:", @formatted_value)
|
79
79
|
@formatted_with_units_value = Qt::LineEdit.new
|
80
80
|
@formatted_with_units_value.setReadOnly(true)
|
81
|
-
values_layout.addRow(
|
81
|
+
values_layout.addRow("Formatted with Units Value:", @formatted_with_units_value)
|
82
82
|
@limits_state = Qt::LineEdit.new
|
83
83
|
@limits_state.setReadOnly(true)
|
84
|
-
values_layout.addRow(
|
84
|
+
values_layout.addRow("Limits State:", @limits_state)
|
85
85
|
|
86
86
|
item_values.setLayout(values_layout)
|
87
87
|
layout.addWidget(item_values)
|
@@ -101,7 +101,7 @@ module Cosmos
|
|
101
101
|
end
|
102
102
|
|
103
103
|
# Display the item details
|
104
|
-
item_details = Qt::GroupBox.new(
|
104
|
+
item_details = Qt::GroupBox.new("Item Details")
|
105
105
|
item_details.setLayout(build_details_layout(item, :TLM))
|
106
106
|
layout.addWidget(item_details)
|
107
107
|
|
@@ -159,8 +159,9 @@ module Cosmos
|
|
159
159
|
elsif @limits_layout
|
160
160
|
label = Qt::Label.new(label_text)
|
161
161
|
@limits_labels[limits_set] = label
|
162
|
-
@limits_layout.addRow(
|
162
|
+
@limits_layout.addRow("#{limits_set}:", label)
|
163
163
|
end
|
164
|
+
update_limits_checking()
|
164
165
|
end
|
165
166
|
|
166
167
|
def determine_limits_color(limit_state)
|
@@ -28,7 +28,7 @@ module Cosmos
|
|
28
28
|
# @param target_name [String] Name of the target
|
29
29
|
# @param packet_name [String] Name of the packet
|
30
30
|
# @param item_name [String] Name of the item
|
31
|
-
def initialize(parent, target_name, packet_name, item_name)
|
31
|
+
def initialize(parent, target_name, packet_name, item_name, replay = false)
|
32
32
|
packet, item = System.telemetry.packet_and_item(target_name, packet_name, item_name)
|
33
33
|
|
34
34
|
num_array_elements = 0
|
@@ -101,7 +101,9 @@ module Cosmos
|
|
101
101
|
|
102
102
|
# Start grapher if necessary
|
103
103
|
if !item_string.empty?
|
104
|
-
|
104
|
+
options = "#{item_string} --system #{File.basename(System.initial_filename)}"
|
105
|
+
options += " --replay" if replay
|
106
|
+
Cosmos.run_cosmos_tool("TlmGrapher", options)
|
105
107
|
end
|
106
108
|
end
|
107
109
|
end
|
@@ -19,7 +19,7 @@ module Cosmos
|
|
19
19
|
# @param y (see TextureMappedSphere#initialize)
|
20
20
|
# @param z (see TextureMappedSphere#initialize)
|
21
21
|
def initialize(x, y, z)
|
22
|
-
super(x, y, z, File.join(::Cosmos::PATH, 'data', '
|
22
|
+
super(x, y, z, File.join(::Cosmos::PATH, 'data', 'Earthmap1024x512.gif'))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/cosmos/gui/qt.rb
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
# adding workarounds should they be needed to work through problems with
|
13
13
|
# interacting with QT from Ruby.
|
14
14
|
|
15
|
+
require 'stringio'
|
15
16
|
require 'cosmos'
|
16
17
|
check_filename = File.join(Cosmos::USERPATH, "#{File.basename($0, File.extname($0))}_qt_check.txt")
|
17
18
|
qt_in_system_folder = false
|
@@ -70,8 +71,16 @@ if Kernel.is_windows?
|
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
74
|
+
if Kernel.is_windows?
|
75
|
+
temp_stderr = $stderr.clone
|
76
|
+
$stderr.reopen(File.new('nul', 'w'))
|
77
|
+
end
|
73
78
|
# This will either lock up or raise an error if older Qt dlls are present in the Windows system folders
|
74
|
-
|
79
|
+
begin
|
80
|
+
require 'Qt'
|
81
|
+
ensure
|
82
|
+
$stderr.reopen(temp_stderr) if Kernel.is_windows?
|
83
|
+
end
|
75
84
|
File.delete(check_filename) if Kernel.is_windows? and File.exist?(check_filename)
|
76
85
|
|
77
86
|
module Cosmos
|
@@ -165,8 +174,10 @@ module Cosmos
|
|
165
174
|
FONTS[font_face][font_size][font_attrs] ||= {}
|
166
175
|
font = FONTS[font_face][font_size][font_attrs][font_italics]
|
167
176
|
unless font
|
168
|
-
if font_attrs
|
177
|
+
if font_attrs && font_italics
|
169
178
|
font = Qt::Font.new(font_face, font_size, font_attrs, font_italics)
|
179
|
+
elsif font_attrs
|
180
|
+
font = Qt::Font.new(font_face, font_size, font_attrs)
|
170
181
|
else
|
171
182
|
font = Qt::Font.new(font_face, font_size)
|
172
183
|
end
|
data/lib/cosmos/gui/qt_tool.rb
CHANGED
@@ -14,10 +14,12 @@ require 'cosmos/gui/dialogs/about_dialog'
|
|
14
14
|
require 'cosmos/gui/dialogs/exception_dialog'
|
15
15
|
require 'cosmos/gui/dialogs/pry_dialog'
|
16
16
|
require 'cosmos/gui/dialogs/scroll_text_dialog'
|
17
|
+
require 'cosmos/gui/utilities/classification_banner'
|
17
18
|
require 'ostruct'
|
18
19
|
require 'optparse'
|
19
20
|
|
20
21
|
module Cosmos
|
22
|
+
|
21
23
|
# Base class of all COSMOS GUI Tools based on QT. It creates the help menu
|
22
24
|
# which contains the About menu option. It provides configuration to all
|
23
25
|
# tools to remember both the application window location and size across
|
@@ -28,6 +30,8 @@ module Cosmos
|
|
28
30
|
|
29
31
|
@@redirect_io_thread = nil
|
30
32
|
|
33
|
+
include ClassificationBanner
|
34
|
+
|
31
35
|
# Create a new application. IO is redirected such that writing to stdout or
|
32
36
|
# stderr will result in a popup to be displayed to the user. Thus
|
33
37
|
# applications should not write to stdout (i.e. puts or write) or stderr
|
@@ -56,14 +60,28 @@ module Cosmos
|
|
56
60
|
@stylesheet = ''
|
57
61
|
@stylesheet = File.read(app_style) if File.exist? app_style
|
58
62
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
self.class.normalize_config_options(@options)
|
64
|
+
|
65
|
+
# Add a banner based on system configuration
|
66
|
+
add_classification_banner
|
67
|
+
end
|
68
|
+
|
69
|
+
# Normalizes config_dir, config_file, and stylesheet options
|
70
|
+
def self.normalize_config_options(options)
|
71
|
+
# Determine the tool name based on the class
|
72
|
+
tool_name = self.to_s.class_name_to_filename.split('.')[0] # remove .rb
|
73
|
+
options.config_dir = File.join(Cosmos::USERPATH, 'config', 'tools', tool_name) unless options.config_dir
|
74
|
+
tool_name = options.config_dir.split('/')[-1]
|
75
|
+
if File.exist?(options.config_dir)
|
76
|
+
options.config_file = config_path(options, options.config_file, ".txt", tool_name)
|
77
|
+
options.stylesheet = config_path(options, options.stylesheet, ".css", tool_name)
|
78
|
+
elsif options.config_file == true
|
79
|
+
# If the config_file is required and the config_dir doesn't exist then
|
80
|
+
# this is a core COSMOS configuration error so just raise an error
|
81
|
+
raise "ERROR! config_dir #{options.config_dir} does not exist. tool_name = #{tool_name}"
|
82
|
+
else
|
83
|
+
options.config_file = nil
|
84
|
+
options.stylesheet = nil
|
67
85
|
end
|
68
86
|
end
|
69
87
|
|
@@ -72,41 +90,51 @@ module Cosmos
|
|
72
90
|
# directory is prepended to the filename. If no file is given a default is
|
73
91
|
# generated based on the application name.
|
74
92
|
#
|
75
|
-
# @param filename [String] Path to a configuration file
|
93
|
+
# @param filename [String|Boolean|nil] Path to a configuration file which means
|
94
|
+
# the file must be found. true which means that a default configuration file
|
95
|
+
# is required and must be found. nil which means a default file is acceptable
|
96
|
+
# but not required.
|
76
97
|
# @param type [String] File extension, e.g. '.txt'
|
77
98
|
# @param tool_name [String] Name of the tool calling this method
|
78
|
-
# @return [String|nil] Path to
|
79
|
-
#
|
80
|
-
# is
|
81
|
-
def config_path(filename, type, tool_name)
|
82
|
-
|
83
|
-
if filename
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
99
|
+
# @return [String|nil] Path to an existing configuration file. nil is returned
|
100
|
+
# if filename is nil and the default is not found. An error is raised if
|
101
|
+
# filename is a string or true and it is not found.
|
102
|
+
def self.config_path(options, filename, type, tool_name)
|
103
|
+
# First check for an absolute path
|
104
|
+
return filename if filename && filename != true && File.exist?(filename)
|
105
|
+
# Build a default filename
|
106
|
+
default_filename = File.join(options.config_dir, "#{tool_name}#{type}")
|
107
|
+
if filename == true # The config file is required but not given
|
108
|
+
return default_filename if File.exist?(default_filename)
|
109
|
+
message = "\n\nDefault configuration file #{default_filename} not found.\n"\
|
110
|
+
"Either create this file or pass a configuration filename using the --config option.\n"
|
111
|
+
raise message
|
112
|
+
elsif filename # Filename was given so look for it in the config dir
|
113
|
+
new_filename = File.join(options.config_dir, filename)
|
90
114
|
return new_filename if File.exist?(new_filename)
|
115
|
+
# If a filename is passed in it is an error if it does not exist
|
116
|
+
raise "\n\nConfiguration file #{new_filename} not found.\n"
|
91
117
|
end
|
92
|
-
filename
|
118
|
+
# If filename is nil check for the default and return it
|
119
|
+
return default_filename if File.exist?(default_filename)
|
120
|
+
nil # return nil if filename is nil and the default is not found
|
93
121
|
end
|
94
122
|
|
95
123
|
# Create the exit_action and the about_action. The exit_action is not
|
96
124
|
# placed in the File menu and must be manually added by the user. The
|
97
125
|
# about_action is added to the Help menu by {#initialize_help_menu}.
|
98
126
|
def initialize_actions
|
99
|
-
@exit_action = Qt::Action.new(Cosmos.get_icon('close.png'),
|
100
|
-
@exit_keyseq = Qt::KeySequence.new(
|
127
|
+
@exit_action = Qt::Action.new(Cosmos.get_icon('close.png'), 'E&xit', self)
|
128
|
+
@exit_keyseq = Qt::KeySequence.new('Ctrl+Q')
|
101
129
|
@exit_action.shortcut = @exit_keyseq
|
102
|
-
@exit_action.statusTip =
|
130
|
+
@exit_action.statusTip = 'Exit the application'
|
103
131
|
connect(@exit_action, SIGNAL('triggered()'), self, SLOT('close()'))
|
104
132
|
|
105
|
-
@about_action = Qt::Action.new(Cosmos.get_icon('help.png'),
|
106
|
-
@about_action.statusTip =
|
133
|
+
@about_action = Qt::Action.new(Cosmos.get_icon('help.png'), '&About', self)
|
134
|
+
@about_action.statusTip = 'About the application'
|
107
135
|
connect(@about_action, SIGNAL('triggered()'), self, SLOT('about()'))
|
108
|
-
@documentation_action = Qt::Action.new(
|
109
|
-
@documentation_action.statusTip =
|
136
|
+
@documentation_action = Qt::Action.new('&Documentation', self)
|
137
|
+
@documentation_action.statusTip = 'COSMOS Online Documentation'
|
110
138
|
self.connect(@documentation_action, SIGNAL('triggered()')) do
|
111
139
|
Qt::DesktopServices.openUrl(Qt::Url.new("http://cosmosrb.com"))
|
112
140
|
end
|
@@ -130,7 +158,7 @@ module Cosmos
|
|
130
158
|
default_dirs = [default_dirs] unless default_dirs.is_a? Array
|
131
159
|
default_dirs.each do |default_dir|
|
132
160
|
default_context = default_dir.split('/')[-2..-1].join('/')
|
133
|
-
action = Qt::Action.new(
|
161
|
+
action = Qt::Action.new(default_context, self)
|
134
162
|
action.statusTip = status_tip if status_tip
|
135
163
|
action.connect(SIGNAL('triggered()')) { callback.call(default_dir) }
|
136
164
|
menu.addAction(action)
|
@@ -149,7 +177,7 @@ module Cosmos
|
|
149
177
|
else
|
150
178
|
name = "#{target_name}/#{target_sub_dir}"
|
151
179
|
end
|
152
|
-
action = Qt::Action.new(
|
180
|
+
action = Qt::Action.new(name, self)
|
153
181
|
action.statusTip = status_tip if status_tip
|
154
182
|
action.connect(SIGNAL('triggered()')) { callback.call(dir) }
|
155
183
|
menu.addAction(action)
|
@@ -160,7 +188,7 @@ module Cosmos
|
|
160
188
|
# Creates the Help menu and adds the about_action to it. Thus this MUST be
|
161
189
|
# called after initialize_actions.
|
162
190
|
def initialize_help_menu
|
163
|
-
@help_menu = menuBar().addMenu(
|
191
|
+
@help_menu = menuBar().addMenu('&Help')
|
164
192
|
@help_menu.addAction(@about_action)
|
165
193
|
@help_menu.addAction(@documentation_action)
|
166
194
|
end
|
@@ -181,28 +209,26 @@ module Cosmos
|
|
181
209
|
|
182
210
|
# Handle manually positioning the window
|
183
211
|
unless @options.auto_position
|
184
|
-
# Get the desktop's geometry
|
185
|
-
desktop = Qt::Application.desktop
|
186
|
-
|
187
|
-
# Handle position relative to right edge
|
188
|
-
@options.x = desktop.width - frameGeometry().width + @options.x + 1 if @options.x < 0
|
189
|
-
|
190
|
-
# Handle position relative to bottom edge
|
191
|
-
@options.y = desktop.height - frameGeometry().height + @options.y + 1 if @options.y < 0
|
192
|
-
|
193
212
|
# Move to the desired position
|
194
213
|
move(@options.x, @options.y)
|
195
214
|
end
|
196
215
|
|
197
216
|
if @options.remember_geometry and !@options.command_line_geometry
|
217
|
+
# Get the desktop's geometry
|
218
|
+
desktop = Qt::Application.desktop
|
219
|
+
screen = desktop.screen
|
198
220
|
settings = Qt::Settings.new('Ball Aerospace', self.class.to_s)
|
199
221
|
if settings.contains('size') and @options.restore_size and @options.startup_state != :DEFAULT
|
200
222
|
size = settings.value('size').toSize
|
201
|
-
|
223
|
+
if size.height > 0 and size.height < screen.height and size.width > 0 and size.width < screen.width
|
224
|
+
resize(size)
|
225
|
+
end
|
202
226
|
end
|
203
227
|
if settings.contains('position') and @options.restore_position
|
204
228
|
position = settings.value('position').toPoint
|
205
|
-
|
229
|
+
if position.x > 0 and position.y > 0 and position.x < screen.width and position.y < screen.height
|
230
|
+
move(position)
|
231
|
+
end
|
206
232
|
end
|
207
233
|
end
|
208
234
|
|
@@ -326,6 +352,8 @@ module Cosmos
|
|
326
352
|
options.restore_size = true
|
327
353
|
options.redirect_io = true
|
328
354
|
options.title = "COSMOS Tool"
|
355
|
+
options.config_file = nil
|
356
|
+
options.stylesheet = nil
|
329
357
|
|
330
358
|
parser = OptionParser.new do |option_parser|
|
331
359
|
option_parser.banner = "Usage: ruby #{option_parser.program_name} [options]"
|
@@ -24,6 +24,7 @@ module Cosmos
|
|
24
24
|
signals 'breakpoint_set(int)'
|
25
25
|
signals 'breakpoint_cleared(int)'
|
26
26
|
signals 'breakpoints_cleared()'
|
27
|
+
signals 'font_changed(const QFont &)'
|
27
28
|
|
28
29
|
attr_accessor :enable_breakpoints
|
29
30
|
attr_accessor :filename
|
@@ -75,67 +76,63 @@ module Cosmos
|
|
75
76
|
|
76
77
|
RULES = []
|
77
78
|
RUBY_KEYWORDS.each do |w|
|
78
|
-
RULES << ['\b'+w+'\b',
|
79
|
+
RULES << ['\b'+w+'\b', STYLES['ruby_keyword']]
|
79
80
|
end
|
80
81
|
Script.private_instance_methods.each do |w|
|
81
|
-
RULES << ['\b'+w.to_s+'\b',
|
82
|
+
RULES << ['\b'+w.to_s+'\b', STYLES['cosmos_keyword']]
|
82
83
|
end
|
83
84
|
BRACES.each do |b|
|
84
|
-
RULES << ["#{b}",
|
85
|
+
RULES << ["#{b}", STYLES['brace']]
|
85
86
|
end
|
86
87
|
RULES.concat([
|
87
88
|
# 'def' followed by an identifier
|
88
|
-
['\bdef\b\s*(\w+)',
|
89
|
+
['\bdef\b\s*(\w+)', STYLES['method']],
|
89
90
|
# 'class' followed by an identifier
|
90
|
-
['\bclass\b\s*(\w+)',
|
91
|
+
['\bclass\b\s*(\w+)', STYLES['class']],
|
91
92
|
# Ruby symbol
|
92
|
-
[':\b\w+',
|
93
|
+
[':\b\w+', STYLES['symbol']],
|
93
94
|
# Ruby namespace operator
|
94
|
-
['\b\w+(::\b\w+)+',
|
95
|
+
['\b\w+(::\b\w+)+', STYLES['class']],
|
95
96
|
# Ruby global
|
96
|
-
['\\$\b\w+',
|
97
|
+
['\\$\b\w+', STYLES['string']],
|
97
98
|
# Regex, possibly containing escape sequences
|
98
|
-
["/.*/",
|
99
|
+
["/.*/", STYLES['string']],
|
99
100
|
# Double-quoted string, possibly containing escape sequences
|
100
|
-
['"([^"\\\\]|\\\\.)*"',
|
101
|
+
['"(?:[^"\\\\]|\\\\.)*"', STYLES['string']],
|
101
102
|
# Match interpolated strings "blah #{code} blah"
|
102
|
-
|
103
|
-
|
104
|
-
['\#\\{
|
103
|
+
# This comes before single-quote and back-tick because
|
104
|
+
# those strings should not interpolate variables
|
105
|
+
['(\#\\{)[^\\}]*\\}', STYLES['brace']],
|
106
|
+
['\#\\{[^\\}]*(\\})', STYLES['brace']],
|
107
|
+
['\#\\{([^\\}]*)\\}', STYLES['normal']],
|
105
108
|
# Single-quoted string, possibly containing escape sequences
|
106
|
-
["'[^'\\\\]*(
|
109
|
+
["'[^'\\\\]*(?:\\.[^'\\\\]*)*'", STYLES['string']],
|
107
110
|
# Back-tick string, possibly containing escape sequences
|
108
|
-
["`[^`\\\\]*(\\.[^`\\\\]*)*`",
|
109
|
-
#
|
110
|
-
|
111
|
+
["`[^`\\\\]*(\\.[^`\\\\]*)*`", STYLES['string']],
|
112
|
+
# Double quoted string | single quoted string | comment
|
113
|
+
# We don't want the first two but we want the last
|
114
|
+
["\"[^\"]*\"|\'[^\']*\'|(#.*)", STYLES['comment']],
|
111
115
|
])
|
112
116
|
|
113
|
-
# Build a
|
117
|
+
# Build a RegExp for each pattern
|
114
118
|
RULES_INFO = []
|
115
|
-
RULES.each do |pat,
|
116
|
-
RULES_INFO << [
|
119
|
+
RULES.each do |pat, fmt|
|
120
|
+
RULES_INFO << [Regexp.new(pat), fmt]
|
117
121
|
end
|
118
122
|
|
119
123
|
def highlightBlock(text)
|
120
124
|
# Do other syntax formatting
|
121
|
-
RULES_INFO.each do |expression,
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
#
|
127
|
-
index =
|
128
|
-
|
129
|
-
# we
|
130
|
-
|
131
|
-
|
132
|
-
break if length <= 0
|
133
|
-
# Break if we're in an endless loop
|
134
|
-
break if (last_index == index and last_length == length)
|
135
|
-
last_length = length
|
136
|
-
last_index = index
|
137
|
-
self.setFormat(index, length, format)
|
138
|
-
index = expression.indexIn(text, index + length)
|
125
|
+
RULES_INFO.each do |expression, format|
|
126
|
+
match = text.scan(expression).flatten.compact
|
127
|
+
next unless match && !match.empty?
|
128
|
+
i = 0 # initial string match offset
|
129
|
+
match.each do |part|
|
130
|
+
# Index the match part starting at the offset
|
131
|
+
index = text.index(part, i)
|
132
|
+
self.setFormat(index, part.length, format)
|
133
|
+
# Increment the index so we can match the same string
|
134
|
+
# in two different locations in the text, e.g. "#{x} #{y}"
|
135
|
+
i = index + part.length
|
139
136
|
end
|
140
137
|
end
|
141
138
|
end
|
@@ -156,10 +153,10 @@ module Cosmos
|
|
156
153
|
CHAR_57 = Qt::Char.new(57)
|
157
154
|
BREAKPOINT_SET = 1
|
158
155
|
BREAKPOINT_CLEAR = -1
|
156
|
+
MINIMUM_POINT_SIZE = 4
|
159
157
|
|
160
|
-
def initialize(parent)
|
158
|
+
def initialize(parent, font = Cosmos.get_default_font)
|
161
159
|
super(parent)
|
162
|
-
font = Cosmos.get_default_font
|
163
160
|
setFont(font)
|
164
161
|
@fontMetrics = Cosmos.getFontMetrics(font)
|
165
162
|
|
@@ -180,6 +177,18 @@ module Cosmos
|
|
180
177
|
line_count_changed(-1)
|
181
178
|
end
|
182
179
|
|
180
|
+
def wheelEvent(event)
|
181
|
+
if event.modifiers() == Qt::ControlModifier && event.delta > 0
|
182
|
+
event.setAccepted(true)
|
183
|
+
zoom_in()
|
184
|
+
elsif event.modifiers() == Qt::ControlModifier && event.delta < 0
|
185
|
+
event.setAccepted(true)
|
186
|
+
zoom_out()
|
187
|
+
else
|
188
|
+
super(event)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
183
192
|
def dispose
|
184
193
|
super()
|
185
194
|
@syntax.dispose
|
@@ -288,6 +297,31 @@ module Cosmos
|
|
288
297
|
cursor.endEditBlock
|
289
298
|
end
|
290
299
|
|
300
|
+
def zoom_in
|
301
|
+
font = Cosmos.getFont(font().family, font().pointSize + 1)
|
302
|
+
setFont(font)
|
303
|
+
@fontMetrics = Cosmos.getFontMetrics(font)
|
304
|
+
emit font_changed(font)
|
305
|
+
end
|
306
|
+
|
307
|
+
def zoom_out
|
308
|
+
return if font().pointSize <= MINIMUM_POINT_SIZE
|
309
|
+
font = Cosmos.getFont(font().family, font().pointSize - 1)
|
310
|
+
setFont(font)
|
311
|
+
@fontMetrics = Cosmos.getFontMetrics(font)
|
312
|
+
emit font_changed(font)
|
313
|
+
end
|
314
|
+
|
315
|
+
def zoom_default
|
316
|
+
font = Cosmos.get_default_font
|
317
|
+
setFont(font)
|
318
|
+
@fontMetrics = Cosmos.getFontMetrics(font)
|
319
|
+
# Force a repaint of the number area by doing a small scroll
|
320
|
+
verticalScrollBar.setValue(verticalScrollBar.minimum+1)
|
321
|
+
verticalScrollBar.setValue(verticalScrollBar.minimum)
|
322
|
+
emit font_changed(font)
|
323
|
+
end
|
324
|
+
|
291
325
|
def resizeEvent(e)
|
292
326
|
super(e)
|
293
327
|
cr = self.contentsRect()
|
@@ -302,6 +336,7 @@ module Cosmos
|
|
302
336
|
|
303
337
|
def line_number_area_paint_event(event)
|
304
338
|
painter = Qt::Painter.new(@lineNumberArea)
|
339
|
+
painter.setFont(font())
|
305
340
|
# Check for weird bad initialization conditions
|
306
341
|
if painter.isActive and not painter.paintEngine.nil?
|
307
342
|
event_rect = event.rect()
|
@@ -397,14 +432,21 @@ module Cosmos
|
|
397
432
|
end
|
398
433
|
|
399
434
|
def line_at_point(point)
|
400
|
-
|
401
|
-
|
402
|
-
|
435
|
+
block_num = firstVisibleBlock().blockNumber()
|
436
|
+
while block_num < document.blockCount()
|
437
|
+
block = document.findBlockByNumber(block_num)
|
438
|
+
top, bottom = block_top_and_bottom(block)
|
439
|
+
if (top..bottom).include?(point.y)
|
440
|
+
yield block_num + 1
|
441
|
+
break
|
442
|
+
end
|
443
|
+
block_num += 1
|
444
|
+
end
|
403
445
|
end
|
404
446
|
|
405
447
|
def create_add_breakpoint_action(point)
|
406
|
-
action = Qt::Action.new(
|
407
|
-
action.statusTip =
|
448
|
+
action = Qt::Action.new("Add Breakpoint", self)
|
449
|
+
action.statusTip = "Add a breakpoint at this line"
|
408
450
|
action.connect(SIGNAL('triggered()')) do
|
409
451
|
line_at_point(point) do |line|
|
410
452
|
add_breakpoint(line)
|
@@ -415,8 +457,8 @@ module Cosmos
|
|
415
457
|
end
|
416
458
|
|
417
459
|
def create_clear_breakpoint_action(point)
|
418
|
-
action = Qt::Action.new(
|
419
|
-
action.statusTip =
|
460
|
+
action = Qt::Action.new("Clear Breakpoint", self)
|
461
|
+
action.statusTip = "Clear an existing breakpoint at this line"
|
420
462
|
action.connect(SIGNAL('triggered()')) do
|
421
463
|
line_at_point(point) do |line|
|
422
464
|
clear_breakpoint(line)
|
@@ -427,8 +469,8 @@ module Cosmos
|
|
427
469
|
end
|
428
470
|
|
429
471
|
def create_clear_all_breakpoints_action
|
430
|
-
action = Qt::Action.new(
|
431
|
-
action.statusTip =
|
472
|
+
action = Qt::Action.new("Clear All Breakpoints", self)
|
473
|
+
action.statusTip = "Clear all existing breakpoints"
|
432
474
|
action.connect(SIGNAL('triggered()')) do
|
433
475
|
clear_breakpoints
|
434
476
|
emit breakpoints_cleared
|