cosmos 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +48 -48
- data/.travis.yml +7 -7
- data/CONTRIBUTING.txt +50 -50
- data/Gemfile +6 -6
- data/Guardfile +27 -27
- data/LICENSE.txt +879 -879
- data/Manifest.txt +1116 -1114
- data/README.md +109 -107
- data/Rakefile +214 -214
- data/autohotkey/config/data/diamond.STL +57 -57
- data/autohotkey/config/system/system.txt +34 -34
- data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/autohotkey/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/autohotkey/config/targets/COSMOS/target.txt +5 -5
- data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +121 -121
- data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +247 -247
- data/autohotkey/config/targets/INST/cmd_tlm_server.txt +5 -5
- data/autohotkey/config/targets/INST/lib/example_limits_response.rb +30 -30
- data/autohotkey/config/targets/INST/lib/sim_inst.rb +305 -294
- data/autohotkey/config/targets/INST/screens/adcs.txt +46 -46
- data/autohotkey/config/targets/INST/screens/array.txt +7 -7
- data/autohotkey/config/targets/INST/screens/block.txt +8 -8
- data/autohotkey/config/targets/INST/screens/commanding.txt +30 -30
- data/autohotkey/config/targets/INST/screens/graphs.txt +14 -14
- data/autohotkey/config/targets/INST/screens/ground.txt +25 -25
- data/autohotkey/config/targets/INST/screens/health_status.txt +33 -33
- data/autohotkey/config/targets/INST/screens/hs.txt +49 -49
- data/autohotkey/config/targets/INST/screens/image.txt +21 -21
- data/autohotkey/config/targets/INST/screens/latest.txt +23 -23
- data/autohotkey/config/targets/INST/screens/mech.txt +25 -25
- data/autohotkey/config/targets/INST/screens/other.txt +25 -25
- data/autohotkey/config/targets/INST/screens/params.txt +25 -25
- data/autohotkey/config/targets/INST/screens/tabs.txt +68 -68
- data/autohotkey/config/targets/INST/target.txt +26 -26
- data/autohotkey/config/targets/META/cmd_tlm/meta_cmd.txt +10 -10
- data/autohotkey/config/targets/META/cmd_tlm/meta_tlm.txt +9 -9
- data/autohotkey/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
- data/autohotkey/config/targets/SYSTEM/screens/error.txt +11 -11
- data/autohotkey/config/tools/cmd_tlm_server/cmd_tlm_server.txt +22 -22
- data/autohotkey/config/tools/data_viewer/data_viewer.txt +11 -11
- data/autohotkey/config/tools/handbook_creator/handbook_creator.txt +49 -49
- data/autohotkey/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/autohotkey/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/autohotkey/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/autohotkey/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/autohotkey/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/autohotkey/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/autohotkey/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/autohotkey/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/autohotkey/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/autohotkey/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/autohotkey/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/autohotkey/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/autohotkey/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/autohotkey/config/tools/launcher/launcher.txt +38 -38
- data/autohotkey/config/tools/script_runner/script_runner.txt +3 -3
- data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +8 -8
- data/autohotkey/config/tools/table_manager/OneDimensionalTable_def.txt +19 -19
- data/autohotkey/config/tools/table_manager/TwoDimensionalTable_def.txt +248 -248
- data/autohotkey/config/tools/test_runner/test_runner.txt +8 -8
- data/autohotkey/config/tools/test_runner/test_runner2.txt +11 -11
- data/autohotkey/config/tools/test_runner/test_runner3.txt +6 -6
- data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -1
- data/autohotkey/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
- data/autohotkey/config/tools/tlm_extractor/tlm_extractor2.txt +9 -9
- data/autohotkey/config/tools/tlm_grapher/bad.txt +50 -50
- data/autohotkey/config/tools/tlm_grapher/temp1-4.txt +51 -51
- data/autohotkey/config/tools/tlm_grapher/test2.txt +111 -111
- data/autohotkey/config/tools/tlm_viewer/tlm_viewer.txt +24 -24
- data/autohotkey/config/tools/tlm_viewer/tlm_viewer2.txt +4 -4
- data/autohotkey/config/tools/tlm_viewer/tlm_viewer3.txt +3 -3
- data/autohotkey/lib/example_background_task.rb +42 -42
- data/autohotkey/lib/user_version.rb +3 -3
- data/autohotkey/procedures/clear_util.rb +7 -7
- data/autohotkey/procedures/collect.rb +18 -18
- data/autohotkey/procedures/collect_util.rb +14 -14
- data/autohotkey/procedures/example_test.rb +67 -67
- data/autohotkey/procedures/example_test2.rb +74 -74
- data/autohotkey/procedures/script_test.rb +17 -17
- data/autohotkey/procedures/syntax_error.rb +18 -18
- data/autohotkey/tools/CmdExtractorAHK +16 -16
- data/autohotkey/tools/CmdSender +14 -14
- data/autohotkey/tools/CmdSenderAHK +18 -18
- data/autohotkey/tools/CmdTlmServer +14 -14
- data/autohotkey/tools/CmdTlmServerAHK +28 -28
- data/autohotkey/tools/CmdTlmServerAHK2 +17 -17
- data/autohotkey/tools/DataViewer +14 -14
- data/autohotkey/tools/DataViewerAHK +17 -17
- data/autohotkey/tools/HandbookCreatorAHK +20 -20
- data/autohotkey/tools/LauncherAHK +17 -17
- data/autohotkey/tools/LimitsMonitorAHK +20 -20
- data/autohotkey/tools/OpenGLBuilderAHK +20 -20
- data/autohotkey/tools/PacketViewer +14 -14
- data/autohotkey/tools/PacketViewerAHK +18 -18
- data/autohotkey/tools/PacketViewerAHK2 +17 -17
- data/autohotkey/tools/Replay +14 -14
- data/autohotkey/tools/Replay.bat +59 -59
- data/autohotkey/tools/ReplayAHK +17 -17
- data/autohotkey/tools/ScriptRunner +14 -14
- data/autohotkey/tools/ScriptRunnerAHK +20 -20
- data/autohotkey/tools/ScriptRunnerAHK2 +17 -17
- data/autohotkey/tools/TableManager +14 -14
- data/autohotkey/tools/TableManagerAHK +30 -30
- data/autohotkey/tools/TestRunner +15 -15
- data/autohotkey/tools/TestRunnerAHK +17 -17
- data/autohotkey/tools/TestRunnerAHK2 +17 -17
- data/autohotkey/tools/TestRunnerAHK3 +17 -17
- data/autohotkey/tools/TestRunnerAHK4 +17 -17
- data/autohotkey/tools/TlmExtractor +15 -15
- data/autohotkey/tools/TlmExtractorAHK +19 -19
- data/autohotkey/tools/TlmExtractorAHK2 +16 -16
- data/autohotkey/tools/TlmExtractorAHK3 +16 -16
- data/autohotkey/tools/TlmGrapher +14 -14
- data/autohotkey/tools/TlmGrapherAHK +19 -19
- data/autohotkey/tools/TlmGrapherAHK2 +23 -23
- data/autohotkey/tools/TlmGrapherAHK3 +17 -17
- data/autohotkey/tools/TlmGrapherAHK4 +17 -17
- data/autohotkey/tools/TlmViewer +14 -14
- data/autohotkey/tools/TlmViewerAHK +28 -28
- data/autohotkey/tools/TlmViewerAHK2 +18 -18
- data/autohotkey/tools/TlmViewerAHK3 +18 -18
- data/autohotkey/tools/TlmViewerAHK4 +18 -18
- data/autohotkey/tools/TlmViewerAHK5 +18 -18
- data/autohotkey/tools/autohotkey.rb +37 -37
- data/autohotkey/tools/cmd_extractor.ahk +27 -27
- data/autohotkey/tools/cmd_sender.ahk +182 -162
- data/autohotkey/tools/cmd_tlm_server.ahk +89 -89
- data/autohotkey/tools/cmd_tlm_server2.ahk +45 -45
- data/autohotkey/tools/data_viewer.ahk +135 -135
- data/autohotkey/tools/handbook_creator.ahk +23 -23
- data/autohotkey/tools/launcher.ahk +41 -41
- data/autohotkey/tools/limits_monitor.ahk +70 -70
- data/autohotkey/tools/open_gl_builder.ahk +134 -134
- data/autohotkey/tools/packet_viewer.ahk +143 -143
- data/autohotkey/tools/packet_viewer2.ahk +9 -9
- data/autohotkey/tools/replay.ahk +98 -98
- data/autohotkey/tools/script_runner.ahk +589 -589
- data/autohotkey/tools/script_runner2.ahk +34 -31
- data/autohotkey/tools/table_manager.ahk +220 -220
- data/autohotkey/tools/test_runner.ahk +262 -259
- data/autohotkey/tools/test_runner2.ahk +52 -52
- data/autohotkey/tools/test_runner3.ahk +13 -13
- data/autohotkey/tools/tlm_extractor.ahk +272 -272
- data/autohotkey/tools/tlm_grapher.ahk +642 -642
- data/autohotkey/tools/tlm_grapher2.ahk +115 -115
- data/autohotkey/tools/tlm_grapher3.ahk +24 -24
- data/autohotkey/tools/tlm_viewer.ahk +133 -133
- data/autohotkey/tools/tlm_viewer2.ahk +50 -49
- data/autohotkey/tools/tlm_viewer4.ahk +4 -4
- data/autohotkey/tools/tlm_viewer5.ahk +20 -20
- data/bin/cosmos +96 -96
- data/bin/cstol_converter +1166 -1166
- data/bin/rubysloc +85 -85
- data/cosmos.gemspec +98 -97
- data/data/about.txt +4 -4
- data/data/crc.txt +306 -305
- data/data/diamond.STL +57 -57
- data/data/legal.txt +9 -9
- data/demo/Gemfile +6 -6
- data/demo/Launcher +15 -15
- data/demo/Launcher.bat +59 -59
- data/demo/Rakefile +61 -61
- data/demo/config/data/crc.txt +222 -206
- data/demo/config/data/diamond.STL +57 -57
- data/demo/config/data/meta_init.txt +4 -4
- data/demo/config/system/system.txt +34 -34
- data/demo/config/system/system2.txt +33 -33
- data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/demo/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/demo/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/demo/config/targets/COSMOS/screens/version.txt +19 -19
- data/demo/config/targets/COSMOS/target.txt +11 -11
- data/demo/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -2
- data/demo/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +3 -3
- data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -6
- data/demo/config/targets/EXAMPLE/lib/example_interface.rb +22 -22
- data/demo/config/targets/EXAMPLE/target.txt +6 -6
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +121 -121
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +247 -247
- data/demo/config/targets/INST/cmd_tlm_server.txt +5 -5
- data/demo/config/targets/INST/lib/example_limits_response.rb +30 -30
- data/demo/config/targets/INST/lib/sim_inst.rb +305 -294
- data/demo/config/targets/INST/screens/adcs.txt +46 -46
- data/demo/config/targets/INST/screens/array.txt +15 -15
- data/demo/config/targets/INST/screens/block.txt +8 -8
- data/demo/config/targets/INST/screens/commanding.txt +30 -30
- data/demo/config/targets/INST/screens/graphs.txt +14 -14
- data/demo/config/targets/INST/screens/ground.txt +25 -25
- data/demo/config/targets/INST/screens/hs.txt +44 -44
- data/demo/config/targets/INST/screens/latest.txt +23 -23
- data/demo/config/targets/INST/screens/other.txt +29 -29
- data/demo/config/targets/INST/screens/tabs.txt +70 -70
- data/demo/config/targets/INST/target.txt +33 -33
- data/demo/config/targets/META/cmd_tlm/meta_cmd.txt +10 -10
- data/demo/config/targets/META/cmd_tlm/meta_tlm.txt +13 -13
- data/demo/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
- data/demo/config/targets/SYSTEM/cmd_tlm/override.txt +29 -29
- data/demo/config/targets/SYSTEM/screens/status.txt +12 -12
- data/demo/config/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -12
- data/demo/config/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -3
- data/demo/config/targets/TEMPLATED/cmd_tlm_server.txt +6 -6
- data/demo/config/targets/TEMPLATED/lib/templated_interface.rb +54 -48
- data/demo/config/targets/TEMPLATED/target.txt +6 -6
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +33 -33
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +29 -29
- data/demo/config/tools/data_viewer/data_viewer.txt +11 -11
- data/demo/config/tools/handbook_creator/handbook_creator.txt +66 -66
- data/demo/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/demo/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/demo/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/demo/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/demo/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/demo/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/demo/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/demo/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/demo/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/demo/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/demo/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/demo/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/demo/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/demo/config/tools/launcher/launcher.txt +45 -45
- data/demo/config/tools/launcher/launcher2.txt +45 -45
- data/demo/config/tools/script_runner/script_runner.txt +3 -3
- data/demo/config/tools/table_manager/ConfigTables_def.txt +8 -8
- data/demo/config/tools/table_manager/ExampleTableDefinition.txt +24 -24
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -25
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -25
- data/demo/config/tools/table_manager/PPSSelectionTable_def.txt +8 -8
- data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -248
- data/demo/config/tools/test_runner/test_runner.txt +17 -17
- data/demo/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
- data/demo/config/tools/tlm_extractor/tlm_extractor2.txt +2 -2
- data/demo/config/tools/tlm_extractor/tlm_extractor3.txt +2 -2
- data/demo/config/tools/tlm_extractor/tlm_extractor4.txt +2 -2
- data/demo/config/tools/tlm_viewer/tlm_viewer.txt +41 -41
- data/demo/lib/example_background_task.rb +57 -52
- data/demo/lib/example_target.rb +113 -108
- data/demo/lib/scpi_target.rb +74 -74
- data/demo/lib/user_version.rb +3 -3
- data/demo/procedures/checks.rb +11 -11
- data/demo/procedures/clear_util.rb +7 -7
- data/demo/procedures/collect.rb +18 -18
- data/demo/procedures/collect_util.rb +14 -14
- data/demo/procedures/cosmos_api_test.rb +293 -293
- data/demo/procedures/disconnect.rb +29 -29
- data/demo/procedures/example_test.rb +182 -182
- data/demo/procedures/plot_test.rb +8 -8
- data/demo/procedures/run_example_test.rb +3 -3
- data/demo/procedures/test.rb +51 -51
- data/demo/tools/CmdExtractor +15 -15
- data/demo/tools/CmdExtractor.bat +59 -59
- data/demo/tools/CmdSender +15 -15
- data/demo/tools/CmdSender.bat +59 -59
- data/demo/tools/CmdTlmServer +15 -15
- data/demo/tools/CmdTlmServer.bat +59 -59
- data/demo/tools/DataViewer +15 -15
- data/demo/tools/DataViewer.bat +59 -59
- data/demo/tools/ExampleTarget +15 -15
- data/demo/tools/ExampleTarget.bat +59 -59
- data/demo/tools/HandbookCreator +15 -15
- data/demo/tools/HandbookCreator.bat +61 -61
- data/demo/tools/Launcher +15 -15
- data/demo/tools/Launcher.bat +59 -59
- data/demo/tools/LimitsMonitor +15 -15
- data/demo/tools/LimitsMonitor.bat +59 -59
- data/demo/tools/OpenGLBuilder +15 -15
- data/demo/tools/OpenGLBuilder.bat +59 -59
- data/demo/tools/PacketViewer +15 -15
- data/demo/tools/PacketViewer.bat +59 -59
- data/demo/tools/Replay +15 -15
- data/demo/tools/Replay.bat +59 -59
- data/demo/tools/ScpiTarget +15 -15
- data/demo/tools/ScpiTarget.bat +59 -59
- data/demo/tools/ScriptRunner +15 -15
- data/demo/tools/ScriptRunner.bat +59 -59
- data/demo/tools/TableManager +15 -15
- data/demo/tools/TableManager.bat +59 -59
- data/demo/tools/TestRunner +15 -15
- data/demo/tools/TestRunner.bat +59 -59
- data/demo/tools/TlmExtractor +15 -15
- data/demo/tools/TlmExtractor.bat +59 -59
- data/demo/tools/TlmGrapher +15 -15
- data/demo/tools/TlmGrapher.bat +59 -59
- data/demo/tools/TlmViewer +15 -15
- data/demo/tools/TlmViewer.bat +59 -59
- data/demo/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
- data/demo/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
- data/demo/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
- data/demo/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
- data/ext/cosmos/ext/array/array.c +111 -111
- data/ext/cosmos/ext/array/extconf.rb +13 -13
- data/ext/cosmos/ext/buffered_file/buffered_file.c +167 -167
- data/ext/cosmos/ext/buffered_file/extconf.rb +13 -13
- data/ext/cosmos/ext/config_parser/config_parser.c +237 -237
- data/ext/cosmos/ext/config_parser/extconf.rb +13 -13
- data/ext/cosmos/ext/cosmos_io/cosmos_io.c +117 -117
- data/ext/cosmos/ext/cosmos_io/extconf.rb +13 -13
- data/ext/cosmos/ext/crc/crc.c +341 -341
- data/ext/cosmos/ext/crc/extconf.rb +12 -12
- data/ext/cosmos/ext/line_graph/extconf.rb +13 -13
- data/ext/cosmos/ext/line_graph/line_graph.c +501 -501
- data/ext/cosmos/ext/low_fragmentation_array/extconf.rb +12 -12
- data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +261 -261
- data/ext/cosmos/ext/packet/extconf.rb +13 -13
- data/ext/cosmos/ext/packet/packet.c +339 -339
- data/ext/cosmos/ext/platform/extconf.rb +13 -13
- data/ext/cosmos/ext/platform/platform.c +81 -81
- data/ext/cosmos/ext/polynomial_conversion/extconf.rb +13 -13
- data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +73 -73
- data/ext/cosmos/ext/string/extconf.rb +13 -13
- data/ext/cosmos/ext/string/string.c +49 -49
- data/ext/cosmos/ext/structure/structure.c +894 -894
- data/ext/cosmos/ext/tabbed_plots_config/extconf.rb +13 -13
- data/ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c +51 -51
- data/ext/cosmos/ext/telemetry/extconf.rb +13 -13
- data/ext/cosmos/ext/telemetry/telemetry.c +306 -306
- data/ext/mkrf_conf.rb +40 -40
- data/install/Gemfile +6 -6
- data/install/Launcher +14 -14
- data/install/Launcher.bat +59 -59
- data/install/Rakefile +61 -61
- data/install/config/data/crc.txt +134 -133
- data/install/config/system/system.txt +29 -29
- data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/install/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/install/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/install/config/targets/COSMOS/screens/version.txt +19 -19
- data/install/config/targets/COSMOS/target.txt +8 -8
- data/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +2 -2
- data/install/config/tools/data_viewer/data_viewer.txt +3 -3
- data/install/config/tools/handbook_creator/handbook_creator.txt +49 -49
- data/install/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/install/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/install/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/install/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/install/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/install/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/install/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/install/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/install/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/install/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/install/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/install/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/install/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/install/config/tools/launcher/launcher.txt +39 -39
- data/install/config/tools/script_runner/script_runner.txt +3 -3
- data/install/config/tools/test_runner/test_runner.txt +8 -8
- data/install/config/tools/tlm_viewer/tlm_viewer.txt +5 -5
- data/install/lib/user_version.rb +3 -3
- data/install/tools/CmdExtractor +15 -15
- data/install/tools/CmdExtractor.bat +59 -59
- data/install/tools/CmdSender +15 -15
- data/install/tools/CmdSender.bat +59 -59
- data/install/tools/CmdTlmServer +15 -15
- data/install/tools/CmdTlmServer.bat +59 -59
- data/install/tools/DataViewer +15 -15
- data/install/tools/DataViewer.bat +59 -59
- data/install/tools/HandbookCreator +15 -15
- data/install/tools/HandbookCreator.bat +61 -61
- data/install/tools/Launcher +15 -15
- data/install/tools/Launcher.bat +59 -59
- data/install/tools/LimitsMonitor +15 -15
- data/install/tools/LimitsMonitor.bat +59 -59
- data/install/tools/OpenGLBuilder +15 -15
- data/install/tools/OpenGLBuilder.bat +59 -59
- data/install/tools/PacketViewer +15 -15
- data/install/tools/PacketViewer.bat +59 -59
- data/install/tools/Replay +15 -15
- data/install/tools/Replay.bat +59 -59
- data/install/tools/ScriptRunner +15 -15
- data/install/tools/ScriptRunner.bat +59 -59
- data/install/tools/TableManager +15 -15
- data/install/tools/TableManager.bat +59 -59
- data/install/tools/TestRunner +15 -15
- data/install/tools/TestRunner.bat +59 -59
- data/install/tools/TlmExtractor +15 -15
- data/install/tools/TlmExtractor.bat +59 -59
- data/install/tools/TlmGrapher +15 -15
- data/install/tools/TlmGrapher.bat +59 -59
- data/install/tools/TlmViewer +15 -15
- data/install/tools/TlmViewer.bat +59 -59
- data/install/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
- data/install/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
- data/install/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
- data/install/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
- data/install/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
- data/install/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
- data/install/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
- data/lib/cosmos.rb +63 -63
- data/lib/cosmos/ccsds/ccsds_packet.rb +63 -63
- data/lib/cosmos/ccsds/ccsds_parser.rb +143 -143
- data/lib/cosmos/config/config_parser.rb +324 -324
- data/lib/cosmos/conversions.rb +13 -13
- data/lib/cosmos/conversions/conversion.rb +47 -47
- data/lib/cosmos/conversions/generic_conversion.rb +55 -55
- data/lib/cosmos/conversions/new_packet_log_conversion.rb +45 -45
- data/lib/cosmos/conversions/polynomial_conversion.rb +57 -57
- data/lib/cosmos/conversions/processor_conversion.rb +46 -46
- data/lib/cosmos/conversions/received_count_conversion.rb +33 -33
- data/lib/cosmos/conversions/received_time_formatted_conversion.rb +37 -37
- data/lib/cosmos/conversions/received_time_seconds_conversion.rb +37 -37
- data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +128 -128
- data/lib/cosmos/conversions/unix_time_conversion.rb +50 -50
- data/lib/cosmos/conversions/unix_time_formatted_conversion.rb +44 -44
- data/lib/cosmos/conversions/unix_time_seconds_conversion.rb +44 -44
- data/lib/cosmos/core_ext.rb +18 -18
- data/lib/cosmos/core_ext/array.rb +354 -354
- data/lib/cosmos/core_ext/class.rb +51 -51
- data/lib/cosmos/core_ext/cosmos_io.rb +29 -29
- data/lib/cosmos/core_ext/exception.rb +52 -52
- data/lib/cosmos/core_ext/file.rb +75 -75
- data/lib/cosmos/core_ext/hash.rb +28 -28
- data/lib/cosmos/core_ext/io.rb +75 -75
- data/lib/cosmos/core_ext/kernel.rb +38 -38
- data/lib/cosmos/core_ext/math.rb +119 -119
- data/lib/cosmos/core_ext/matrix.rb +146 -146
- data/lib/cosmos/core_ext/objectspace.rb +29 -29
- data/lib/cosmos/core_ext/range.rb +22 -22
- data/lib/cosmos/core_ext/socket.rb +32 -32
- data/lib/cosmos/core_ext/string.rb +310 -310
- data/lib/cosmos/core_ext/stringio.rb +24 -24
- data/lib/cosmos/core_ext/time.rb +446 -446
- data/lib/cosmos/gui/choosers/combobox_chooser.rb +130 -130
- data/lib/cosmos/gui/choosers/file_chooser.rb +68 -68
- data/lib/cosmos/gui/choosers/float_chooser.rb +82 -82
- data/lib/cosmos/gui/choosers/integer_chooser.rb +80 -80
- data/lib/cosmos/gui/choosers/string_chooser.rb +53 -53
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +317 -317
- data/lib/cosmos/gui/dialogs/about_dialog.rb +128 -128
- data/lib/cosmos/gui/dialogs/calendar_dialog.rb +136 -136
- data/lib/cosmos/gui/dialogs/cmd_details_dialog.rb +52 -52
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +149 -149
- data/lib/cosmos/gui/dialogs/details_dialog.rb +174 -174
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +97 -97
- data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +59 -59
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +196 -196
- data/lib/cosmos/gui/dialogs/legal_dialog.rb +169 -168
- data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +118 -118
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +270 -262
- data/lib/cosmos/gui/dialogs/pry_dialog.rb +165 -161
- data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +37 -37
- data/lib/cosmos/gui/dialogs/select_dialog.rb +54 -54
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +131 -131
- data/lib/cosmos/gui/dialogs/splash.rb +113 -113
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +206 -206
- data/lib/cosmos/gui/dialogs/tlm_edit_dialog.rb +81 -81
- data/lib/cosmos/gui/line_graph/line_graph.rb +456 -456
- data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +34 -34
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +494 -494
- data/lib/cosmos/gui/line_graph/line_graph_popups.rb +116 -116
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +460 -460
- data/lib/cosmos/gui/line_graph/line_graph_script.rb +26 -26
- data/lib/cosmos/gui/line_graph/lines.rb +290 -290
- data/lib/cosmos/gui/line_graph/overview_graph.rb +459 -459
- data/lib/cosmos/gui/opengl/earth_model.rb +22 -22
- data/lib/cosmos/gui/opengl/gl_bounds.rb +67 -67
- data/lib/cosmos/gui/opengl/gl_light.rb +39 -39
- data/lib/cosmos/gui/opengl/gl_material.rb +29 -29
- data/lib/cosmos/gui/opengl/gl_scene.rb +72 -72
- data/lib/cosmos/gui/opengl/gl_shape.rb +146 -146
- data/lib/cosmos/gui/opengl/gl_viewer.rb +724 -712
- data/lib/cosmos/gui/opengl/gl_viewport.rb +35 -35
- data/lib/cosmos/gui/opengl/moon_model.rb +22 -22
- data/lib/cosmos/gui/opengl/opengl.rb +8 -8
- data/lib/cosmos/gui/opengl/stl_reader.rb +211 -211
- data/lib/cosmos/gui/opengl/stl_shape.rb +124 -124
- data/lib/cosmos/gui/opengl/texture_mapped_sphere.rb +202 -202
- data/lib/cosmos/gui/qt.rb +813 -786
- data/lib/cosmos/gui/qt_tool.rb +378 -373
- data/lib/cosmos/gui/text/completion.rb +381 -381
- data/lib/cosmos/gui/text/completion_line_edit.rb +30 -30
- data/lib/cosmos/gui/text/completion_text_edit.rb +179 -179
- data/lib/cosmos/gui/text/ruby_editor.rb +395 -395
- data/lib/cosmos/gui/utilities/screenshot.rb +25 -25
- data/lib/cosmos/gui/utilities/script_module_gui.rb +203 -203
- data/lib/cosmos/gui/widgets/full_text_search_line_edit.rb +161 -161
- data/lib/cosmos/gui/widgets/packet_log_frame.rb +305 -305
- data/lib/cosmos/gui/widgets/realtime_button_bar.rb +98 -98
- data/lib/cosmos/interfaces.rb +11 -11
- data/lib/cosmos/interfaces/cmd_tlm_server_interface.rb +153 -149
- data/lib/cosmos/interfaces/interface.rb +213 -213
- data/lib/cosmos/interfaces/linc_interface.rb +360 -360
- data/lib/cosmos/interfaces/serial_interface.rb +76 -76
- data/lib/cosmos/interfaces/simulated_target_interface.rb +129 -128
- data/lib/cosmos/interfaces/stream_interface.rb +156 -156
- data/lib/cosmos/interfaces/tcpip_client_interface.rb +60 -60
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +154 -154
- data/lib/cosmos/interfaces/udp_interface.rb +173 -173
- data/lib/cosmos/io/buffered_file.rb +11 -11
- data/lib/cosmos/io/cosmos_snmp.rb +50 -50
- data/lib/cosmos/io/io_multiplexer.rb +89 -89
- data/lib/cosmos/io/json_drb.rb +344 -320
- data/lib/cosmos/io/json_drb_object.rb +137 -137
- data/lib/cosmos/io/json_rpc.rb +365 -365
- data/lib/cosmos/io/posix_serial_driver.rb +145 -145
- data/lib/cosmos/io/raw_logger.rb +174 -174
- data/lib/cosmos/io/raw_logger_pair.rb +71 -71
- data/lib/cosmos/io/serial_driver.rb +85 -85
- data/lib/cosmos/io/stderr.rb +36 -36
- data/lib/cosmos/io/stdout.rb +36 -36
- data/lib/cosmos/io/tcpip_server.rb +583 -532
- data/lib/cosmos/io/udp_sockets.rb +152 -152
- data/lib/cosmos/io/win32_serial_driver.rb +147 -147
- data/lib/cosmos/packet_logs.rb +6 -6
- data/lib/cosmos/packet_logs/meta_packet_log_writer.rb +107 -107
- data/lib/cosmos/packet_logs/packet_log_reader.rb +441 -439
- data/lib/cosmos/packet_logs/packet_log_writer.rb +321 -309
- data/lib/cosmos/packet_logs/packet_log_writer_pair.rb +30 -30
- data/lib/cosmos/packets/binary_accessor.rb +921 -921
- data/lib/cosmos/packets/commands.rb +291 -291
- data/lib/cosmos/packets/limits.rb +263 -263
- data/lib/cosmos/packets/limits_response.rb +38 -38
- data/lib/cosmos/packets/packet.rb +714 -699
- data/lib/cosmos/packets/packet_config.rb +1034 -1034
- data/lib/cosmos/packets/packet_item.rb +317 -317
- data/lib/cosmos/packets/packet_item_limits.rb +128 -128
- data/lib/cosmos/packets/structure.rb +421 -386
- data/lib/cosmos/packets/structure_item.rb +233 -233
- data/lib/cosmos/packets/telemetry.rb +317 -317
- data/lib/cosmos/processors.rb +6 -6
- data/lib/cosmos/processors/new_packet_log_processor.rb +34 -34
- data/lib/cosmos/processors/processor.rb +71 -71
- data/lib/cosmos/processors/statistics_processor.rb +65 -65
- data/lib/cosmos/processors/watermark_processor.rb +44 -44
- data/lib/cosmos/script.rb +9 -9
- data/lib/cosmos/script/extract.rb +115 -115
- data/lib/cosmos/script/script.rb +1513 -1493
- data/lib/cosmos/streams/burst_stream_protocol.rb +25 -25
- data/lib/cosmos/streams/fixed_stream_protocol.rb +111 -111
- data/lib/cosmos/streams/length_stream_protocol.rb +140 -140
- data/lib/cosmos/streams/preidentified_stream_protocol.rb +118 -118
- data/lib/cosmos/streams/serial_stream.rb +152 -143
- data/lib/cosmos/streams/stream.rb +57 -57
- data/lib/cosmos/streams/stream_protocol.rb +369 -369
- data/lib/cosmos/streams/tcpip_client_stream.rb +77 -77
- data/lib/cosmos/streams/tcpip_socket_stream.rb +139 -139
- data/lib/cosmos/streams/template_stream_protocol.rb +140 -140
- data/lib/cosmos/streams/terminated_stream_protocol.rb +81 -81
- data/lib/cosmos/system.rb +4 -4
- data/lib/cosmos/system/system.rb +558 -558
- data/lib/cosmos/system/target.rb +178 -178
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +254 -253
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +716 -716
- data/lib/cosmos/tools/cmd_sender/cmd_sender_item_delegate.rb +77 -77
- data/lib/cosmos/tools/cmd_sender/cmd_sender_text_edit.rb +70 -70
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +936 -940
- data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +46 -46
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +67 -63
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +511 -497
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +241 -241
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1033 -1008
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +112 -112
- data/lib/cosmos/tools/cmd_tlm_server/connections.rb +176 -176
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +241 -221
- data/lib/cosmos/tools/cmd_tlm_server/interfaces.rb +127 -127
- data/lib/cosmos/tools/cmd_tlm_server/packet_logging.rb +132 -132
- data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +66 -66
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +97 -97
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +628 -600
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +167 -167
- data/lib/cosmos/tools/data_viewer/dump_component.rb +40 -40
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +149 -149
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +360 -360
- data/lib/cosmos/tools/launcher/launcher.rb +184 -184
- data/lib/cosmos/tools/launcher/launcher_config.rb +175 -167
- data/lib/cosmos/tools/launcher/launcher_multitool.rb +40 -41
- data/lib/cosmos/tools/launcher/launcher_tool.rb +104 -104
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +796 -768
- data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +416 -416
- data/lib/cosmos/tools/opengl_builder/scene_config.rb +118 -118
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +525 -525
- data/lib/cosmos/tools/replay/replay.rb +495 -488
- data/lib/cosmos/tools/replay/replay_server.rb +91 -91
- data/lib/cosmos/tools/script_runner/script_audit.rb +147 -139
- data/lib/cosmos/tools/script_runner/script_runner.rb +914 -914
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +40 -40
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +1892 -1859
- data/lib/cosmos/tools/table_manager/table.rb +70 -70
- data/lib/cosmos/tools/table_manager/table_config.rb +764 -764
- data/lib/cosmos/tools/table_manager/table_item.rb +74 -74
- data/lib/cosmos/tools/table_manager/table_manager.rb +1065 -1065
- data/lib/cosmos/tools/table_manager/table_manager_core.rb +539 -539
- data/lib/cosmos/tools/test_runner/results_writer.rb +283 -283
- data/lib/cosmos/tools/test_runner/test.rb +480 -480
- data/lib/cosmos/tools/test_runner/test_runner.rb +1157 -1157
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +338 -338
- data/lib/cosmos/tools/tlm_extractor/text_item_chooser.rb +60 -60
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +1008 -1008
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +371 -371
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +60 -60
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +75 -75
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb +44 -44
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +94 -94
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/data_object_editor.rb +61 -61
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +180 -180
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/linegraph_data_object_editor.rb +141 -141
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/singlexy_data_object_editor.rb +30 -30
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +173 -173
- data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +177 -177
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +412 -409
- data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +176 -176
- data/lib/cosmos/tools/tlm_grapher/data_objects/singlexy_data_object.rb +25 -25
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +323 -320
- data/lib/cosmos/tools/tlm_grapher/plot_editors/linegraph_plot_editor.rb +181 -181
- data/lib/cosmos/tools/tlm_grapher/plot_editors/plot_editor.rb +28 -28
- data/lib/cosmos/tools/tlm_grapher/plot_editors/singlexy_plot_editor.rb +30 -30
- data/lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb +59 -59
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/linegraph_plot_gui_object.rb +172 -172
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/singlexy_plot_gui_object.rb +27 -27
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb +74 -74
- data/lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb +201 -201
- data/lib/cosmos/tools/tlm_grapher/plots/plot.rb +69 -69
- data/lib/cosmos/tools/tlm_grapher/plots/singlexy_plot.rb +20 -20
- data/lib/cosmos/tools/tlm_grapher/plots/xy_plot.rb +61 -61
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +1278 -1278
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +430 -430
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_data_object_editor.rb +107 -107
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_logfile_thread.rb +111 -95
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_plot_editor.rb +101 -101
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +72 -66
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tab.rb +57 -57
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +1004 -1004
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +87 -87
- data/lib/cosmos/tools/tlm_viewer/screen.rb +486 -458
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +563 -544
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +287 -287
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +53 -53
- data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +110 -110
- data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +70 -70
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +61 -61
- data/lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb +39 -39
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +62 -62
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +41 -41
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +57 -57
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +56 -56
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +55 -55
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +66 -66
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +124 -124
- data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +31 -31
- data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +30 -30
- data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +36 -36
- data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +35 -35
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +27 -27
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +31 -31
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +26 -26
- data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +29 -29
- data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +39 -39
- data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +38 -38
- data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +38 -38
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +39 -39
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +42 -42
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +34 -34
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +178 -178
- data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +54 -54
- data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +47 -47
- data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +116 -116
- data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +34 -34
- data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +30 -30
- data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +57 -57
- data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +34 -34
- data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +35 -35
- data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +33 -33
- data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +26 -26
- data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +28 -28
- data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +47 -47
- data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +26 -26
- data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +88 -88
- data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +27 -27
- data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +130 -130
- data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +46 -46
- data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +43 -43
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +35 -35
- data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +257 -257
- data/lib/cosmos/top_level.rb +647 -596
- data/lib/cosmos/utilities.rb +11 -10
- data/lib/cosmos/utilities/crc.rb +166 -166
- data/lib/cosmos/utilities/csv.rb +83 -83
- data/lib/cosmos/utilities/logger.rb +137 -137
- data/lib/cosmos/utilities/low_fragmentation_array.rb +11 -11
- data/lib/cosmos/utilities/message_log.rb +74 -74
- data/lib/cosmos/utilities/quaternion.rb +258 -258
- data/lib/cosmos/utilities/ruby_lex_utils.rb +313 -313
- data/lib/cosmos/utilities/simulated_target.rb +99 -99
- data/lib/cosmos/utilities/sleeper.rb +44 -0
- data/lib/cosmos/version.rb +12 -12
- data/lib/cosmos/win32/excel.rb +66 -66
- data/lib/cosmos/win32/win32.rb +387 -387
- data/lib/cosmos/win32/win32_main.rb +311 -311
- data/roodi.yml +24 -24
- data/run_gui_tests.bat +32 -32
- data/spec/ccsds/ccsds_packet_spec.rb +67 -67
- data/spec/ccsds/ccsds_parser_spec.rb +148 -148
- data/spec/config/config_parser_spec.rb +322 -322
- data/spec/conversions/conversion_spec.rb +31 -31
- data/spec/conversions/generic_conversion_spec.rb +45 -45
- data/spec/conversions/new_packet_log_conversion_spec.rb +39 -39
- data/spec/conversions/polynomial_conversion_spec.rb +40 -40
- data/spec/conversions/processor_conversion_spec.rb +45 -45
- data/spec/conversions/received_count_conversion_spec.rb +43 -43
- data/spec/conversions/received_time_formatted_conversion_spec.rb +49 -49
- data/spec/conversions/received_time_seconds_conversion_spec.rb +50 -50
- data/spec/conversions/segmented_polynomial_conversion_spec.rb +51 -51
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +74 -74
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +76 -76
- data/spec/core_ext/array_spec.rb +186 -186
- data/spec/core_ext/class_spec.rb +36 -36
- data/spec/core_ext/cosmos_io_spec.rb +77 -77
- data/spec/core_ext/exception_spec.rb +91 -91
- data/spec/core_ext/file_spec.rb +72 -72
- data/spec/core_ext/hash_spec.rb +24 -24
- data/spec/core_ext/io_spec.rb +46 -46
- data/spec/core_ext/kernel_spec.rb +54 -54
- data/spec/core_ext/math_spec.rb +116 -116
- data/spec/core_ext/matrix_spec.rb +66 -66
- data/spec/core_ext/objectspace_spec.rb +29 -29
- data/spec/core_ext/range_spec.rb +21 -21
- data/spec/core_ext/socket_spec.rb +32 -32
- data/spec/core_ext/string_spec.rb +223 -223
- data/spec/core_ext/stringio_spec.rb +21 -21
- data/spec/core_ext/time_spec.rb +151 -151
- data/spec/gui/line_graph/line_clip_spec.rb +322 -322
- data/spec/install/config/system/system.txt +33 -33
- data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/spec/install/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/spec/install/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/spec/install/config/targets/COSMOS/screens/version.txt +19 -19
- data/spec/install/config/targets/COSMOS/target.txt +5 -5
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmd_linc.txt +30 -30
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +111 -111
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +236 -236
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm_linc.txt +25 -25
- data/spec/install/config/targets/INST/cmd_tlm_server.txt +5 -5
- data/spec/install/config/targets/INST/lib/sim_inst.rb +305 -294
- data/spec/install/config/targets/INST/target.txt +10 -10
- data/spec/install/config/targets/META/cmd_tlm/meta_cmd.txt +4 -4
- data/spec/install/config/targets/META/cmd_tlm/meta_tlm.txt +4 -4
- data/spec/install/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
- data/spec/interfaces/cmd_tlm_server_interface_spec.rb +150 -150
- data/spec/interfaces/interface_spec.rb +130 -131
- data/spec/interfaces/linc_interface_spec.rb +199 -199
- data/spec/interfaces/serial_interface_spec.rb +56 -56
- data/spec/interfaces/simulated_target_interface_spec.rb +128 -128
- data/spec/interfaces/stream_interface_spec.rb +157 -157
- data/spec/interfaces/tcpip_client_interface_spec.rb +54 -54
- data/spec/interfaces/tcpip_server_interface_spec.rb +151 -151
- data/spec/interfaces/udp_interface_spec.rb +175 -177
- data/spec/io/buffered_file_spec.rb +113 -113
- data/spec/io/io_multiplexer_spec.rb +94 -94
- data/spec/io/json_drb_object_spec.rb +99 -99
- data/spec/io/json_drb_spec.rb +311 -311
- data/spec/io/json_rpc_spec.rb +264 -264
- data/spec/io/raw_logger_pair_spec.rb +76 -76
- data/spec/io/raw_logger_spec.rb +133 -133
- data/spec/io/serial_driver_spec.rb +61 -61
- data/spec/io/stderr_spec.rb +32 -32
- data/spec/io/stdout_spec.rb +32 -32
- data/spec/io/tcpip_server_spec.rb +338 -338
- data/spec/io/udp_sockets_spec.rb +94 -94
- data/spec/io/win32_serial_driver_spec.rb +88 -88
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +170 -170
- data/spec/packet_logs/packet_log_reader_spec.rb +408 -408
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +30 -30
- data/spec/packet_logs/packet_log_writer_spec.rb +223 -223
- data/spec/packets/binary_accessor_spec.rb +2073 -2073
- data/spec/packets/commands_spec.rb +369 -369
- data/spec/packets/limits_response_spec.rb +25 -25
- data/spec/packets/limits_spec.rb +326 -326
- data/spec/packets/packet_config_spec.rb +1620 -1620
- data/spec/packets/packet_item_limits_spec.rb +161 -161
- data/spec/packets/packet_item_spec.rb +386 -386
- data/spec/packets/packet_spec.rb +1057 -949
- data/spec/packets/structure_item_spec.rb +195 -195
- data/spec/packets/structure_spec.rb +419 -419
- data/spec/packets/telemetry_spec.rb +535 -535
- data/spec/processors/new_packet_log_processor_spec.rb +39 -39
- data/spec/processors/processor_spec.rb +55 -55
- data/spec/processors/statistics_processor_spec.rb +60 -60
- data/spec/processors/watermark_processor_spec.rb +51 -51
- data/spec/script/script_spec.rb +654 -654
- data/spec/spec_helper.rb +154 -148
- data/spec/streams/burst_stream_protocol_spec.rb +32 -32
- data/spec/streams/fixed_stream_protocol_spec.rb +110 -110
- data/spec/streams/length_stream_protocol_spec.rb +297 -297
- data/spec/streams/preidentified_stream_protocol_spec.rb +118 -118
- data/spec/streams/serial_stream_spec.rb +105 -105
- data/spec/streams/stream_protocol_spec.rb +332 -332
- data/spec/streams/stream_spec.rb +29 -29
- data/spec/streams/tcpip_client_stream_spec.rb +54 -54
- data/spec/streams/tcpip_socket_stream_spec.rb +146 -146
- data/spec/streams/template_stream_protocol_spec.rb +151 -151
- data/spec/streams/terminated_stream_protocol_spec.rb +123 -123
- data/spec/system/system_spec.rb +645 -645
- data/spec/system/target_spec.rb +248 -248
- data/spec/tools/cmd_tlm_server/api_spec.rb +1087 -1113
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +81 -81
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +411 -411
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +415 -415
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +123 -123
- data/spec/tools/cmd_tlm_server/connections_spec.rb +147 -147
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +306 -306
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +252 -238
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +143 -143
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +98 -101
- data/spec/tools/cmd_tlm_server/routers_spec.rb +223 -208
- data/spec/top_level/top_level_spec.rb +334 -321
- data/spec/utilities/crc_spec.rb +45 -45
- data/spec/utilities/csv_spec.rb +97 -97
- data/spec/utilities/logger_spec.rb +102 -102
- data/spec/utilities/message_log_spec.rb +89 -89
- data/spec/utilities/quaternion_spec.rb +107 -107
- data/spec/utilities/ruby_lex_utils_spec.rb +86 -86
- data/tasks/manifest.rake +22 -22
- data/tasks/spec.rake +23 -23
- metadata +18 -2
data/lib/cosmos/gui/qt.rb
CHANGED
@@ -1,786 +1,813 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
|
3
|
-
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
-
# All Rights Reserved.
|
5
|
-
#
|
6
|
-
# This program is free software; you can modify and/or redistribute it
|
7
|
-
# under the terms of the GNU General Public License
|
8
|
-
# as published by the Free Software Foundation; version 3 with
|
9
|
-
# attribution addendums as found in the LICENSE.txt
|
10
|
-
|
11
|
-
# This file require QT for use by COSMOS. It exists to provide a location for
|
12
|
-
# adding workarounds should they be needed to work through problems with
|
13
|
-
# interacting with QT from Ruby.
|
14
|
-
|
15
|
-
require 'cosmos'
|
16
|
-
check_filename = File.join(Cosmos::USERPATH, "#{File.basename($0, File.extname($0))}_qt_check.txt")
|
17
|
-
qt_in_system_folder = false
|
18
|
-
|
19
|
-
# Check for Qt dlls in Window system folders
|
20
|
-
if Kernel.is_windows?
|
21
|
-
windir = ENV['SystemRoot']
|
22
|
-
if windir
|
23
|
-
# Check Windows system folders for existing Qt dll files
|
24
|
-
['system', 'SysWOW64', 'System32'].each do |folder|
|
25
|
-
break if qt_in_system_folder
|
26
|
-
['libgcc_s_dw2-1.dll',
|
27
|
-
'mingwm10.dll',
|
28
|
-
'phonon4.dll',
|
29
|
-
'Qt3Support4.dll',
|
30
|
-
'QtCLucene4.dll',
|
31
|
-
'QtCore4.dll',
|
32
|
-
'QtDeclarative4.dll',
|
33
|
-
'QtDesigner4.dll',
|
34
|
-
'QtDesignerComponents4.dll',
|
35
|
-
'QtGui4.dll',
|
36
|
-
'QtHelp4.dll',
|
37
|
-
'QtMultimedia4.dll',
|
38
|
-
'QtNetwork4.dll',
|
39
|
-
'QtOpenGL4.dll',
|
40
|
-
'QtScript4.dll',
|
41
|
-
'QtScriptTools4.dll',
|
42
|
-
'QtSql4.dll',
|
43
|
-
'QtSvg4.dll',
|
44
|
-
'QtTest4.dll',
|
45
|
-
'QtWebKit4.dll',
|
46
|
-
'QtXml4.dll',
|
47
|
-
'QtXmlPatterns4.dll'].each do |qtfilename|
|
48
|
-
break if qt_in_system_folder
|
49
|
-
filename = File.join(windir, folder, qtfilename)
|
50
|
-
if File.exist?(filename)
|
51
|
-
qt_in_system_folder = true
|
52
|
-
|
53
|
-
# Is this the first time we've detected this?
|
54
|
-
if File.exist?(check_filename)
|
55
|
-
# We tried before and failed
|
56
|
-
File.delete(check_filename)
|
57
|
-
|
58
|
-
if $0 =~ /Launcher/
|
59
|
-
require 'cosmos/win32/win32'
|
60
|
-
Cosmos::Win32.message_box("Found conflicting Qt dll file at: #{filename}\nPlease overwrite all Qt dlls in the Windows system folders with the newest Qt4 version (or delete them).")
|
61
|
-
end
|
62
|
-
raise "Found conflicting Qt dll file at: #{filename}. Please overwrite all Qt dlls in the Windows system folders with the newest Qt4 version (or delete them)."
|
63
|
-
else
|
64
|
-
# First Time we've detected this - We'll create it and risk just requiring Qt once
|
65
|
-
File.open(check_filename, 'w') {|file| file.write("Qt Dll Check In Progress")}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# This will either lock up or raise an error if older Qt dlls are present in the Windows system folders
|
74
|
-
require 'Qt'
|
75
|
-
File.delete(check_filename) if Kernel.is_windows? and File.exist?(check_filename)
|
76
|
-
|
77
|
-
module Cosmos
|
78
|
-
BIN_FILE_PATTERN = "Bin Files (*.bin);;All Files (*)"
|
79
|
-
TXT_FILE_PATTERN = "Txt Files (*.txt);;All Files (*)"
|
80
|
-
CSV_FILE_PATTERN = "Csv Files (*.csv);;All Files (*)"
|
81
|
-
CMD_FILE_PATTERN = "Cmd Log Files (*cmd*.bin);;Bin Files (*.bin);;All Files (*)"
|
82
|
-
TLM_FILE_PATTERN = "Tlm Log Files (*tlm*.bin);;Bin Files (*.bin);;All Files (*)"
|
83
|
-
COLORS = {}
|
84
|
-
BRUSHES = {}
|
85
|
-
PALETTES = {}
|
86
|
-
PENS = {}
|
87
|
-
FONTS = {}
|
88
|
-
FONT_METRICS = {}
|
89
|
-
CURSORS = {}
|
90
|
-
|
91
|
-
def self.getColor(color_r, color_g = nil, color_b = nil)
|
92
|
-
return color_r if (color_r.is_a? Qt::Color) || (color_r.is_a? Qt::Pen) || (color_r.is_a? Qt::LinearGradient)
|
93
|
-
|
94
|
-
color = nil
|
95
|
-
key = color_r
|
96
|
-
key = key.to_i if key.is_a? Qt::Enum
|
97
|
-
if color_r && color_g && color_b
|
98
|
-
key = (color_r.to_i << 24) + (color_g.to_i << 16) + (color_b.to_i << 8)
|
99
|
-
end
|
100
|
-
|
101
|
-
if Cosmos::COLORS[key]
|
102
|
-
color = Cosmos::COLORS[key]
|
103
|
-
else
|
104
|
-
if color_r && color_g && color_b
|
105
|
-
color = Qt::Color.new(color_r.to_i, color_g.to_i, color_b.to_i)
|
106
|
-
else
|
107
|
-
color = Qt::Color.new(color_r)
|
108
|
-
end
|
109
|
-
Cosmos::COLORS[key] = color
|
110
|
-
end
|
111
|
-
color
|
112
|
-
end
|
113
|
-
|
114
|
-
def self.getBrush(color)
|
115
|
-
brush = nil
|
116
|
-
color = Cosmos.getColor(color)
|
117
|
-
brush = BRUSHES[color]
|
118
|
-
unless brush
|
119
|
-
if color.is_a? Qt::LinearGradient
|
120
|
-
brush = Qt::Brush.new(color)
|
121
|
-
else
|
122
|
-
brush = Qt::Brush.new(color, Qt::SolidPattern)
|
123
|
-
end
|
124
|
-
BRUSHES[color] = brush
|
125
|
-
end
|
126
|
-
brush
|
127
|
-
end
|
128
|
-
|
129
|
-
def self.getPalette(foreground, background)
|
130
|
-
foreground = Cosmos.getColor(foreground)
|
131
|
-
background = Cosmos.getColor(background)
|
132
|
-
PALETTES[foreground] ||= {}
|
133
|
-
p = PALETTES[foreground][background]
|
134
|
-
unless p
|
135
|
-
p = Qt::Palette.new
|
136
|
-
p.setColor(Qt::Palette::Text, foreground)
|
137
|
-
p.setColor(Qt::Palette::Base, background)
|
138
|
-
p.setColor(Qt::Palette::Window, background)
|
139
|
-
PALETTES[foreground][background] = p
|
140
|
-
end
|
141
|
-
p
|
142
|
-
end
|
143
|
-
|
144
|
-
def self.getPen(color = nil)
|
145
|
-
color = Cosmos.getColor(color) if color
|
146
|
-
pen = nil
|
147
|
-
pen = PENS[color]
|
148
|
-
unless pen
|
149
|
-
if color
|
150
|
-
pen = Qt::Pen.new(color)
|
151
|
-
else
|
152
|
-
pen = Qt::Pen.new
|
153
|
-
end
|
154
|
-
PENS[color] = pen
|
155
|
-
end
|
156
|
-
pen
|
157
|
-
end
|
158
|
-
|
159
|
-
def self.getFont(font_face, font_size, font_attrs = nil, font_italics = false)
|
160
|
-
FONTS[font_face] ||= {}
|
161
|
-
FONTS[font_face][font_size] ||= {}
|
162
|
-
FONTS[font_face][font_size][font_attrs] ||= {}
|
163
|
-
font = FONTS[font_face][font_size][font_attrs][font_italics]
|
164
|
-
unless font
|
165
|
-
if font_attrs and font_italics
|
166
|
-
font = Qt::Font.new(font_face, font_size, font_attrs, font_italics)
|
167
|
-
else
|
168
|
-
font = Qt::Font.new(font_face, font_size)
|
169
|
-
end
|
170
|
-
FONTS[font_face][font_size][font_attrs][font_italics] = font
|
171
|
-
end
|
172
|
-
font
|
173
|
-
end
|
174
|
-
|
175
|
-
def self.getFontMetrics(font)
|
176
|
-
font_metrics = FONT_METRICS[font]
|
177
|
-
unless font_metrics
|
178
|
-
font_metrics = Qt::FontMetrics.new(font)
|
179
|
-
FONT_METRICS[font] = font_metrics
|
180
|
-
end
|
181
|
-
font_metrics
|
182
|
-
end
|
183
|
-
|
184
|
-
def self.getCursor(shape)
|
185
|
-
key = shape
|
186
|
-
key = shape.to_i if shape.is_a? Qt::Enum
|
187
|
-
cursor = CURSORS[key]
|
188
|
-
unless cursor
|
189
|
-
cursor = Qt::Cursor.new(shape)
|
190
|
-
CURSORS[key] = cursor
|
191
|
-
end
|
192
|
-
cursor
|
193
|
-
end
|
194
|
-
|
195
|
-
GREEN = getColor(0, 150, 0)
|
196
|
-
YELLOW = getColor(190, 135, 0)
|
197
|
-
RED = getColor(Qt::red)
|
198
|
-
BLUE = getColor(0, 100, 255)
|
199
|
-
PURPLE = getColor(200, 0, 200)
|
200
|
-
BLACK = getColor(Qt::black)
|
201
|
-
WHITE = getColor(Qt::white)
|
202
|
-
BLACK_NO_BRUSH = Qt::Brush.new(Cosmos::BLACK, Qt::NoBrush)
|
203
|
-
DEFAULT_PALETTE = Qt::Palette.new
|
204
|
-
RED_PALETTE = Qt::Palette.new(Qt::red)
|
205
|
-
DASHLINE_PEN = Qt::Pen.new(Qt::DashLine)
|
206
|
-
|
207
|
-
# Load the applications icon
|
208
|
-
def self.load_cosmos_icon(name='COSMOS_64x64.png')
|
209
|
-
icon = Cosmos.get_icon(name, false)
|
210
|
-
icon = Cosmos.get_icon('COSMOS_64x64.png', false) unless icon
|
211
|
-
Qt::Application.instance.setWindowIcon(icon) if icon
|
212
|
-
return icon
|
213
|
-
end
|
214
|
-
|
215
|
-
# Load the applications icon
|
216
|
-
def self.get_icon(name, fail_blank = true)
|
217
|
-
icon = nil
|
218
|
-
filename = File.join(::Cosmos::USERPATH, 'config', 'data', name)
|
219
|
-
begin
|
220
|
-
raise unless File.exist? filename
|
221
|
-
icon = Qt::Icon.new(filename)
|
222
|
-
raise if icon.isNull
|
223
|
-
rescue
|
224
|
-
begin
|
225
|
-
filename = File.join(::Cosmos::PATH, 'data', name)
|
226
|
-
raise unless File.exist? filename
|
227
|
-
icon = Qt::Icon.new(filename)
|
228
|
-
raise if icon.isNull
|
229
|
-
rescue
|
230
|
-
# Return a blank icon if we couldn't find an icon in either the user path or cosmos path
|
231
|
-
if fail_blank
|
232
|
-
icon = Qt::Icon.new
|
233
|
-
else
|
234
|
-
icon = nil
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
238
|
-
return icon
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
#### TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
243
|
-
class Qt::Application
|
244
|
-
def exec
|
245
|
-
begin
|
246
|
-
method_missing(:exec)
|
247
|
-
ensure
|
248
|
-
disable_threading()
|
249
|
-
self.dispose
|
250
|
-
Qt::Internal.application_terminated = true
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
class Qt::CoreApplication
|
256
|
-
def exec
|
257
|
-
begin
|
258
|
-
method_missing(:exec)
|
259
|
-
ensure
|
260
|
-
disable_threading()
|
261
|
-
self.dispose
|
262
|
-
Qt::Internal.application_terminated = true
|
263
|
-
end
|
264
|
-
end
|
265
|
-
end
|
266
|
-
#### END TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
267
|
-
|
268
|
-
class Qt::Dialog
|
269
|
-
def initialize(parent = Qt::Application.activeWindow,
|
270
|
-
flags = (Qt::WindowTitleHint | Qt::WindowSystemMenuHint))
|
271
|
-
super(parent, flags)
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
class Qt::TableWidget
|
276
|
-
# Resizes the table, turns off scroll bars, and sets the minimum and maximum sizes
|
277
|
-
# to the full size of the table with all the elements in view
|
278
|
-
def displayFullSize
|
279
|
-
resizeColumnsToContents()
|
280
|
-
resizeRowsToContents()
|
281
|
-
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
282
|
-
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
283
|
-
setMinimumSize(2*frameWidth() + horizontalHeader.length + verticalHeader.width,
|
284
|
-
2*frameWidth() + verticalHeader.length + horizontalHeader.height)
|
285
|
-
setMaximumSize(2*frameWidth() + horizontalHeader.length + verticalHeader.width,
|
286
|
-
2*frameWidth() + verticalHeader.length + horizontalHeader.height)
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
class Qt::TableWidgetItem
|
291
|
-
def initialize(string = "")
|
292
|
-
super(string)
|
293
|
-
setFlags(Qt::ItemIsEnabled)
|
294
|
-
end
|
295
|
-
|
296
|
-
def textColor=(color)
|
297
|
-
setForeground(Cosmos.getBrush(color))
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
class Qt::TreeWidget
|
302
|
-
def initialize(parent = Qt::Application.activeWindow)
|
303
|
-
super(parent)
|
304
|
-
|
305
|
-
# Create a sensible default handler for clicking the checkboxes
|
306
|
-
# of a tree. If you check a node all the lower nodes get checked.
|
307
|
-
# If you uncheck a node all the lower nodes get unchecked.
|
308
|
-
# If you check a lower node all the parent nodes get checked.
|
309
|
-
connect(SIGNAL('itemClicked(QTreeWidgetItem*, int)')) do |node, col|
|
310
|
-
if node.checkState == Qt::Checked
|
311
|
-
# Set all nodes below this to checked
|
312
|
-
node.setCheckStateAll(Qt::Checked)
|
313
|
-
|
314
|
-
# Set all the nodes above this to checked
|
315
|
-
while node.parent
|
316
|
-
node = node.parent
|
317
|
-
node.setCheckState(0, Qt::Checked)
|
318
|
-
end
|
319
|
-
else
|
320
|
-
# Set all nodes below this to unchecked
|
321
|
-
node.setCheckStateAll(Qt::Unchecked)
|
322
|
-
end
|
323
|
-
end
|
324
|
-
end
|
325
|
-
|
326
|
-
# Yields each of the top level items (those without a parent).
|
327
|
-
def topLevelItems
|
328
|
-
topLevelItemCount.times do |index|
|
329
|
-
yield topLevelItem(index)
|
330
|
-
end
|
331
|
-
end
|
332
|
-
end
|
333
|
-
|
334
|
-
class Qt::TreeWidgetItem
|
335
|
-
# Sets the check state of this TreeWidgetItem as well as all its children
|
336
|
-
# recursively.
|
337
|
-
#
|
338
|
-
# @param state [Integer] Must be Qt::Checked or Qt::Unchecked
|
339
|
-
def setCheckStateAll(state = Qt::Checked)
|
340
|
-
children() do |child|
|
341
|
-
child.setCheckStateAll(state)
|
342
|
-
end
|
343
|
-
setCheckState(0, state)
|
344
|
-
end
|
345
|
-
|
346
|
-
# @return [Qt::TreeWidgetItem] The top level item for this TreeWidgetItem.
|
347
|
-
# The top level item does not have a parent. Note that this could return
|
348
|
-
# itself.
|
349
|
-
def topLevel
|
350
|
-
top = self
|
351
|
-
if !top.parent.nil?
|
352
|
-
while true
|
353
|
-
top = top.parent
|
354
|
-
break if top.parent.nil?
|
355
|
-
end
|
356
|
-
end
|
357
|
-
top
|
358
|
-
end
|
359
|
-
|
360
|
-
# Yields the children of the current node
|
361
|
-
def children
|
362
|
-
childCount.times do |index|
|
363
|
-
yield child(index)
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
|
-
# Define the default column to be 0
|
368
|
-
def background(column = 0)
|
369
|
-
super(column)
|
370
|
-
end
|
371
|
-
def checkState(column = 0)
|
372
|
-
super(column)
|
373
|
-
end
|
374
|
-
def font(column = 0)
|
375
|
-
super(column)
|
376
|
-
end
|
377
|
-
def foreground(column = 0)
|
378
|
-
super(column)
|
379
|
-
end
|
380
|
-
def icon(column = 0)
|
381
|
-
super(column)
|
382
|
-
end
|
383
|
-
def statusTip(column = 0)
|
384
|
-
super(column)
|
385
|
-
end
|
386
|
-
def sizeHint(column = 0)
|
387
|
-
super(column)
|
388
|
-
end
|
389
|
-
def text(column = 0)
|
390
|
-
super(column)
|
391
|
-
end
|
392
|
-
def toolTip(column = 0)
|
393
|
-
super(column)
|
394
|
-
end
|
395
|
-
def whatsThis(column = 0)
|
396
|
-
super(column)
|
397
|
-
end
|
398
|
-
end
|
399
|
-
|
400
|
-
class Qt::TabWidget
|
401
|
-
def tab(index)
|
402
|
-
widget(index)
|
403
|
-
end
|
404
|
-
|
405
|
-
def widgets
|
406
|
-
all = []
|
407
|
-
(0...self.count()).each do |index|
|
408
|
-
all << self.widget(index)
|
409
|
-
end
|
410
|
-
all
|
411
|
-
end
|
412
|
-
alias :tabs :widgets
|
413
|
-
|
414
|
-
def currentWidget
|
415
|
-
self.widget(self.currentIndex)
|
416
|
-
end
|
417
|
-
alias :currentTab :currentWidget
|
418
|
-
end
|
419
|
-
|
420
|
-
class Qt::LineEdit
|
421
|
-
def setColors(foreground, background)
|
422
|
-
setPalette(Cosmos.getPalette(foreground, background))
|
423
|
-
end
|
424
|
-
|
425
|
-
def text=(value)
|
426
|
-
setText(value)
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
class Qt::PlainTextEdit
|
431
|
-
def add_formatted_text(text, color = nil)
|
432
|
-
if text =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
433
|
-
text.chomp!
|
434
|
-
text = text.inspect.remove_quotes
|
435
|
-
text << "\n"
|
436
|
-
end
|
437
|
-
if text =~ /<G>/ or color == Cosmos::GREEN
|
438
|
-
text.gsub!('<G>', '')
|
439
|
-
addText(text, Cosmos::GREEN)
|
440
|
-
elsif text =~ /<Y>/ or color == Cosmos::YELLOW
|
441
|
-
text.gsub!('<Y>', '')
|
442
|
-
addText(text, Cosmos::YELLOW)
|
443
|
-
elsif text =~ /<R>/ or color == Cosmos::RED
|
444
|
-
text.gsub!('<R>', '')
|
445
|
-
addText(text, Cosmos::RED)
|
446
|
-
elsif text =~ /<B>/ or color == Cosmos::BLUE
|
447
|
-
text.gsub!('<B>', '')
|
448
|
-
addText(text, Cosmos::BLUE)
|
449
|
-
else
|
450
|
-
addText(text) # default is Cosmos::BLACK
|
451
|
-
end
|
452
|
-
end
|
453
|
-
|
454
|
-
def addText(text, color = Cosmos::BLACK)
|
455
|
-
@current_text = "" if !defined? @current_text or @current_text.nil?
|
456
|
-
text = text.gsub("&", "&")
|
457
|
-
text.gsub!("\n", '')
|
458
|
-
text.gsub!(' ', ' ')
|
459
|
-
text.gsub!(">", ">")
|
460
|
-
text.gsub!("<", "<")
|
461
|
-
rgb_color = "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
462
|
-
@current_text +="<font color=\"#{rgb_color}\">#{text}</font><br/>"
|
463
|
-
end
|
464
|
-
|
465
|
-
def flush
|
466
|
-
appendHtml(@current_text)
|
467
|
-
@current_text = nil
|
468
|
-
end
|
469
|
-
|
470
|
-
def appendText(text, color = Cosmos::BLACK)
|
471
|
-
text = text.chomp
|
472
|
-
text.gsub!(/\n/, '<br/>') # replace newlines with html breaks
|
473
|
-
text.gsub!("&", "&")
|
474
|
-
text.gsub!(' ', ' ')
|
475
|
-
text.gsub!(">", ">")
|
476
|
-
text.gsub!("<", "<")
|
477
|
-
rgb_color = "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
478
|
-
appendHtml("<font color=\"#{rgb_color}\">#{text}</font>")
|
479
|
-
end
|
480
|
-
|
481
|
-
# Return the selected lines. If a partial line is selected the entire line will be returned.
|
482
|
-
# If there is no selection the line with the cursor will be returned
|
483
|
-
def selected_lines
|
484
|
-
cursor = textCursor
|
485
|
-
selection_end = cursor.selectionEnd
|
486
|
-
# Initially place the cursor at the beginning of the selection
|
487
|
-
# If nothing is selected this will just put the cursor at the beginning of the current line
|
488
|
-
cursor.setPosition(textCursor.selectionStart)
|
489
|
-
cursor.movePosition(Qt::TextCursor::StartOfLine)
|
490
|
-
# Move the cursor to the end of the selection while keeping the anchor
|
491
|
-
cursor.setPosition(selection_end, Qt::TextCursor::KeepAnchor)
|
492
|
-
# Normally we want to select the entire line where the end of selection is
|
493
|
-
# However if the user selects an exact number of lines
|
494
|
-
# the cursor will be at the beginning of the following line
|
495
|
-
# Therefore if the cursor is at the beginning of the line and we have a selection
|
496
|
-
# we'll skip moving to the end of the line
|
497
|
-
unless (cursor.atBlockStart and textCursor.hasSelection)
|
498
|
-
cursor.movePosition(Qt::TextCursor::EndOfLine, Qt::TextCursor::KeepAnchor)
|
499
|
-
end
|
500
|
-
# If there is no selection then just return nil
|
501
|
-
return nil if cursor.selectedText.nil?
|
502
|
-
|
503
|
-
cursor.selection.toPlainText
|
504
|
-
|
505
|
-
# The selectedText function returns the Unicode U+2029 paragraph separator character
|
506
|
-
# instead of newline \n. Thus we have to unpack as Unicode, covert to newlines, and then repack
|
507
|
-
#text = cursor.selectedText.unpack("U*")
|
508
|
-
#text.collect! {|letter| if letter == 63 then 10 else letter end }
|
509
|
-
#text.pack("U*")
|
510
|
-
end
|
511
|
-
|
512
|
-
# Return the line number (0 based) of the selection start
|
513
|
-
def selection_start_line
|
514
|
-
cursor = textCursor
|
515
|
-
cursor.setPosition(textCursor.selectionStart)
|
516
|
-
cursor.blockNumber
|
517
|
-
end
|
518
|
-
|
519
|
-
# Return the line number (0 based) of the selection end
|
520
|
-
def selection_end_line
|
521
|
-
cursor = textCursor
|
522
|
-
cursor.setPosition(textCursor.selectionEnd)
|
523
|
-
cursor.blockNumber
|
524
|
-
end
|
525
|
-
end
|
526
|
-
|
527
|
-
class Qt::TextEdit
|
528
|
-
def setColors(foreground, background)
|
529
|
-
setPalette(Cosmos.getPalette(foreground, background))
|
530
|
-
end
|
531
|
-
end
|
532
|
-
|
533
|
-
class Qt::ComboBox
|
534
|
-
# Helper method to remove all items from a ComboBox
|
535
|
-
def clearItems
|
536
|
-
(0...count).to_a.reverse.each do |index|
|
537
|
-
removeItem(index)
|
538
|
-
end
|
539
|
-
end
|
540
|
-
|
541
|
-
# Alias currentText as text to make it more compatible with LineEdit which uses text
|
542
|
-
def text
|
543
|
-
currentText
|
544
|
-
end
|
545
|
-
|
546
|
-
# Helper method to set the current item using a text String instead of the index
|
547
|
-
def setCurrentText(arg)
|
548
|
-
setCurrentIndex(findText(arg.to_s))
|
549
|
-
end
|
550
|
-
|
551
|
-
def each
|
552
|
-
(0...count).each do |index|
|
553
|
-
yield self.itemText(index), self.itemData(index)
|
554
|
-
end
|
555
|
-
end
|
556
|
-
end
|
557
|
-
|
558
|
-
class Qt::ListWidget
|
559
|
-
# Helper method to remove all items from a ListWidget
|
560
|
-
def clearItems
|
561
|
-
(0...count).each do
|
562
|
-
takeItem(0).dispose
|
563
|
-
end
|
564
|
-
end
|
565
|
-
|
566
|
-
def each
|
567
|
-
(0...count).each do |index|
|
568
|
-
yield self.item(index)
|
569
|
-
end
|
570
|
-
end
|
571
|
-
|
572
|
-
def remove_selected_items
|
573
|
-
# Take the selected items and call row on each to get an array of the item indexes
|
574
|
-
# Sort that array because selectedItems is returned in the order selected, not numerical order
|
575
|
-
# Reverse this array of indices so we remove the last item first,
|
576
|
-
# this allows all the indexes to remain constant
|
577
|
-
# Call takeItem of each of the indices and then dispose the resulting ListWidgetItem that is returned
|
578
|
-
selectedItems.map {|x| row(x)}.sort.reverse.each { |index| takeItem(index).dispose }
|
579
|
-
end
|
580
|
-
end
|
581
|
-
|
582
|
-
# This class attempts to duplicate Fox's FXColorList
|
583
|
-
# by adding a colored icon to each item in the ListWidget
|
584
|
-
class Qt::ColorListWidget < Qt::ListWidget
|
585
|
-
attr_reader :original_parent
|
586
|
-
|
587
|
-
def initialize(parent, enable_key_delete = true)
|
588
|
-
super(parent)
|
589
|
-
# When a layout adds this widget it automatically gets re-parented so
|
590
|
-
# store the original parent in case someone needs it
|
591
|
-
@original_parent = parent
|
592
|
-
@enable_key_delete = enable_key_delete
|
593
|
-
@colors = []
|
594
|
-
@maps = []
|
595
|
-
@icons = []
|
596
|
-
setUniformItemSizes(true)
|
597
|
-
end
|
598
|
-
|
599
|
-
def resize_to_contents
|
600
|
-
return if count == 0
|
601
|
-
#setResizeMode(Qt::ListView::Adjust)
|
602
|
-
# Disable the vertical scrollbar and don't display it
|
603
|
-
verticalScrollBar.setDisabled(true)
|
604
|
-
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
605
|
-
# Get the height of an item and multiply by the number of items
|
606
|
-
setFixedHeight(visualItemRect(item(0)).height * (count + 1))
|
607
|
-
end
|
608
|
-
|
609
|
-
def set_read_only
|
610
|
-
setSelectionMode(Qt::AbstractItemView::NoSelection)
|
611
|
-
filter = Qt::Object.new
|
612
|
-
filter.define_singleton_method(:eventFilter) do |obj, event|
|
613
|
-
if event.type == Qt::Event::KeyPress &&
|
614
|
-
(event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
615
|
-
return true
|
616
|
-
end
|
617
|
-
return false
|
618
|
-
end
|
619
|
-
installEventFilter(filter)
|
620
|
-
end
|
621
|
-
|
622
|
-
def keyPressEvent(event)
|
623
|
-
if @enable_key_delete
|
624
|
-
if (event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
625
|
-
takeItemColor(currentRow)
|
626
|
-
end
|
627
|
-
end
|
628
|
-
super(event)
|
629
|
-
end
|
630
|
-
|
631
|
-
def addItemColor(text, color = Cosmos::BLACK)
|
632
|
-
@colors << color
|
633
|
-
@maps << Qt::Pixmap.new(20,14)
|
634
|
-
color = Cosmos::getColor(color)
|
635
|
-
@maps[-1].fill(color)
|
636
|
-
icon = Qt::Icon.new
|
637
|
-
icon.addPixmap(@maps[-1], Qt::Icon::Normal)
|
638
|
-
icon.addPixmap(@maps[-1], Qt::Icon::Selected)
|
639
|
-
@icons << icon
|
640
|
-
item = Qt::ListWidgetItem.new(@icons[-1], text.to_s)
|
641
|
-
addItem(item)
|
642
|
-
end
|
643
|
-
|
644
|
-
def getItemColor(index)
|
645
|
-
@colors[index]
|
646
|
-
end
|
647
|
-
|
648
|
-
def takeItemColor(row)
|
649
|
-
item = takeItem(row)
|
650
|
-
if item
|
651
|
-
@colors.delete_at(row)
|
652
|
-
@maps.delete_at(row).dispose
|
653
|
-
@icons.delete_at(row).dispose
|
654
|
-
item.dispose
|
655
|
-
end
|
656
|
-
end
|
657
|
-
|
658
|
-
def clearItems
|
659
|
-
(0...count).each do
|
660
|
-
takeItemColor(0)
|
661
|
-
end
|
662
|
-
end
|
663
|
-
|
664
|
-
def dispose
|
665
|
-
super()
|
666
|
-
@maps.each {|map| map.dispose}
|
667
|
-
@icons.each {|icon| icon.dispose}
|
668
|
-
end
|
669
|
-
end
|
670
|
-
|
671
|
-
class Qt::Painter
|
672
|
-
def addLineColor(x, y, w, h, color = Cosmos::BLACK)
|
673
|
-
color = Cosmos::getColor(color)
|
674
|
-
setPen(color)
|
675
|
-
drawLine(x,y,w,h)
|
676
|
-
end
|
677
|
-
|
678
|
-
def addRectColor(x, y, w, h, color = Cosmos::BLACK)
|
679
|
-
color = Cosmos::getColor(color)
|
680
|
-
setPen(color)
|
681
|
-
setBrush(nil)
|
682
|
-
drawRect(x,y,w,h)
|
683
|
-
end
|
684
|
-
|
685
|
-
def addRectColorFill(x, y, w, h, color = Cosmos::BLACK)
|
686
|
-
color = Cosmos::getColor(color)
|
687
|
-
setPen(color)
|
688
|
-
setBrush(Cosmos.getBrush(color))
|
689
|
-
drawRect(x,y,w,h)
|
690
|
-
end
|
691
|
-
|
692
|
-
def addSimpleTextAt(text, x, y, color = Cosmos::BLACK)
|
693
|
-
color = Cosmos::getColor(color)
|
694
|
-
setPen(color)
|
695
|
-
drawText(x, y, text)
|
696
|
-
end
|
697
|
-
|
698
|
-
def addEllipseColor(x, y, w, h, color = Cosmos::BLACK)
|
699
|
-
color = Cosmos::getColor(color)
|
700
|
-
setPen(color)
|
701
|
-
setBrush(nil)
|
702
|
-
drawEllipse(x,y,w,h)
|
703
|
-
end
|
704
|
-
|
705
|
-
def addEllipseColorFill(x, y, w, h, color = Cosmos::BLACK)
|
706
|
-
color = Cosmos::getColor(color)
|
707
|
-
setPen(color)
|
708
|
-
setBrush(Cosmos.getBrush(color))
|
709
|
-
drawEllipse(x,y,w,h)
|
710
|
-
end
|
711
|
-
end
|
712
|
-
|
713
|
-
class Qt::MatrixLayout < Qt::GridLayout
|
714
|
-
def initialize(num_columns)
|
715
|
-
super(nil)
|
716
|
-
@num_columns = num_columns
|
717
|
-
@row = 0
|
718
|
-
@col = 0
|
719
|
-
end
|
720
|
-
|
721
|
-
def addWidget(widget)
|
722
|
-
super(widget, @row, @col)
|
723
|
-
@col += 1 if @col < @num_columns
|
724
|
-
if @col == @num_columns
|
725
|
-
@row += 1
|
726
|
-
@col = 0
|
727
|
-
end
|
728
|
-
end
|
729
|
-
|
730
|
-
def addLayout(layout)
|
731
|
-
super(layout, @row, @col)
|
732
|
-
@col += 1 if @col < @num_columns
|
733
|
-
if @col == @num_columns
|
734
|
-
@row += 1
|
735
|
-
@col = 0
|
736
|
-
end
|
737
|
-
end
|
738
|
-
end
|
739
|
-
|
740
|
-
class Qt::AdaptiveGridLayout < Qt::GridLayout
|
741
|
-
def addWidget(widget)
|
742
|
-
case (count() + 1)
|
743
|
-
when 3 # reorder things to add a second column
|
744
|
-
old = takeAt(1)
|
745
|
-
addItem(old, 0, 1)
|
746
|
-
super(widget)
|
747
|
-
when 7 # reorder everything to add a third column
|
748
|
-
items = []
|
749
|
-
# Take the items in reverse order because taking an item changes the indexes
|
750
|
-
5.downto(2).each {|index| items << takeAt(index)}
|
751
|
-
# Reverse the items to get them back into insertion order
|
752
|
-
items.reverse!
|
753
|
-
addItem(items[0], 0, 2)
|
754
|
-
addItem(items[1], 1, 0)
|
755
|
-
addItem(items[2], 1, 1)
|
756
|
-
addItem(items[3], 1, 2)
|
757
|
-
super(widget)
|
758
|
-
# When we have established the desired number of rows we can add things and GridLayout does the right thing
|
759
|
-
else
|
760
|
-
super(widget)
|
761
|
-
end
|
762
|
-
end
|
763
|
-
# removeWidget is not implemented. If you want to remove widgets, transfer the existing to a new layout like so:
|
764
|
-
# (0...old_layout.count).each do |index|
|
765
|
-
# new_layout.addWidget(old_layout.takeAt(0).widget)
|
766
|
-
# end
|
767
|
-
end
|
768
|
-
|
769
|
-
# Implement removeAll on all the layout managers.
|
770
|
-
# It would be easier to add this method on Qt::Layout which is the parent class to all but
|
771
|
-
# that doesn't work due to the way method_missing is used to call the actual method
|
772
|
-
%w(GridLayout BoxLayout VBoxLayout HBoxLayout FormLayout StackedLayout).each do |klass|
|
773
|
-
"Qt::#{klass}".to_class.class_eval do
|
774
|
-
def removeAll
|
775
|
-
(0...count).each do |index|
|
776
|
-
item = takeAt(0)
|
777
|
-
if item.layout
|
778
|
-
item.removeAll
|
779
|
-
else
|
780
|
-
item.widget.dispose
|
781
|
-
end
|
782
|
-
end
|
783
|
-
end
|
784
|
-
end
|
785
|
-
end
|
786
|
-
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
|
11
|
+
# This file require QT for use by COSMOS. It exists to provide a location for
|
12
|
+
# adding workarounds should they be needed to work through problems with
|
13
|
+
# interacting with QT from Ruby.
|
14
|
+
|
15
|
+
require 'cosmos'
|
16
|
+
check_filename = File.join(Cosmos::USERPATH, "#{File.basename($0, File.extname($0))}_qt_check.txt")
|
17
|
+
qt_in_system_folder = false
|
18
|
+
|
19
|
+
# Check for Qt dlls in Window system folders
|
20
|
+
if Kernel.is_windows?
|
21
|
+
windir = ENV['SystemRoot']
|
22
|
+
if windir
|
23
|
+
# Check Windows system folders for existing Qt dll files
|
24
|
+
['system', 'SysWOW64', 'System32'].each do |folder|
|
25
|
+
break if qt_in_system_folder
|
26
|
+
['libgcc_s_dw2-1.dll',
|
27
|
+
'mingwm10.dll',
|
28
|
+
'phonon4.dll',
|
29
|
+
'Qt3Support4.dll',
|
30
|
+
'QtCLucene4.dll',
|
31
|
+
'QtCore4.dll',
|
32
|
+
'QtDeclarative4.dll',
|
33
|
+
'QtDesigner4.dll',
|
34
|
+
'QtDesignerComponents4.dll',
|
35
|
+
'QtGui4.dll',
|
36
|
+
'QtHelp4.dll',
|
37
|
+
'QtMultimedia4.dll',
|
38
|
+
'QtNetwork4.dll',
|
39
|
+
'QtOpenGL4.dll',
|
40
|
+
'QtScript4.dll',
|
41
|
+
'QtScriptTools4.dll',
|
42
|
+
'QtSql4.dll',
|
43
|
+
'QtSvg4.dll',
|
44
|
+
'QtTest4.dll',
|
45
|
+
'QtWebKit4.dll',
|
46
|
+
'QtXml4.dll',
|
47
|
+
'QtXmlPatterns4.dll'].each do |qtfilename|
|
48
|
+
break if qt_in_system_folder
|
49
|
+
filename = File.join(windir, folder, qtfilename)
|
50
|
+
if File.exist?(filename)
|
51
|
+
qt_in_system_folder = true
|
52
|
+
|
53
|
+
# Is this the first time we've detected this?
|
54
|
+
if File.exist?(check_filename)
|
55
|
+
# We tried before and failed
|
56
|
+
File.delete(check_filename)
|
57
|
+
|
58
|
+
if $0 =~ /Launcher/
|
59
|
+
require 'cosmos/win32/win32'
|
60
|
+
Cosmos::Win32.message_box("Found conflicting Qt dll file at: #{filename}\nPlease overwrite all Qt dlls in the Windows system folders with the newest Qt4 version (or delete them).")
|
61
|
+
end
|
62
|
+
raise "Found conflicting Qt dll file at: #{filename}. Please overwrite all Qt dlls in the Windows system folders with the newest Qt4 version (or delete them)."
|
63
|
+
else
|
64
|
+
# First Time we've detected this - We'll create it and risk just requiring Qt once
|
65
|
+
File.open(check_filename, 'w') {|file| file.write("Qt Dll Check In Progress")}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# This will either lock up or raise an error if older Qt dlls are present in the Windows system folders
|
74
|
+
require 'Qt'
|
75
|
+
File.delete(check_filename) if Kernel.is_windows? and File.exist?(check_filename)
|
76
|
+
|
77
|
+
module Cosmos
|
78
|
+
BIN_FILE_PATTERN = "Bin Files (*.bin);;All Files (*)"
|
79
|
+
TXT_FILE_PATTERN = "Txt Files (*.txt);;All Files (*)"
|
80
|
+
CSV_FILE_PATTERN = "Csv Files (*.csv);;All Files (*)"
|
81
|
+
CMD_FILE_PATTERN = "Cmd Log Files (*cmd*.bin);;Bin Files (*.bin);;All Files (*)"
|
82
|
+
TLM_FILE_PATTERN = "Tlm Log Files (*tlm*.bin);;Bin Files (*.bin);;All Files (*)"
|
83
|
+
COLORS = {}
|
84
|
+
BRUSHES = {}
|
85
|
+
PALETTES = {}
|
86
|
+
PENS = {}
|
87
|
+
FONTS = {}
|
88
|
+
FONT_METRICS = {}
|
89
|
+
CURSORS = {}
|
90
|
+
|
91
|
+
def self.getColor(color_r, color_g = nil, color_b = nil)
|
92
|
+
return color_r if (color_r.is_a? Qt::Color) || (color_r.is_a? Qt::Pen) || (color_r.is_a? Qt::LinearGradient)
|
93
|
+
|
94
|
+
color = nil
|
95
|
+
key = color_r
|
96
|
+
key = key.to_i if key.is_a? Qt::Enum
|
97
|
+
if color_r && color_g && color_b
|
98
|
+
key = (color_r.to_i << 24) + (color_g.to_i << 16) + (color_b.to_i << 8)
|
99
|
+
end
|
100
|
+
|
101
|
+
if Cosmos::COLORS[key]
|
102
|
+
color = Cosmos::COLORS[key]
|
103
|
+
else
|
104
|
+
if color_r && color_g && color_b
|
105
|
+
color = Qt::Color.new(color_r.to_i, color_g.to_i, color_b.to_i)
|
106
|
+
else
|
107
|
+
color = Qt::Color.new(color_r)
|
108
|
+
end
|
109
|
+
Cosmos::COLORS[key] = color
|
110
|
+
end
|
111
|
+
color
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.getBrush(color)
|
115
|
+
brush = nil
|
116
|
+
color = Cosmos.getColor(color)
|
117
|
+
brush = BRUSHES[color]
|
118
|
+
unless brush
|
119
|
+
if color.is_a? Qt::LinearGradient
|
120
|
+
brush = Qt::Brush.new(color)
|
121
|
+
else
|
122
|
+
brush = Qt::Brush.new(color, Qt::SolidPattern)
|
123
|
+
end
|
124
|
+
BRUSHES[color] = brush
|
125
|
+
end
|
126
|
+
brush
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.getPalette(foreground, background)
|
130
|
+
foreground = Cosmos.getColor(foreground)
|
131
|
+
background = Cosmos.getColor(background)
|
132
|
+
PALETTES[foreground] ||= {}
|
133
|
+
p = PALETTES[foreground][background]
|
134
|
+
unless p
|
135
|
+
p = Qt::Palette.new
|
136
|
+
p.setColor(Qt::Palette::Text, foreground)
|
137
|
+
p.setColor(Qt::Palette::Base, background)
|
138
|
+
p.setColor(Qt::Palette::Window, background)
|
139
|
+
PALETTES[foreground][background] = p
|
140
|
+
end
|
141
|
+
p
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.getPen(color = nil)
|
145
|
+
color = Cosmos.getColor(color) if color
|
146
|
+
pen = nil
|
147
|
+
pen = PENS[color]
|
148
|
+
unless pen
|
149
|
+
if color
|
150
|
+
pen = Qt::Pen.new(color)
|
151
|
+
else
|
152
|
+
pen = Qt::Pen.new
|
153
|
+
end
|
154
|
+
PENS[color] = pen
|
155
|
+
end
|
156
|
+
pen
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.getFont(font_face, font_size, font_attrs = nil, font_italics = false)
|
160
|
+
FONTS[font_face] ||= {}
|
161
|
+
FONTS[font_face][font_size] ||= {}
|
162
|
+
FONTS[font_face][font_size][font_attrs] ||= {}
|
163
|
+
font = FONTS[font_face][font_size][font_attrs][font_italics]
|
164
|
+
unless font
|
165
|
+
if font_attrs and font_italics
|
166
|
+
font = Qt::Font.new(font_face, font_size, font_attrs, font_italics)
|
167
|
+
else
|
168
|
+
font = Qt::Font.new(font_face, font_size)
|
169
|
+
end
|
170
|
+
FONTS[font_face][font_size][font_attrs][font_italics] = font
|
171
|
+
end
|
172
|
+
font
|
173
|
+
end
|
174
|
+
|
175
|
+
def self.getFontMetrics(font)
|
176
|
+
font_metrics = FONT_METRICS[font]
|
177
|
+
unless font_metrics
|
178
|
+
font_metrics = Qt::FontMetrics.new(font)
|
179
|
+
FONT_METRICS[font] = font_metrics
|
180
|
+
end
|
181
|
+
font_metrics
|
182
|
+
end
|
183
|
+
|
184
|
+
def self.getCursor(shape)
|
185
|
+
key = shape
|
186
|
+
key = shape.to_i if shape.is_a? Qt::Enum
|
187
|
+
cursor = CURSORS[key]
|
188
|
+
unless cursor
|
189
|
+
cursor = Qt::Cursor.new(shape)
|
190
|
+
CURSORS[key] = cursor
|
191
|
+
end
|
192
|
+
cursor
|
193
|
+
end
|
194
|
+
|
195
|
+
GREEN = getColor(0, 150, 0)
|
196
|
+
YELLOW = getColor(190, 135, 0)
|
197
|
+
RED = getColor(Qt::red)
|
198
|
+
BLUE = getColor(0, 100, 255)
|
199
|
+
PURPLE = getColor(200, 0, 200)
|
200
|
+
BLACK = getColor(Qt::black)
|
201
|
+
WHITE = getColor(Qt::white)
|
202
|
+
BLACK_NO_BRUSH = Qt::Brush.new(Cosmos::BLACK, Qt::NoBrush)
|
203
|
+
DEFAULT_PALETTE = Qt::Palette.new
|
204
|
+
RED_PALETTE = Qt::Palette.new(Qt::red)
|
205
|
+
DASHLINE_PEN = Qt::Pen.new(Qt::DashLine)
|
206
|
+
|
207
|
+
# Load the applications icon
|
208
|
+
def self.load_cosmos_icon(name='COSMOS_64x64.png')
|
209
|
+
icon = Cosmos.get_icon(name, false)
|
210
|
+
icon = Cosmos.get_icon('COSMOS_64x64.png', false) unless icon
|
211
|
+
Qt::Application.instance.setWindowIcon(icon) if icon
|
212
|
+
return icon
|
213
|
+
end
|
214
|
+
|
215
|
+
# Load the applications icon
|
216
|
+
def self.get_icon(name, fail_blank = true)
|
217
|
+
icon = nil
|
218
|
+
filename = File.join(::Cosmos::USERPATH, 'config', 'data', name)
|
219
|
+
begin
|
220
|
+
raise unless File.exist? filename
|
221
|
+
icon = Qt::Icon.new(filename)
|
222
|
+
raise if icon.isNull
|
223
|
+
rescue
|
224
|
+
begin
|
225
|
+
filename = File.join(::Cosmos::PATH, 'data', name)
|
226
|
+
raise unless File.exist? filename
|
227
|
+
icon = Qt::Icon.new(filename)
|
228
|
+
raise if icon.isNull
|
229
|
+
rescue
|
230
|
+
# Return a blank icon if we couldn't find an icon in either the user path or cosmos path
|
231
|
+
if fail_blank
|
232
|
+
icon = Qt::Icon.new
|
233
|
+
else
|
234
|
+
icon = nil
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
return icon
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
#### TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
243
|
+
class Qt::Application
|
244
|
+
def exec
|
245
|
+
begin
|
246
|
+
method_missing(:exec)
|
247
|
+
ensure
|
248
|
+
disable_threading()
|
249
|
+
self.dispose
|
250
|
+
Qt::Internal.application_terminated = true
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class Qt::CoreApplication
|
256
|
+
def exec
|
257
|
+
begin
|
258
|
+
method_missing(:exec)
|
259
|
+
ensure
|
260
|
+
disable_threading()
|
261
|
+
self.dispose
|
262
|
+
Qt::Internal.application_terminated = true
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
#### END TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
267
|
+
|
268
|
+
class Qt::Dialog
|
269
|
+
def initialize(parent = Qt::Application.activeWindow,
|
270
|
+
flags = (Qt::WindowTitleHint | Qt::WindowSystemMenuHint))
|
271
|
+
super(parent, flags)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
class Qt::TableWidget
|
276
|
+
# Resizes the table, turns off scroll bars, and sets the minimum and maximum sizes
|
277
|
+
# to the full size of the table with all the elements in view
|
278
|
+
def displayFullSize
|
279
|
+
resizeColumnsToContents()
|
280
|
+
resizeRowsToContents()
|
281
|
+
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
282
|
+
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
283
|
+
setMinimumSize(2*frameWidth() + horizontalHeader.length + verticalHeader.width,
|
284
|
+
2*frameWidth() + verticalHeader.length + horizontalHeader.height)
|
285
|
+
setMaximumSize(2*frameWidth() + horizontalHeader.length + verticalHeader.width,
|
286
|
+
2*frameWidth() + verticalHeader.length + horizontalHeader.height)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
class Qt::TableWidgetItem
|
291
|
+
def initialize(string = "")
|
292
|
+
super(string)
|
293
|
+
setFlags(Qt::ItemIsEnabled)
|
294
|
+
end
|
295
|
+
|
296
|
+
def textColor=(color)
|
297
|
+
setForeground(Cosmos.getBrush(color))
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
class Qt::TreeWidget
|
302
|
+
def initialize(parent = Qt::Application.activeWindow)
|
303
|
+
super(parent)
|
304
|
+
|
305
|
+
# Create a sensible default handler for clicking the checkboxes
|
306
|
+
# of a tree. If you check a node all the lower nodes get checked.
|
307
|
+
# If you uncheck a node all the lower nodes get unchecked.
|
308
|
+
# If you check a lower node all the parent nodes get checked.
|
309
|
+
connect(SIGNAL('itemClicked(QTreeWidgetItem*, int)')) do |node, col|
|
310
|
+
if node.checkState == Qt::Checked
|
311
|
+
# Set all nodes below this to checked
|
312
|
+
node.setCheckStateAll(Qt::Checked)
|
313
|
+
|
314
|
+
# Set all the nodes above this to checked
|
315
|
+
while node.parent
|
316
|
+
node = node.parent
|
317
|
+
node.setCheckState(0, Qt::Checked)
|
318
|
+
end
|
319
|
+
else
|
320
|
+
# Set all nodes below this to unchecked
|
321
|
+
node.setCheckStateAll(Qt::Unchecked)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
# Yields each of the top level items (those without a parent).
|
327
|
+
def topLevelItems
|
328
|
+
topLevelItemCount.times do |index|
|
329
|
+
yield topLevelItem(index)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
class Qt::TreeWidgetItem
|
335
|
+
# Sets the check state of this TreeWidgetItem as well as all its children
|
336
|
+
# recursively.
|
337
|
+
#
|
338
|
+
# @param state [Integer] Must be Qt::Checked or Qt::Unchecked
|
339
|
+
def setCheckStateAll(state = Qt::Checked)
|
340
|
+
children() do |child|
|
341
|
+
child.setCheckStateAll(state)
|
342
|
+
end
|
343
|
+
setCheckState(0, state)
|
344
|
+
end
|
345
|
+
|
346
|
+
# @return [Qt::TreeWidgetItem] The top level item for this TreeWidgetItem.
|
347
|
+
# The top level item does not have a parent. Note that this could return
|
348
|
+
# itself.
|
349
|
+
def topLevel
|
350
|
+
top = self
|
351
|
+
if !top.parent.nil?
|
352
|
+
while true
|
353
|
+
top = top.parent
|
354
|
+
break if top.parent.nil?
|
355
|
+
end
|
356
|
+
end
|
357
|
+
top
|
358
|
+
end
|
359
|
+
|
360
|
+
# Yields the children of the current node
|
361
|
+
def children
|
362
|
+
childCount.times do |index|
|
363
|
+
yield child(index)
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# Define the default column to be 0
|
368
|
+
def background(column = 0)
|
369
|
+
super(column)
|
370
|
+
end
|
371
|
+
def checkState(column = 0)
|
372
|
+
super(column)
|
373
|
+
end
|
374
|
+
def font(column = 0)
|
375
|
+
super(column)
|
376
|
+
end
|
377
|
+
def foreground(column = 0)
|
378
|
+
super(column)
|
379
|
+
end
|
380
|
+
def icon(column = 0)
|
381
|
+
super(column)
|
382
|
+
end
|
383
|
+
def statusTip(column = 0)
|
384
|
+
super(column)
|
385
|
+
end
|
386
|
+
def sizeHint(column = 0)
|
387
|
+
super(column)
|
388
|
+
end
|
389
|
+
def text(column = 0)
|
390
|
+
super(column)
|
391
|
+
end
|
392
|
+
def toolTip(column = 0)
|
393
|
+
super(column)
|
394
|
+
end
|
395
|
+
def whatsThis(column = 0)
|
396
|
+
super(column)
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
class Qt::TabWidget
|
401
|
+
def tab(index)
|
402
|
+
widget(index)
|
403
|
+
end
|
404
|
+
|
405
|
+
def widgets
|
406
|
+
all = []
|
407
|
+
(0...self.count()).each do |index|
|
408
|
+
all << self.widget(index)
|
409
|
+
end
|
410
|
+
all
|
411
|
+
end
|
412
|
+
alias :tabs :widgets
|
413
|
+
|
414
|
+
def currentWidget
|
415
|
+
self.widget(self.currentIndex)
|
416
|
+
end
|
417
|
+
alias :currentTab :currentWidget
|
418
|
+
end
|
419
|
+
|
420
|
+
class Qt::LineEdit
|
421
|
+
def setColors(foreground, background)
|
422
|
+
setPalette(Cosmos.getPalette(foreground, background))
|
423
|
+
end
|
424
|
+
|
425
|
+
def text=(value)
|
426
|
+
setText(value)
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
class Qt::PlainTextEdit
|
431
|
+
def add_formatted_text(text, color = nil)
|
432
|
+
if text =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
433
|
+
text.chomp!
|
434
|
+
text = text.inspect.remove_quotes
|
435
|
+
text << "\n"
|
436
|
+
end
|
437
|
+
if text =~ /<G>/ or color == Cosmos::GREEN
|
438
|
+
text.gsub!('<G>', '')
|
439
|
+
addText(text, Cosmos::GREEN)
|
440
|
+
elsif text =~ /<Y>/ or color == Cosmos::YELLOW
|
441
|
+
text.gsub!('<Y>', '')
|
442
|
+
addText(text, Cosmos::YELLOW)
|
443
|
+
elsif text =~ /<R>/ or color == Cosmos::RED
|
444
|
+
text.gsub!('<R>', '')
|
445
|
+
addText(text, Cosmos::RED)
|
446
|
+
elsif text =~ /<B>/ or color == Cosmos::BLUE
|
447
|
+
text.gsub!('<B>', '')
|
448
|
+
addText(text, Cosmos::BLUE)
|
449
|
+
else
|
450
|
+
addText(text) # default is Cosmos::BLACK
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
def addText(text, color = Cosmos::BLACK)
|
455
|
+
@current_text = "" if !defined? @current_text or @current_text.nil?
|
456
|
+
text = text.gsub("&", "&")
|
457
|
+
text.gsub!("\n", '')
|
458
|
+
text.gsub!(' ', ' ')
|
459
|
+
text.gsub!(">", ">")
|
460
|
+
text.gsub!("<", "<")
|
461
|
+
rgb_color = "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
462
|
+
@current_text +="<font color=\"#{rgb_color}\">#{text}</font><br/>"
|
463
|
+
end
|
464
|
+
|
465
|
+
def flush
|
466
|
+
appendHtml(@current_text)
|
467
|
+
@current_text = nil
|
468
|
+
end
|
469
|
+
|
470
|
+
def appendText(text, color = Cosmos::BLACK)
|
471
|
+
text = text.chomp
|
472
|
+
text.gsub!(/\n/, '<br/>') # replace newlines with html breaks
|
473
|
+
text.gsub!("&", "&")
|
474
|
+
text.gsub!(' ', ' ')
|
475
|
+
text.gsub!(">", ">")
|
476
|
+
text.gsub!("<", "<")
|
477
|
+
rgb_color = "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
478
|
+
appendHtml("<font color=\"#{rgb_color}\">#{text}</font>")
|
479
|
+
end
|
480
|
+
|
481
|
+
# Return the selected lines. If a partial line is selected the entire line will be returned.
|
482
|
+
# If there is no selection the line with the cursor will be returned
|
483
|
+
def selected_lines
|
484
|
+
cursor = textCursor
|
485
|
+
selection_end = cursor.selectionEnd
|
486
|
+
# Initially place the cursor at the beginning of the selection
|
487
|
+
# If nothing is selected this will just put the cursor at the beginning of the current line
|
488
|
+
cursor.setPosition(textCursor.selectionStart)
|
489
|
+
cursor.movePosition(Qt::TextCursor::StartOfLine)
|
490
|
+
# Move the cursor to the end of the selection while keeping the anchor
|
491
|
+
cursor.setPosition(selection_end, Qt::TextCursor::KeepAnchor)
|
492
|
+
# Normally we want to select the entire line where the end of selection is
|
493
|
+
# However if the user selects an exact number of lines
|
494
|
+
# the cursor will be at the beginning of the following line
|
495
|
+
# Therefore if the cursor is at the beginning of the line and we have a selection
|
496
|
+
# we'll skip moving to the end of the line
|
497
|
+
unless (cursor.atBlockStart and textCursor.hasSelection)
|
498
|
+
cursor.movePosition(Qt::TextCursor::EndOfLine, Qt::TextCursor::KeepAnchor)
|
499
|
+
end
|
500
|
+
# If there is no selection then just return nil
|
501
|
+
return nil if cursor.selectedText.nil?
|
502
|
+
|
503
|
+
cursor.selection.toPlainText
|
504
|
+
|
505
|
+
# The selectedText function returns the Unicode U+2029 paragraph separator character
|
506
|
+
# instead of newline \n. Thus we have to unpack as Unicode, covert to newlines, and then repack
|
507
|
+
#text = cursor.selectedText.unpack("U*")
|
508
|
+
#text.collect! {|letter| if letter == 63 then 10 else letter end }
|
509
|
+
#text.pack("U*")
|
510
|
+
end
|
511
|
+
|
512
|
+
# Return the line number (0 based) of the selection start
|
513
|
+
def selection_start_line
|
514
|
+
cursor = textCursor
|
515
|
+
cursor.setPosition(textCursor.selectionStart)
|
516
|
+
cursor.blockNumber
|
517
|
+
end
|
518
|
+
|
519
|
+
# Return the line number (0 based) of the selection end
|
520
|
+
def selection_end_line
|
521
|
+
cursor = textCursor
|
522
|
+
cursor.setPosition(textCursor.selectionEnd)
|
523
|
+
cursor.blockNumber
|
524
|
+
end
|
525
|
+
end
|
526
|
+
|
527
|
+
class Qt::TextEdit
|
528
|
+
def setColors(foreground, background)
|
529
|
+
setPalette(Cosmos.getPalette(foreground, background))
|
530
|
+
end
|
531
|
+
end
|
532
|
+
|
533
|
+
class Qt::ComboBox
|
534
|
+
# Helper method to remove all items from a ComboBox
|
535
|
+
def clearItems
|
536
|
+
(0...count).to_a.reverse.each do |index|
|
537
|
+
removeItem(index)
|
538
|
+
end
|
539
|
+
end
|
540
|
+
|
541
|
+
# Alias currentText as text to make it more compatible with LineEdit which uses text
|
542
|
+
def text
|
543
|
+
currentText
|
544
|
+
end
|
545
|
+
|
546
|
+
# Helper method to set the current item using a text String instead of the index
|
547
|
+
def setCurrentText(arg)
|
548
|
+
setCurrentIndex(findText(arg.to_s))
|
549
|
+
end
|
550
|
+
|
551
|
+
def each
|
552
|
+
(0...count).each do |index|
|
553
|
+
yield self.itemText(index), self.itemData(index)
|
554
|
+
end
|
555
|
+
end
|
556
|
+
end
|
557
|
+
|
558
|
+
class Qt::ListWidget
|
559
|
+
# Helper method to remove all items from a ListWidget
|
560
|
+
def clearItems
|
561
|
+
(0...count).each do
|
562
|
+
takeItem(0).dispose
|
563
|
+
end
|
564
|
+
end
|
565
|
+
|
566
|
+
def each
|
567
|
+
(0...count).each do |index|
|
568
|
+
yield self.item(index)
|
569
|
+
end
|
570
|
+
end
|
571
|
+
|
572
|
+
def remove_selected_items
|
573
|
+
# Take the selected items and call row on each to get an array of the item indexes
|
574
|
+
# Sort that array because selectedItems is returned in the order selected, not numerical order
|
575
|
+
# Reverse this array of indices so we remove the last item first,
|
576
|
+
# this allows all the indexes to remain constant
|
577
|
+
# Call takeItem of each of the indices and then dispose the resulting ListWidgetItem that is returned
|
578
|
+
selectedItems.map {|x| row(x)}.sort.reverse.each { |index| takeItem(index).dispose }
|
579
|
+
end
|
580
|
+
end
|
581
|
+
|
582
|
+
# This class attempts to duplicate Fox's FXColorList
|
583
|
+
# by adding a colored icon to each item in the ListWidget
|
584
|
+
class Qt::ColorListWidget < Qt::ListWidget
|
585
|
+
attr_reader :original_parent
|
586
|
+
|
587
|
+
def initialize(parent, enable_key_delete = true)
|
588
|
+
super(parent)
|
589
|
+
# When a layout adds this widget it automatically gets re-parented so
|
590
|
+
# store the original parent in case someone needs it
|
591
|
+
@original_parent = parent
|
592
|
+
@enable_key_delete = enable_key_delete
|
593
|
+
@colors = []
|
594
|
+
@maps = []
|
595
|
+
@icons = []
|
596
|
+
setUniformItemSizes(true)
|
597
|
+
end
|
598
|
+
|
599
|
+
def resize_to_contents
|
600
|
+
return if count == 0
|
601
|
+
#setResizeMode(Qt::ListView::Adjust)
|
602
|
+
# Disable the vertical scrollbar and don't display it
|
603
|
+
verticalScrollBar.setDisabled(true)
|
604
|
+
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
605
|
+
# Get the height of an item and multiply by the number of items
|
606
|
+
setFixedHeight(visualItemRect(item(0)).height * (count + 1))
|
607
|
+
end
|
608
|
+
|
609
|
+
def set_read_only
|
610
|
+
setSelectionMode(Qt::AbstractItemView::NoSelection)
|
611
|
+
filter = Qt::Object.new
|
612
|
+
filter.define_singleton_method(:eventFilter) do |obj, event|
|
613
|
+
if event.type == Qt::Event::KeyPress &&
|
614
|
+
(event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
615
|
+
return true
|
616
|
+
end
|
617
|
+
return false
|
618
|
+
end
|
619
|
+
installEventFilter(filter)
|
620
|
+
end
|
621
|
+
|
622
|
+
def keyPressEvent(event)
|
623
|
+
if @enable_key_delete
|
624
|
+
if (event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
625
|
+
takeItemColor(currentRow)
|
626
|
+
end
|
627
|
+
end
|
628
|
+
super(event)
|
629
|
+
end
|
630
|
+
|
631
|
+
def addItemColor(text, color = Cosmos::BLACK)
|
632
|
+
@colors << color
|
633
|
+
@maps << Qt::Pixmap.new(20,14)
|
634
|
+
color = Cosmos::getColor(color)
|
635
|
+
@maps[-1].fill(color)
|
636
|
+
icon = Qt::Icon.new
|
637
|
+
icon.addPixmap(@maps[-1], Qt::Icon::Normal)
|
638
|
+
icon.addPixmap(@maps[-1], Qt::Icon::Selected)
|
639
|
+
@icons << icon
|
640
|
+
item = Qt::ListWidgetItem.new(@icons[-1], text.to_s)
|
641
|
+
addItem(item)
|
642
|
+
end
|
643
|
+
|
644
|
+
def getItemColor(index)
|
645
|
+
@colors[index]
|
646
|
+
end
|
647
|
+
|
648
|
+
def takeItemColor(row)
|
649
|
+
item = takeItem(row)
|
650
|
+
if item
|
651
|
+
@colors.delete_at(row)
|
652
|
+
@maps.delete_at(row).dispose
|
653
|
+
@icons.delete_at(row).dispose
|
654
|
+
item.dispose
|
655
|
+
end
|
656
|
+
end
|
657
|
+
|
658
|
+
def clearItems
|
659
|
+
(0...count).each do
|
660
|
+
takeItemColor(0)
|
661
|
+
end
|
662
|
+
end
|
663
|
+
|
664
|
+
def dispose
|
665
|
+
super()
|
666
|
+
@maps.each {|map| map.dispose}
|
667
|
+
@icons.each {|icon| icon.dispose}
|
668
|
+
end
|
669
|
+
end
|
670
|
+
|
671
|
+
class Qt::Painter
|
672
|
+
def addLineColor(x, y, w, h, color = Cosmos::BLACK)
|
673
|
+
color = Cosmos::getColor(color)
|
674
|
+
setPen(color)
|
675
|
+
drawLine(x,y,w,h)
|
676
|
+
end
|
677
|
+
|
678
|
+
def addRectColor(x, y, w, h, color = Cosmos::BLACK)
|
679
|
+
color = Cosmos::getColor(color)
|
680
|
+
setPen(color)
|
681
|
+
setBrush(nil)
|
682
|
+
drawRect(x,y,w,h)
|
683
|
+
end
|
684
|
+
|
685
|
+
def addRectColorFill(x, y, w, h, color = Cosmos::BLACK)
|
686
|
+
color = Cosmos::getColor(color)
|
687
|
+
setPen(color)
|
688
|
+
setBrush(Cosmos.getBrush(color))
|
689
|
+
drawRect(x,y,w,h)
|
690
|
+
end
|
691
|
+
|
692
|
+
def addSimpleTextAt(text, x, y, color = Cosmos::BLACK)
|
693
|
+
color = Cosmos::getColor(color)
|
694
|
+
setPen(color)
|
695
|
+
drawText(x, y, text)
|
696
|
+
end
|
697
|
+
|
698
|
+
def addEllipseColor(x, y, w, h, color = Cosmos::BLACK)
|
699
|
+
color = Cosmos::getColor(color)
|
700
|
+
setPen(color)
|
701
|
+
setBrush(nil)
|
702
|
+
drawEllipse(x,y,w,h)
|
703
|
+
end
|
704
|
+
|
705
|
+
def addEllipseColorFill(x, y, w, h, color = Cosmos::BLACK)
|
706
|
+
color = Cosmos::getColor(color)
|
707
|
+
setPen(color)
|
708
|
+
setBrush(Cosmos.getBrush(color))
|
709
|
+
drawEllipse(x,y,w,h)
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
class Qt::MatrixLayout < Qt::GridLayout
|
714
|
+
def initialize(num_columns)
|
715
|
+
super(nil)
|
716
|
+
@num_columns = num_columns
|
717
|
+
@row = 0
|
718
|
+
@col = 0
|
719
|
+
end
|
720
|
+
|
721
|
+
def addWidget(widget)
|
722
|
+
super(widget, @row, @col)
|
723
|
+
@col += 1 if @col < @num_columns
|
724
|
+
if @col == @num_columns
|
725
|
+
@row += 1
|
726
|
+
@col = 0
|
727
|
+
end
|
728
|
+
end
|
729
|
+
|
730
|
+
def addLayout(layout)
|
731
|
+
super(layout, @row, @col)
|
732
|
+
@col += 1 if @col < @num_columns
|
733
|
+
if @col == @num_columns
|
734
|
+
@row += 1
|
735
|
+
@col = 0
|
736
|
+
end
|
737
|
+
end
|
738
|
+
end
|
739
|
+
|
740
|
+
class Qt::AdaptiveGridLayout < Qt::GridLayout
|
741
|
+
def addWidget(widget)
|
742
|
+
case (count() + 1)
|
743
|
+
when 3 # reorder things to add a second column
|
744
|
+
old = takeAt(1)
|
745
|
+
addItem(old, 0, 1)
|
746
|
+
super(widget)
|
747
|
+
when 7 # reorder everything to add a third column
|
748
|
+
items = []
|
749
|
+
# Take the items in reverse order because taking an item changes the indexes
|
750
|
+
5.downto(2).each {|index| items << takeAt(index)}
|
751
|
+
# Reverse the items to get them back into insertion order
|
752
|
+
items.reverse!
|
753
|
+
addItem(items[0], 0, 2)
|
754
|
+
addItem(items[1], 1, 0)
|
755
|
+
addItem(items[2], 1, 1)
|
756
|
+
addItem(items[3], 1, 2)
|
757
|
+
super(widget)
|
758
|
+
# When we have established the desired number of rows we can add things and GridLayout does the right thing
|
759
|
+
else
|
760
|
+
super(widget)
|
761
|
+
end
|
762
|
+
end
|
763
|
+
# removeWidget is not implemented. If you want to remove widgets, transfer the existing to a new layout like so:
|
764
|
+
# (0...old_layout.count).each do |index|
|
765
|
+
# new_layout.addWidget(old_layout.takeAt(0).widget)
|
766
|
+
# end
|
767
|
+
end
|
768
|
+
|
769
|
+
# Implement removeAll on all the layout managers.
|
770
|
+
# It would be easier to add this method on Qt::Layout which is the parent class to all but
|
771
|
+
# that doesn't work due to the way method_missing is used to call the actual method
|
772
|
+
%w(GridLayout BoxLayout VBoxLayout HBoxLayout FormLayout StackedLayout).each do |klass|
|
773
|
+
"Qt::#{klass}".to_class.class_eval do
|
774
|
+
def removeAll
|
775
|
+
(0...count).each do |index|
|
776
|
+
item = takeAt(0)
|
777
|
+
if item.layout
|
778
|
+
item.removeAll
|
779
|
+
else
|
780
|
+
item.widget.dispose
|
781
|
+
end
|
782
|
+
end
|
783
|
+
end
|
784
|
+
end
|
785
|
+
end
|
786
|
+
|
787
|
+
class Qt::BoxLayout
|
788
|
+
def initialize(*args)
|
789
|
+
super(*args)
|
790
|
+
setSpacing(5) if Kernel.is_mac?
|
791
|
+
end
|
792
|
+
end
|
793
|
+
|
794
|
+
class Qt::VBoxLayout
|
795
|
+
def initialize(*args)
|
796
|
+
super(*args)
|
797
|
+
setSpacing(5) if Kernel.is_mac?
|
798
|
+
end
|
799
|
+
end
|
800
|
+
|
801
|
+
class Qt::HBoxLayout
|
802
|
+
def initialize(*args)
|
803
|
+
super(*args)
|
804
|
+
setSpacing(5) if Kernel.is_mac?
|
805
|
+
end
|
806
|
+
end
|
807
|
+
|
808
|
+
class Qt::GridLayout
|
809
|
+
def initialize(*args)
|
810
|
+
super(*args)
|
811
|
+
setSpacing(5) if Kernel.is_mac?
|
812
|
+
end
|
813
|
+
end
|