cosmos 3.5.1 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/.gitattributes +3 -3
- data/.gitignore +48 -48
- data/.travis.yml +8 -8
- data/CONTRIBUTING.txt +50 -50
- data/Gemfile +10 -10
- data/Guardfile +27 -27
- data/LICENSE.txt +879 -879
- data/Manifest.txt +1414 -1414
- data/README.md +111 -111
- data/Rakefile +218 -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 +270 -270
- 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 -305
- 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_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 +24 -24
- 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/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/TestRunnerAHK5 +17 -17
- data/autohotkey/tools/TestRunnerAHK6 +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 +22 -22
- data/autohotkey/tools/TlmViewerAHK3 +23 -23
- data/autohotkey/tools/TlmViewerAHK4 +22 -22
- data/autohotkey/tools/TlmViewerAHK5 +18 -18
- data/autohotkey/tools/autohotkey.rb +37 -37
- data/autohotkey/tools/cmd_extractor.ahk +33 -33
- data/autohotkey/tools/cmd_sender.ahk +182 -182
- data/autohotkey/tools/cmd_tlm_server.ahk +90 -90
- data/autohotkey/tools/cmd_tlm_server2.ahk +45 -45
- data/autohotkey/tools/data_viewer.ahk +141 -141
- data/autohotkey/tools/handbook_creator.ahk +32 -32
- data/autohotkey/tools/launcher.ahk +41 -41
- data/autohotkey/tools/limits_monitor.ahk +123 -123
- data/autohotkey/tools/open_gl_builder.ahk +134 -134
- data/autohotkey/tools/packet_viewer.ahk +196 -196
- data/autohotkey/tools/packet_viewer2.ahk +9 -9
- data/autohotkey/tools/replay.ahk +104 -104
- data/autohotkey/tools/script_runner.ahk +589 -589
- data/autohotkey/tools/script_runner2.ahk +38 -38
- data/autohotkey/tools/table_manager.ahk +220 -220
- data/autohotkey/tools/test_runner.ahk +262 -262
- data/autohotkey/tools/test_runner2.ahk +53 -53
- data/autohotkey/tools/test_runner3.ahk +13 -13
- data/autohotkey/tools/test_runner5.ahk +8 -8
- data/autohotkey/tools/test_runner6.ahk +5 -5
- data/autohotkey/tools/tlm_extractor.ahk +296 -296
- data/autohotkey/tools/tlm_grapher.ahk +660 -660
- 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 -50
- 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 +99 -99
- data/data/about.txt +4 -4
- data/data/crc.txt +326 -326
- data/data/diamond.STL +57 -57
- data/data/legal.txt +9 -9
- data/demo/Gemfile +10 -10
- data/demo/Launcher +16 -16
- data/demo/Launcher.bat +0 -0
- data/demo/Rakefile +77 -77
- data/demo/config/data/crc.txt +224 -226
- data/demo/config/data/diamond.STL +57 -57
- data/demo/config/data/meta_init.txt +4 -4
- data/demo/config/system/system.txt +35 -35
- 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 +5 -5
- 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 -305
- 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 -13
- 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 +56 -56
- data/demo/config/targets/TEMPLATED/target.txt +6 -6
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +39 -39
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +34 -34
- 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 +88 -88
- 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 +82 -82
- 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 -57
- data/demo/lib/example_target.rb +113 -113
- 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 +183 -183
- 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 +16 -16
- data/demo/tools/CmdExtractor.bat +0 -0
- data/demo/tools/CmdSender +16 -16
- data/demo/tools/CmdSender.bat +0 -0
- data/demo/tools/CmdTlmServer +16 -16
- data/demo/tools/CmdTlmServer.bat +0 -0
- data/demo/tools/DataViewer +16 -16
- data/demo/tools/DataViewer.bat +0 -0
- data/demo/tools/ExampleTarget +16 -16
- data/demo/tools/ExampleTarget.bat +0 -0
- data/demo/tools/HandbookCreator +16 -16
- data/demo/tools/HandbookCreator.bat +0 -0
- data/demo/tools/Launcher +16 -16
- data/demo/tools/Launcher.bat +0 -0
- data/demo/tools/LimitsMonitor +16 -16
- data/demo/tools/LimitsMonitor.bat +0 -0
- data/demo/tools/OpenGLBuilder +16 -16
- data/demo/tools/OpenGLBuilder.bat +0 -0
- data/demo/tools/PacketViewer +16 -16
- data/demo/tools/PacketViewer.bat +0 -0
- data/demo/tools/Replay +16 -16
- data/demo/tools/Replay.bat +0 -0
- data/demo/tools/ScpiTarget +16 -16
- data/demo/tools/ScpiTarget.bat +0 -0
- data/demo/tools/ScriptRunner +16 -16
- data/demo/tools/ScriptRunner.bat +0 -0
- data/demo/tools/TableManager +16 -16
- data/demo/tools/TableManager.bat +0 -0
- data/demo/tools/TestRunner +16 -16
- data/demo/tools/TestRunner.bat +0 -0
- data/demo/tools/TlmExtractor +16 -16
- data/demo/tools/TlmExtractor.bat +0 -0
- data/demo/tools/TlmGrapher +16 -16
- data/demo/tools/TlmGrapher.bat +0 -0
- data/demo/tools/TlmViewer +16 -16
- data/demo/tools/TlmViewer.bat +0 -0
- data/demo/tools/ToolLaunch.bat +14 -5
- data/demo/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +16 -16
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +16 -16
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +16 -16
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +16 -16
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +16 -16
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +16 -16
- data/demo/tools/mac/Launcher.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +16 -16
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +16 -16
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +16 -16
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Replay.app/Contents/MacOS/Replay.rb +16 -16
- data/demo/tools/mac/Replay.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/Replay.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +16 -16
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +16 -16
- data/demo/tools/mac/TableManager.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TableManager.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +16 -16
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +16 -16
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +16 -16
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +16 -16
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/tool_launch.rb +38 -38
- 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 +265 -265
- 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 +101 -101
- 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 +1428 -1428
- 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 +307 -307
- data/ext/mkrf_conf.rb +40 -40
- data/install/Gemfile +10 -10
- data/install/Launcher +16 -16
- data/install/Launcher.bat +0 -0
- data/install/Rakefile +77 -77
- data/install/config/data/crc.txt +151 -151
- 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 +40 -40
- 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 +16 -16
- data/install/tools/CmdExtractor.bat +0 -0
- data/install/tools/CmdSender +16 -16
- data/install/tools/CmdSender.bat +0 -0
- data/install/tools/CmdTlmServer +16 -16
- data/install/tools/CmdTlmServer.bat +0 -0
- data/install/tools/DataViewer +16 -16
- data/install/tools/DataViewer.bat +0 -0
- data/install/tools/HandbookCreator +16 -16
- data/install/tools/HandbookCreator.bat +0 -0
- data/install/tools/Launcher +16 -16
- data/install/tools/Launcher.bat +0 -0
- data/install/tools/LimitsMonitor +16 -16
- data/install/tools/LimitsMonitor.bat +0 -0
- data/install/tools/OpenGLBuilder +16 -16
- data/install/tools/OpenGLBuilder.bat +0 -0
- data/install/tools/PacketViewer +16 -16
- data/install/tools/PacketViewer.bat +0 -0
- data/install/tools/Replay +16 -16
- data/install/tools/Replay.bat +0 -0
- data/install/tools/ScriptRunner +16 -16
- data/install/tools/ScriptRunner.bat +0 -0
- data/install/tools/TableManager +16 -16
- data/install/tools/TableManager.bat +0 -0
- data/install/tools/TestRunner +16 -16
- data/install/tools/TestRunner.bat +0 -0
- data/install/tools/TlmExtractor +16 -16
- data/install/tools/TlmExtractor.bat +0 -0
- data/install/tools/TlmGrapher +16 -16
- data/install/tools/TlmGrapher.bat +0 -0
- data/install/tools/TlmViewer +16 -16
- data/install/tools/TlmViewer.bat +0 -0
- data/install/tools/ToolLaunch.bat +14 -5
- data/install/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +16 -16
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +16 -16
- data/install/tools/mac/CmdSender.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/CmdSender.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +16 -16
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +16 -16
- data/install/tools/mac/DataViewer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/DataViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +16 -16
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +16 -16
- data/install/tools/mac/Launcher.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +16 -16
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +16 -16
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +16 -16
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Replay.app/Contents/MacOS/Replay.rb +16 -16
- data/install/tools/mac/Replay.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/Replay.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +16 -16
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +16 -16
- data/install/tools/mac/TableManager.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TableManager.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +16 -16
- data/install/tools/mac/TestRunner.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TestRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +16 -16
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +16 -16
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +16 -16
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/tool_launch.rb +38 -38
- 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 +311 -311
- data/lib/cosmos/core_ext/stringio.rb +24 -24
- data/lib/cosmos/core_ext/time.rb +448 -448
- 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 +326 -326
- data/lib/cosmos/gui/dialogs/about_dialog.rb +137 -137
- 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 +260 -260
- data/lib/cosmos/gui/dialogs/legal_dialog.rb +169 -169
- data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +118 -118
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +276 -276
- data/lib/cosmos/gui/dialogs/pry_dialog.rb +165 -165
- 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 +135 -135
- 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 +473 -473
- data/lib/cosmos/gui/line_graph/line_graph_popups.rb +116 -116
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +451 -451
- 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 +469 -469
- 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 -724
- 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 +860 -860
- data/lib/cosmos/gui/qt_tool.rb +380 -380
- 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 +415 -415
- data/lib/cosmos/gui/utilities/screenshot.rb +25 -25
- data/lib/cosmos/gui/utilities/script_module_gui.rb +330 -330
- 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 -153
- data/lib/cosmos/interfaces/interface.rb +225 -225
- 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 -129
- data/lib/cosmos/interfaces/stream_interface.rb +136 -136
- data/lib/cosmos/interfaces/tcpip_client_interface.rb +60 -60
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +164 -164
- data/lib/cosmos/interfaces/udp_interface.rb +161 -161
- 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 +376 -376
- data/lib/cosmos/io/json_drb_object.rb +198 -198
- 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 +571 -571
- data/lib/cosmos/io/udp_sockets.rb +152 -152
- data/lib/cosmos/io/win32_serial_driver.rb +145 -145
- data/lib/cosmos/packet_logs.rb +7 -7
- data/lib/cosmos/packet_logs/ccsds_log_reader.rb +104 -104
- data/lib/cosmos/packet_logs/meta_packet_log_writer.rb +107 -107
- data/lib/cosmos/packet_logs/packet_log_reader.rb +450 -450
- data/lib/cosmos/packet_logs/packet_log_writer.rb +323 -323
- data/lib/cosmos/packet_logs/packet_log_writer_pair.rb +30 -30
- data/lib/cosmos/packets/binary_accessor.rb +634 -634
- data/lib/cosmos/packets/commands.rb +293 -293
- data/lib/cosmos/packets/limits.rb +267 -267
- data/lib/cosmos/packets/limits_response.rb +38 -38
- data/lib/cosmos/packets/packet.rb +786 -786
- data/lib/cosmos/packets/packet_config.rb +482 -482
- data/lib/cosmos/packets/packet_item.rb +317 -317
- data/lib/cosmos/packets/packet_item_limits.rb +128 -128
- data/lib/cosmos/packets/parsers/format_string_parser.rb +58 -58
- data/lib/cosmos/packets/parsers/limits_parser.rb +146 -146
- data/lib/cosmos/packets/parsers/limits_response_parser.rb +52 -52
- data/lib/cosmos/packets/parsers/macro_parser.rb +116 -116
- data/lib/cosmos/packets/parsers/packet_item_parser.rb +215 -215
- data/lib/cosmos/packets/parsers/packet_parser.rb +123 -123
- data/lib/cosmos/packets/parsers/processor_parser.rb +63 -63
- data/lib/cosmos/packets/parsers/state_parser.rb +116 -116
- data/lib/cosmos/packets/structure.rb +458 -458
- data/lib/cosmos/packets/structure_item.rb +233 -233
- data/lib/cosmos/packets/telemetry.rb +350 -350
- 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/cmd_tlm_server.rb +110 -110
- data/lib/cosmos/script/commands.rb +184 -184
- data/lib/cosmos/script/extract.rb +123 -123
- data/lib/cosmos/script/limits.rb +114 -114
- data/lib/cosmos/script/script.rb +76 -76
- data/lib/cosmos/script/scripting.rb +897 -897
- data/lib/cosmos/script/telemetry.rb +174 -174
- data/lib/cosmos/script/tools.rb +138 -138
- 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 +157 -157
- data/lib/cosmos/streams/stream.rb +63 -63
- data/lib/cosmos/streams/stream_protocol.rb +373 -373
- data/lib/cosmos/streams/tcpip_client_stream.rb +113 -113
- data/lib/cosmos/streams/tcpip_socket_stream.rb +143 -143
- 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 +618 -618
- data/lib/cosmos/system/target.rb +197 -197
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +255 -255
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +717 -717
- 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 +1034 -1034
- data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +46 -46
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +67 -67
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +515 -515
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +253 -253
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +408 -408
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +112 -112
- data/lib/cosmos/tools/cmd_tlm_server/connections.rb +175 -175
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +200 -200
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +176 -176
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +150 -150
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +244 -244
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +90 -90
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +266 -266
- 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 +621 -621
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +134 -134
- data/lib/cosmos/tools/data_viewer/dump_component.rb +40 -40
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +156 -156
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +382 -382
- data/lib/cosmos/tools/launcher/launcher.rb +188 -188
- data/lib/cosmos/tools/launcher/launcher_config.rb +256 -256
- data/lib/cosmos/tools/launcher/launcher_multitool.rb +40 -40
- data/lib/cosmos/tools/launcher/launcher_tool.rb +116 -116
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +837 -837
- 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 +542 -542
- data/lib/cosmos/tools/replay/replay.rb +501 -501
- data/lib/cosmos/tools/replay/replay_server.rb +91 -91
- data/lib/cosmos/tools/script_runner/script_audit.rb +147 -147
- data/lib/cosmos/tools/script_runner/script_runner.rb +922 -922
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +40 -40
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +1798 -1798
- 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 +539 -539
- data/lib/cosmos/tools/test_runner/test_runner.rb +1189 -1189
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +341 -341
- data/lib/cosmos/tools/tlm_extractor/text_item_chooser.rb +60 -60
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +1016 -1016
- 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 +95 -95
- 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 +181 -181
- 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 +174 -174
- data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +193 -193
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +407 -407
- 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 -323
- 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 +1291 -1291
- 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 +114 -114
- 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 +78 -78
- 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 -486
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +561 -561
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +290 -290
- 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 +66 -66
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +57 -57
- 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 +759 -759
- data/lib/cosmos/utilities.rb +11 -11
- 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 +79 -79
- 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 -44
- 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 +321 -321
- data/roodi.yml +24 -24
- data/run_gui_tests.bat +0 -0
- 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 +202 -202
- data/spec/gui/line_graph/line_clip_spec.rb +322 -322
- data/spec/gui/qt_spec.rb +102 -102
- 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 -305
- 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 -130
- data/spec/interfaces/linc_interface_spec.rb +259 -259
- 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 +55 -55
- data/spec/interfaces/tcpip_server_interface_spec.rb +160 -160
- data/spec/interfaces/udp_interface_spec.rb +175 -175
- 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 +119 -119
- 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 +60 -60
- 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 +468 -468
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +30 -30
- data/spec/packet_logs/packet_log_writer_spec.rb +225 -225
- data/spec/packets/binary_accessor_spec.rb +2326 -2326
- data/spec/packets/commands_spec.rb +369 -369
- data/spec/packets/limits_response_spec.rb +25 -25
- data/spec/packets/limits_spec.rb +344 -344
- data/spec/packets/packet_config_spec.rb +805 -805
- 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 +1317 -1317
- data/spec/packets/parsers/format_string_parser_spec.rb +122 -122
- data/spec/packets/parsers/limits_parser_spec.rb +282 -282
- data/spec/packets/parsers/limits_response_parser_spec.rb +149 -149
- data/spec/packets/parsers/macro_parser_spec.rb +212 -212
- data/spec/packets/parsers/packet_item_parser_spec.rb +306 -306
- data/spec/packets/parsers/packet_parser_spec.rb +99 -99
- data/spec/packets/parsers/processor_parser_spec.rb +114 -114
- data/spec/packets/parsers/state_parser_spec.rb +156 -156
- data/spec/packets/structure_item_spec.rb +195 -195
- data/spec/packets/structure_spec.rb +565 -565
- data/spec/packets/telemetry_spec.rb +578 -578
- 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/cmd_tlm_server_spec.rb +110 -110
- data/spec/script/commands_disconnect_spec.rb +270 -270
- data/spec/script/commands_spec.rb +302 -302
- data/spec/script/limits_spec.rb +153 -153
- data/spec/script/script_spec.rb +86 -86
- data/spec/script/scripting_spec.rb +440 -440
- data/spec/script/telemetry_spec.rb +165 -165
- data/spec/script/tools_spec.rb +117 -117
- data/spec/spec_helper.rb +190 -190
- data/spec/streams/burst_stream_protocol_spec.rb +32 -32
- data/spec/streams/fixed_stream_protocol_spec.rb +113 -113
- data/spec/streams/length_stream_protocol_spec.rb +300 -300
- data/spec/streams/preidentified_stream_protocol_spec.rb +121 -121
- data/spec/streams/serial_stream_spec.rb +117 -117
- data/spec/streams/stream_protocol_spec.rb +346 -346
- data/spec/streams/stream_spec.rb +30 -30
- data/spec/streams/tcpip_client_stream_spec.rb +57 -57
- data/spec/streams/tcpip_socket_stream_spec.rb +193 -193
- data/spec/streams/template_stream_protocol_spec.rb +156 -156
- data/spec/streams/terminated_stream_protocol_spec.rb +127 -127
- data/spec/system/system_spec.rb +665 -665
- data/spec/system/target_spec.rb +250 -250
- data/spec/tools/cmd_tlm_server/api_spec.rb +1117 -1117
- 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 +453 -453
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +415 -415
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +151 -151
- data/spec/tools/cmd_tlm_server/connections_spec.rb +235 -235
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +306 -306
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +252 -252
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +143 -143
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +151 -151
- data/spec/tools/cmd_tlm_server/routers_spec.rb +223 -223
- data/spec/tools/launcher/launcher_config_spec.rb +464 -464
- data/spec/top_level/top_level_spec.rb +334 -334
- 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
- data/test/benchmarks/binary_accessor_benchmark.rb +14 -14
- data/test/benchmarks/gsub_benchmark.rb +152 -152
- data/test/benchmarks/is_a_benchmark.rb +34 -34
- data/test/performance/PACKETS.bat +0 -0
- data/test/performance/Rakefile +77 -77
- data/test/performance/THREADS.bat +0 -0
- data/test/performance/config/data/crc.txt +196 -196
- data/test/performance/config/data/diamond.STL +57 -57
- data/test/performance/config/data/meta_init.txt +4 -4
- data/test/performance/config/system/system_packets.txt +39 -39
- data/test/performance/config/system/system_threads.txt +59 -59
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +46 -46
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/test/performance/config/targets/COSMOS/screens/version.txt +19 -19
- data/test/performance/config/targets/COSMOS/target.txt +11 -11
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_cmds.txt +20 -20
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_tlm.txt +98 -98
- data/test/performance/config/targets/PACKET/cmd_tlm_server.txt +6 -6
- data/test/performance/config/targets/PACKET/lib/packet_interface.rb +22 -22
- data/test/performance/config/targets/PACKET/lib/packet_limits_response.rb +24 -24
- data/test/performance/config/targets/PACKET/screens/status.txt +25 -25
- data/test/performance/config/targets/PACKET/target.txt +28 -28
- data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -12
- data/test/performance/config/targets/THREAD/cmd_tlm/thread_cmds.txt +17 -17
- data/test/performance/config/targets/THREAD/cmd_tlm/thread_tlm.txt +18 -18
- data/test/performance/config/targets/THREAD/cmd_tlm_server.txt +6 -6
- data/test/performance/config/targets/THREAD/lib/thread_interface.rb +22 -22
- data/test/performance/config/targets/THREAD/screens/status.txt +25 -25
- data/test/performance/config/targets/THREAD/target.txt +6 -6
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +28 -28
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -68
- data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -11
- data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -66
- data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/test/performance/config/tools/launcher/launcher_packets.txt +34 -34
- data/test/performance/config/tools/launcher/launcher_threads.txt +83 -83
- data/test/performance/config/tools/script_runner/script_runner.txt +3 -3
- data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -8
- data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -24
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -25
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -25
- data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -8
- data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -248
- data/test/performance/config/tools/test_runner/test_runner.txt +17 -17
- data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
- data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -2
- data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -2
- data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -2
- data/test/performance/config/tools/tlm_grapher/tlm_grapher.txt +204 -204
- data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +13 -13
- data/test/performance/lib/packet_target.rb +126 -126
- data/test/performance/lib/thread_target.rb +120 -120
- data/test/performance/lib/user_version.rb +3 -3
- data/test/performance/procedures/checks.rb +11 -11
- data/test/performance/procedures/clear_util.rb +7 -7
- data/test/performance/procedures/collect.rb +18 -18
- data/test/performance/procedures/collect_util.rb +14 -14
- data/test/performance/procedures/cosmos_api_test.rb +293 -293
- data/test/performance/procedures/disconnect.rb +29 -29
- data/test/performance/procedures/example_test.rb +182 -182
- data/test/performance/procedures/plot_test.rb +8 -8
- data/test/performance/procedures/procedure.rb +2 -2
- data/test/performance/procedures/run_example_test.rb +3 -3
- data/test/performance/procedures/test.rb +51 -51
- data/test/performance/tools/CmdExtractor +14 -14
- data/test/performance/tools/CmdExtractor.bat +0 -0
- data/test/performance/tools/CmdSender +14 -14
- data/test/performance/tools/CmdSender.bat +0 -0
- data/test/performance/tools/CmdTlmServer +16 -16
- data/test/performance/tools/CmdTlmServer.bat +0 -0
- data/test/performance/tools/CmdTlmServerMemProf +20 -20
- data/test/performance/tools/CmdTlmServerMemProf.bat +0 -0
- data/test/performance/tools/DataViewer +14 -14
- data/test/performance/tools/DataViewer.bat +0 -0
- data/test/performance/tools/HandbookCreator +14 -14
- data/test/performance/tools/HandbookCreator.bat +0 -0
- data/test/performance/tools/Launcher +14 -14
- data/test/performance/tools/Launcher.bat +0 -0
- data/test/performance/tools/LimitsMonitor +14 -14
- data/test/performance/tools/LimitsMonitor.bat +0 -0
- data/test/performance/tools/OpenGLBuilder +14 -14
- data/test/performance/tools/OpenGLBuilder.bat +0 -0
- data/test/performance/tools/PacketTarget +14 -14
- data/test/performance/tools/PacketTarget.bat +0 -0
- data/test/performance/tools/PacketViewer +14 -14
- data/test/performance/tools/PacketViewer.bat +0 -0
- data/test/performance/tools/Replay +14 -14
- data/test/performance/tools/Replay.bat +0 -0
- data/test/performance/tools/ScpiTarget +14 -14
- data/test/performance/tools/ScpiTarget.bat +0 -0
- data/test/performance/tools/ScriptRunner +14 -14
- data/test/performance/tools/ScriptRunner.bat +0 -0
- data/test/performance/tools/TableManager +14 -14
- data/test/performance/tools/TableManager.bat +0 -0
- data/test/performance/tools/TestRunner +14 -14
- data/test/performance/tools/TestRunner.bat +0 -0
- data/test/performance/tools/ThreadTarget +14 -14
- data/test/performance/tools/ThreadTarget.bat +0 -0
- data/test/performance/tools/TlmExtractor +14 -14
- data/test/performance/tools/TlmExtractor.bat +0 -0
- data/test/performance/tools/TlmGrapher +14 -14
- data/test/performance/tools/TlmGrapher.bat +0 -0
- data/test/performance/tools/TlmGrapherMemProf +19 -19
- data/test/performance/tools/TlmGrapherMemProf.bat +0 -0
- data/test/performance/tools/TlmViewer +14 -14
- data/test/performance/tools/TlmViewer.bat +0 -0
- data/test/performance/tools/TlmViewerMemProf +19 -19
- data/test/performance/tools/TlmViewerMemProf.bat +0 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
- metadata +3 -3
data/lib/cosmos/gui/qt.rb
CHANGED
|
@@ -1,860 +1,860 @@
|
|
|
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
|
-
|
|
98
|
-
if color_r && color_g && color_b
|
|
99
|
-
key = (color_r.to_i << 24) + (color_g.to_i << 16) + (color_b.to_i << 8)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
if Cosmos::COLORS[key]
|
|
103
|
-
color = Cosmos::COLORS[key]
|
|
104
|
-
else
|
|
105
|
-
if color_r && color_g && color_b
|
|
106
|
-
color = Qt::Color.new(color_r.to_i, color_g.to_i, color_b.to_i)
|
|
107
|
-
else
|
|
108
|
-
color = Qt::Color.new(color_r)
|
|
109
|
-
end
|
|
110
|
-
Cosmos::COLORS[key] = color
|
|
111
|
-
end
|
|
112
|
-
color
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def self.getBrush(color)
|
|
116
|
-
return nil unless color
|
|
117
|
-
return color if color.is_a? Qt::Brush
|
|
118
|
-
brush = nil
|
|
119
|
-
color = Cosmos.getColor(color)
|
|
120
|
-
brush = BRUSHES[color]
|
|
121
|
-
unless brush
|
|
122
|
-
if color.is_a? Qt::LinearGradient
|
|
123
|
-
brush = Qt::Brush.new(color)
|
|
124
|
-
else
|
|
125
|
-
brush = Qt::Brush.new(color, Qt::SolidPattern)
|
|
126
|
-
end
|
|
127
|
-
BRUSHES[color] = brush
|
|
128
|
-
end
|
|
129
|
-
brush
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
def self.getPalette(foreground, background)
|
|
133
|
-
foreground = Cosmos.getColor(foreground)
|
|
134
|
-
background = Cosmos.getColor(background)
|
|
135
|
-
PALETTES[foreground] ||= {}
|
|
136
|
-
p = PALETTES[foreground][background]
|
|
137
|
-
unless p
|
|
138
|
-
p = Qt::Palette.new
|
|
139
|
-
p.setColor(Qt::Palette::Text, foreground)
|
|
140
|
-
p.setColor(Qt::Palette::Base, background)
|
|
141
|
-
p.setColor(Qt::Palette::Window, background)
|
|
142
|
-
PALETTES[foreground][background] = p
|
|
143
|
-
end
|
|
144
|
-
p
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def self.getPen(color = nil)
|
|
148
|
-
color = Cosmos.getColor(color) if color
|
|
149
|
-
pen = nil
|
|
150
|
-
pen = PENS[color]
|
|
151
|
-
unless pen
|
|
152
|
-
if color
|
|
153
|
-
pen = Qt::Pen.new(color)
|
|
154
|
-
else
|
|
155
|
-
pen = Qt::Pen.new
|
|
156
|
-
end
|
|
157
|
-
PENS[color] = pen
|
|
158
|
-
end
|
|
159
|
-
pen
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
def self.getFont(font_face, font_size, font_attrs = nil, font_italics = false)
|
|
163
|
-
FONTS[font_face] ||= {}
|
|
164
|
-
FONTS[font_face][font_size] ||= {}
|
|
165
|
-
FONTS[font_face][font_size][font_attrs] ||= {}
|
|
166
|
-
font = FONTS[font_face][font_size][font_attrs][font_italics]
|
|
167
|
-
unless font
|
|
168
|
-
if font_attrs and font_italics
|
|
169
|
-
font = Qt::Font.new(font_face, font_size, font_attrs, font_italics)
|
|
170
|
-
else
|
|
171
|
-
font = Qt::Font.new(font_face, font_size)
|
|
172
|
-
end
|
|
173
|
-
FONTS[font_face][font_size][font_attrs][font_italics] = font
|
|
174
|
-
end
|
|
175
|
-
font
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
# Get the default small font for the platform (Windows, Mac, Linux)
|
|
179
|
-
def self.get_default_small_font
|
|
180
|
-
if Kernel.is_windows?
|
|
181
|
-
Cosmos.getFont("courier", 9)
|
|
182
|
-
else
|
|
183
|
-
Cosmos.getFont("courier", 12)
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
# Get the default font for the platform (Windows, Mac, Linux)
|
|
188
|
-
def self.get_default_font
|
|
189
|
-
if Kernel.is_windows?
|
|
190
|
-
Cosmos.getFont("Courier", 10)
|
|
191
|
-
else
|
|
192
|
-
Cosmos.getFont("Courier", 14)
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
def self.getFontMetrics(font)
|
|
197
|
-
font_metrics = FONT_METRICS[font]
|
|
198
|
-
unless font_metrics
|
|
199
|
-
font_metrics = Qt::FontMetrics.new(font)
|
|
200
|
-
FONT_METRICS[font] = font_metrics
|
|
201
|
-
end
|
|
202
|
-
font_metrics
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
def self.getCursor(shape)
|
|
206
|
-
key = shape
|
|
207
|
-
key = shape.to_i if shape.is_a? Qt::Enum
|
|
208
|
-
cursor = CURSORS[key]
|
|
209
|
-
unless cursor
|
|
210
|
-
cursor = Qt::Cursor.new(shape)
|
|
211
|
-
CURSORS[key] = cursor
|
|
212
|
-
end
|
|
213
|
-
cursor
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
GREEN = getColor(0, 150, 0)
|
|
217
|
-
YELLOW = getColor(190, 135, 0)
|
|
218
|
-
RED = getColor(Qt::red)
|
|
219
|
-
BLUE = getColor(0, 100, 255)
|
|
220
|
-
PURPLE = getColor(200, 0, 200)
|
|
221
|
-
BLACK = getColor(Qt::black)
|
|
222
|
-
WHITE = getColor(Qt::white)
|
|
223
|
-
BLACK_NO_BRUSH = Qt::Brush.new(Cosmos::BLACK, Qt::NoBrush)
|
|
224
|
-
DEFAULT_PALETTE = Qt::Palette.new
|
|
225
|
-
RED_PALETTE = Qt::Palette.new(Qt::red)
|
|
226
|
-
DASHLINE_PEN = Qt::Pen.new(Qt::DashLine)
|
|
227
|
-
|
|
228
|
-
# Load the applications icon
|
|
229
|
-
def self.load_cosmos_icon(name='COSMOS_64x64.png')
|
|
230
|
-
icon = Cosmos.get_icon(name, false)
|
|
231
|
-
icon = Cosmos.get_icon('COSMOS_64x64.png', false) unless icon
|
|
232
|
-
Qt::Application.instance.setWindowIcon(icon) if icon
|
|
233
|
-
return icon
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
# Load the applications icon
|
|
237
|
-
def self.get_icon(name, fail_blank = true)
|
|
238
|
-
icon = Qt::Icon.new(Cosmos.data_path(name))
|
|
239
|
-
icon = nil if icon.isNull && !fail_blank
|
|
240
|
-
return icon
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
# Try to change to a configuration in a packet log reader
|
|
244
|
-
def self.check_log_configuration(packet_log_reader, log_filename)
|
|
245
|
-
config_change_success, change_error = packet_log_reader.open(log_filename)
|
|
246
|
-
unless config_change_success
|
|
247
|
-
Qt.execute_in_main_thread(true) do
|
|
248
|
-
if change_error
|
|
249
|
-
Qt::MessageBox.warning(Qt::Application.instance.activeWindow, 'Warning', "When opening: #{log_filename}\n\nAn error occurred when changing to saved configuration:\n#{packet_log_reader.configuration_name}\n\n#{change_error.formatted}\n\nUsing default configuration")
|
|
250
|
-
else
|
|
251
|
-
Qt::MessageBox.warning(Qt::Application.instance.activeWindow, 'Warning', "When opening: #{log_filename}\n\nThe following saved configuration was not found:\n#{packet_log_reader.configuration_name}\n\nUsing default configuration")
|
|
252
|
-
end
|
|
253
|
-
end
|
|
254
|
-
end
|
|
255
|
-
end
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
#### TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
|
259
|
-
class Qt::Application
|
|
260
|
-
def exec
|
|
261
|
-
begin
|
|
262
|
-
method_missing(:exec)
|
|
263
|
-
ensure
|
|
264
|
-
disable_threading()
|
|
265
|
-
self.dispose
|
|
266
|
-
Qt::Internal.application_terminated = true
|
|
267
|
-
end
|
|
268
|
-
end
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
class Qt::CoreApplication
|
|
272
|
-
def exec
|
|
273
|
-
begin
|
|
274
|
-
method_missing(:exec)
|
|
275
|
-
ensure
|
|
276
|
-
disable_threading()
|
|
277
|
-
self.dispose
|
|
278
|
-
Qt::Internal.application_terminated = true
|
|
279
|
-
end
|
|
280
|
-
end
|
|
281
|
-
end
|
|
282
|
-
#### END TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
|
283
|
-
|
|
284
|
-
class Qt::Icon
|
|
285
|
-
def initialize(param = nil)
|
|
286
|
-
if param
|
|
287
|
-
super(param)
|
|
288
|
-
else
|
|
289
|
-
super()
|
|
290
|
-
end
|
|
291
|
-
end
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
class Qt::Dialog
|
|
295
|
-
def initialize(parent = Qt::Application.activeWindow,
|
|
296
|
-
flags = (Qt::WindowTitleHint | Qt::WindowSystemMenuHint))
|
|
297
|
-
super(parent, flags)
|
|
298
|
-
end
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
class Qt::TableWidget
|
|
302
|
-
# Resizes the table, turns off scroll bars, and sets the minimum and maximum sizes
|
|
303
|
-
# to the full size of the table with all the elements in view
|
|
304
|
-
def displayFullSize
|
|
305
|
-
resizeColumnsToContents()
|
|
306
|
-
resizeRowsToContents()
|
|
307
|
-
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
|
308
|
-
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
|
309
|
-
setMinimumSize(fullWidth, fullHeight)
|
|
310
|
-
setMaximumSize(fullWidth, fullHeight)
|
|
311
|
-
end
|
|
312
|
-
|
|
313
|
-
def fullWidth
|
|
314
|
-
2*frameWidth() + horizontalHeader.length + verticalHeader.width
|
|
315
|
-
end
|
|
316
|
-
|
|
317
|
-
def fullHeight
|
|
318
|
-
2*frameWidth() + verticalHeader.length + horizontalHeader.height
|
|
319
|
-
end
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
class Qt::TableWidgetItem
|
|
323
|
-
def initialize(string = "")
|
|
324
|
-
super(string)
|
|
325
|
-
setFlags(Qt::ItemIsEnabled)
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
def textColor=(color)
|
|
329
|
-
setForeground(Cosmos.getBrush(color))
|
|
330
|
-
end
|
|
331
|
-
end
|
|
332
|
-
|
|
333
|
-
class Qt::TreeWidget
|
|
334
|
-
def initialize(parent = Qt::Application.activeWindow)
|
|
335
|
-
super(parent)
|
|
336
|
-
|
|
337
|
-
# Create a sensible default handler for clicking the checkboxes
|
|
338
|
-
# of a tree. If you check a node all the lower nodes get checked.
|
|
339
|
-
# If you uncheck a node all the lower nodes get unchecked.
|
|
340
|
-
# If you check a lower node all the parent nodes get checked.
|
|
341
|
-
connect(SIGNAL('itemClicked(QTreeWidgetItem*, int)')) do |node, col|
|
|
342
|
-
if node.checkState == Qt::Checked
|
|
343
|
-
# Set all nodes below this to checked
|
|
344
|
-
node.setCheckStateAll(Qt::Checked)
|
|
345
|
-
|
|
346
|
-
# Set all the nodes above this to checked
|
|
347
|
-
while node.parent
|
|
348
|
-
node = node.parent
|
|
349
|
-
node.setCheckState(0, Qt::Checked)
|
|
350
|
-
end
|
|
351
|
-
else
|
|
352
|
-
# Set all nodes below this to unchecked
|
|
353
|
-
node.setCheckStateAll(Qt::Unchecked)
|
|
354
|
-
end
|
|
355
|
-
end
|
|
356
|
-
end
|
|
357
|
-
|
|
358
|
-
# Yields each of the top level items (those without a parent).
|
|
359
|
-
def topLevelItems
|
|
360
|
-
topLevelItemCount.times do |index|
|
|
361
|
-
yield topLevelItem(index)
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
|
-
end
|
|
365
|
-
|
|
366
|
-
class Qt::TreeWidgetItem
|
|
367
|
-
# Sets the check state of this TreeWidgetItem as well as all its children
|
|
368
|
-
# recursively.
|
|
369
|
-
#
|
|
370
|
-
# @param state [Integer] Must be Qt::Checked or Qt::Unchecked
|
|
371
|
-
def setCheckStateAll(state = Qt::Checked)
|
|
372
|
-
children() do |child|
|
|
373
|
-
child.setCheckStateAll(state)
|
|
374
|
-
end
|
|
375
|
-
setCheckState(0, state)
|
|
376
|
-
end
|
|
377
|
-
|
|
378
|
-
# @return [Qt::TreeWidgetItem] The top level item for this TreeWidgetItem.
|
|
379
|
-
# The top level item does not have a parent. Note that this could return
|
|
380
|
-
# itself.
|
|
381
|
-
def topLevel
|
|
382
|
-
top = self
|
|
383
|
-
if !top.parent.nil?
|
|
384
|
-
while true
|
|
385
|
-
top = top.parent
|
|
386
|
-
break if top.parent.nil?
|
|
387
|
-
end
|
|
388
|
-
end
|
|
389
|
-
top
|
|
390
|
-
end
|
|
391
|
-
|
|
392
|
-
# Yields the children of the current node
|
|
393
|
-
def children
|
|
394
|
-
childCount.times do |index|
|
|
395
|
-
yield child(index)
|
|
396
|
-
end
|
|
397
|
-
end
|
|
398
|
-
|
|
399
|
-
# Define the default column to be 0
|
|
400
|
-
def background(column = 0)
|
|
401
|
-
super(column)
|
|
402
|
-
end
|
|
403
|
-
def checkState(column = 0)
|
|
404
|
-
super(column)
|
|
405
|
-
end
|
|
406
|
-
def font(column = 0)
|
|
407
|
-
super(column)
|
|
408
|
-
end
|
|
409
|
-
def foreground(column = 0)
|
|
410
|
-
super(column)
|
|
411
|
-
end
|
|
412
|
-
def icon(column = 0)
|
|
413
|
-
super(column)
|
|
414
|
-
end
|
|
415
|
-
def statusTip(column = 0)
|
|
416
|
-
super(column)
|
|
417
|
-
end
|
|
418
|
-
def sizeHint(column = 0)
|
|
419
|
-
super(column)
|
|
420
|
-
end
|
|
421
|
-
def text(column = 0)
|
|
422
|
-
super(column)
|
|
423
|
-
end
|
|
424
|
-
def toolTip(column = 0)
|
|
425
|
-
super(column)
|
|
426
|
-
end
|
|
427
|
-
def whatsThis(column = 0)
|
|
428
|
-
super(column)
|
|
429
|
-
end
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
class Qt::TabWidget
|
|
433
|
-
def tab(index)
|
|
434
|
-
widget(index)
|
|
435
|
-
end
|
|
436
|
-
|
|
437
|
-
def widgets
|
|
438
|
-
all = []
|
|
439
|
-
(0...self.count()).each do |index|
|
|
440
|
-
all << self.widget(index)
|
|
441
|
-
end
|
|
442
|
-
all
|
|
443
|
-
end
|
|
444
|
-
alias :tabs :widgets
|
|
445
|
-
|
|
446
|
-
def currentWidget
|
|
447
|
-
self.widget(self.currentIndex)
|
|
448
|
-
end
|
|
449
|
-
alias :currentTab :currentWidget
|
|
450
|
-
end
|
|
451
|
-
|
|
452
|
-
class Qt::LineEdit
|
|
453
|
-
def setColors(foreground, background)
|
|
454
|
-
setPalette(Cosmos.getPalette(foreground, background))
|
|
455
|
-
end
|
|
456
|
-
|
|
457
|
-
def text=(value)
|
|
458
|
-
setText(value)
|
|
459
|
-
end
|
|
460
|
-
end
|
|
461
|
-
|
|
462
|
-
class Qt::PlainTextEdit
|
|
463
|
-
BLANK = ''.freeze
|
|
464
|
-
BREAK = '<br/>'.freeze
|
|
465
|
-
AMP = '&'.freeze
|
|
466
|
-
NBSP = ' '.freeze
|
|
467
|
-
GT = '>'.freeze
|
|
468
|
-
LT = '<'.freeze
|
|
469
|
-
@@color_cache = {}
|
|
470
|
-
@@mapping = {'&'=>AMP,"\n"=>BLANK,"\s"=>NBSP,'>'=>GT,'<'=>LT}
|
|
471
|
-
@@regex = Regexp.union(@@mapping.keys)
|
|
472
|
-
|
|
473
|
-
def add_formatted_text(text, color = nil)
|
|
474
|
-
if text =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
|
475
|
-
text.chomp!
|
|
476
|
-
text = text.inspect.remove_quotes
|
|
477
|
-
text << "\n"
|
|
478
|
-
end
|
|
479
|
-
if text =~ /<G>/ or color == Cosmos::GREEN
|
|
480
|
-
text.gsub!(/<G>/, BLANK)
|
|
481
|
-
addText(text, Cosmos::GREEN)
|
|
482
|
-
elsif text =~ /<Y>/ or color == Cosmos::YELLOW
|
|
483
|
-
text.gsub!(/<Y>/, BLANK)
|
|
484
|
-
addText(text, Cosmos::YELLOW)
|
|
485
|
-
elsif text =~ /<R>/ or color == Cosmos::RED
|
|
486
|
-
text.gsub!(/<R>/, BLANK)
|
|
487
|
-
addText(text, Cosmos::RED)
|
|
488
|
-
elsif text =~ /<B>/ or color == Cosmos::BLUE
|
|
489
|
-
text.gsub!(/<B>/, BLANK)
|
|
490
|
-
addText(text, Cosmos::BLUE)
|
|
491
|
-
else
|
|
492
|
-
addText(text) # default is Cosmos::BLACK
|
|
493
|
-
end
|
|
494
|
-
end
|
|
495
|
-
|
|
496
|
-
def addText(text, color = Cosmos::BLACK)
|
|
497
|
-
@current_text ||= ''
|
|
498
|
-
@current_text << escape_text(text.chomp, color) << BREAK
|
|
499
|
-
end
|
|
500
|
-
|
|
501
|
-
def flush
|
|
502
|
-
appendHtml(@current_text)
|
|
503
|
-
@current_text.clear
|
|
504
|
-
end
|
|
505
|
-
|
|
506
|
-
def appendText(text, color = Cosmos::BLACK)
|
|
507
|
-
appendHtml(escape_text(text.chomp, color))
|
|
508
|
-
end
|
|
509
|
-
|
|
510
|
-
# Return the selected lines. If a partial line is selected the entire line will be returned.
|
|
511
|
-
# If there is no selection the line with the cursor will be returned
|
|
512
|
-
def selected_lines
|
|
513
|
-
cursor = textCursor
|
|
514
|
-
selection_end = cursor.selectionEnd
|
|
515
|
-
# Initially place the cursor at the beginning of the selection
|
|
516
|
-
# If nothing is selected this will just put the cursor at the beginning of the current line
|
|
517
|
-
cursor.setPosition(textCursor.selectionStart)
|
|
518
|
-
cursor.movePosition(Qt::TextCursor::StartOfLine)
|
|
519
|
-
# Move the cursor to the end of the selection while keeping the anchor
|
|
520
|
-
cursor.setPosition(selection_end, Qt::TextCursor::KeepAnchor)
|
|
521
|
-
# Normally we want to select the entire line where the end of selection is
|
|
522
|
-
# However if the user selects an exact number of lines
|
|
523
|
-
# the cursor will be at the beginning of the following line
|
|
524
|
-
# Therefore if the cursor is at the beginning of the line and we have a selection
|
|
525
|
-
# we'll skip moving to the end of the line
|
|
526
|
-
unless (cursor.atBlockStart and textCursor.hasSelection)
|
|
527
|
-
cursor.movePosition(Qt::TextCursor::EndOfLine, Qt::TextCursor::KeepAnchor)
|
|
528
|
-
end
|
|
529
|
-
# If there is no selection then just return nil
|
|
530
|
-
return nil if cursor.selectedText.nil?
|
|
531
|
-
|
|
532
|
-
cursor.selection.toPlainText
|
|
533
|
-
|
|
534
|
-
# The selectedText function returns the Unicode U+2029 paragraph separator character
|
|
535
|
-
# instead of newline \n. Thus we have to unpack as Unicode, covert to newlines, and then repack
|
|
536
|
-
#text = cursor.selectedText.unpack("U*")
|
|
537
|
-
#text.collect! {|letter| if letter == 63 then 10 else letter end }
|
|
538
|
-
#text.pack("U*")
|
|
539
|
-
end
|
|
540
|
-
|
|
541
|
-
# Return the line number (0 based) of the selection start
|
|
542
|
-
def selection_start_line
|
|
543
|
-
cursor = textCursor
|
|
544
|
-
cursor.setPosition(textCursor.selectionStart)
|
|
545
|
-
cursor.blockNumber
|
|
546
|
-
end
|
|
547
|
-
|
|
548
|
-
# Return the line number (0 based) of the selection end
|
|
549
|
-
def selection_end_line
|
|
550
|
-
cursor = textCursor
|
|
551
|
-
cursor.setPosition(textCursor.selectionEnd)
|
|
552
|
-
cursor.blockNumber
|
|
553
|
-
end
|
|
554
|
-
|
|
555
|
-
private
|
|
556
|
-
def escape_text(text, color)
|
|
557
|
-
@@color_cache[color] ||= "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
|
558
|
-
# You might think gsub! would use less memory but benchmarking proves gsub
|
|
559
|
-
# with a regular express argument is the fastest and uses the least memory.
|
|
560
|
-
# However, this is still an expensive operation due to how many times it is called.
|
|
561
|
-
"<font color=\"#{@@color_cache[color]}\">#{text.gsub(@@regex,@@mapping)}</font>"
|
|
562
|
-
end
|
|
563
|
-
end
|
|
564
|
-
|
|
565
|
-
class Qt::TextEdit
|
|
566
|
-
def setColors(foreground, background)
|
|
567
|
-
setPalette(Cosmos.getPalette(foreground, background))
|
|
568
|
-
end
|
|
569
|
-
end
|
|
570
|
-
|
|
571
|
-
class Qt::ComboBox
|
|
572
|
-
# Helper method to remove all items from a ComboBox
|
|
573
|
-
def clearItems
|
|
574
|
-
(0...count).to_a.reverse_each do |index|
|
|
575
|
-
removeItem(index)
|
|
576
|
-
end
|
|
577
|
-
end
|
|
578
|
-
|
|
579
|
-
# Alias currentText as text to make it more compatible with LineEdit which uses text
|
|
580
|
-
def text
|
|
581
|
-
currentText
|
|
582
|
-
end
|
|
583
|
-
|
|
584
|
-
# Helper method to set the current item using a text String instead of the index
|
|
585
|
-
def setCurrentText(arg)
|
|
586
|
-
setCurrentIndex(findText(arg.to_s))
|
|
587
|
-
end
|
|
588
|
-
|
|
589
|
-
def each
|
|
590
|
-
(0...count).each do |index|
|
|
591
|
-
yield self.itemText(index), self.itemData(index)
|
|
592
|
-
end
|
|
593
|
-
end
|
|
594
|
-
end
|
|
595
|
-
|
|
596
|
-
class Qt::ListWidget
|
|
597
|
-
# Helper method to remove all items from a ListWidget
|
|
598
|
-
def clearItems
|
|
599
|
-
(0...count).each do
|
|
600
|
-
takeItem(0).dispose
|
|
601
|
-
end
|
|
602
|
-
end
|
|
603
|
-
|
|
604
|
-
def each
|
|
605
|
-
(0...count).each do |index|
|
|
606
|
-
yield self.item(index)
|
|
607
|
-
end
|
|
608
|
-
end
|
|
609
|
-
|
|
610
|
-
def remove_selected_items
|
|
611
|
-
# Take the selected items and call row on each to get an array of the item indexes
|
|
612
|
-
# Sort that array because selectedItems is returned in the order selected, not numerical order
|
|
613
|
-
# Reverse this array of indices so we remove the last item first,
|
|
614
|
-
# this allows all the indexes to remain constant
|
|
615
|
-
# Call takeItem of each of the indices and then dispose the resulting ListWidgetItem that is returned
|
|
616
|
-
selectedItems.map {|x| row(x)}.sort.reverse.each { |index| takeItem(index).dispose }
|
|
617
|
-
end
|
|
618
|
-
end
|
|
619
|
-
|
|
620
|
-
# This class attempts to duplicate Fox's FXColorList
|
|
621
|
-
# by adding a colored icon to each item in the ListWidget
|
|
622
|
-
class Qt::ColorListWidget < Qt::ListWidget
|
|
623
|
-
attr_reader :original_parent
|
|
624
|
-
|
|
625
|
-
def initialize(parent, enable_key_delete = true)
|
|
626
|
-
super(parent)
|
|
627
|
-
# When a layout adds this widget it automatically gets re-parented so
|
|
628
|
-
# store the original parent in case someone needs it
|
|
629
|
-
@original_parent = parent
|
|
630
|
-
@enable_key_delete = enable_key_delete
|
|
631
|
-
@colors = []
|
|
632
|
-
@maps = []
|
|
633
|
-
@icons = []
|
|
634
|
-
setUniformItemSizes(true)
|
|
635
|
-
end
|
|
636
|
-
|
|
637
|
-
def resize_to_contents
|
|
638
|
-
return if count == 0
|
|
639
|
-
#setResizeMode(Qt::ListView::Adjust)
|
|
640
|
-
# Disable the vertical scrollbar and don't display it
|
|
641
|
-
verticalScrollBar.setDisabled(true)
|
|
642
|
-
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
|
643
|
-
# Get the height of an item and multiply by the number of items
|
|
644
|
-
setFixedHeight(visualItemRect(item(0)).height * (count + 1))
|
|
645
|
-
end
|
|
646
|
-
|
|
647
|
-
def set_read_only
|
|
648
|
-
setSelectionMode(Qt::AbstractItemView::NoSelection)
|
|
649
|
-
filter = Qt::Object.new
|
|
650
|
-
filter.define_singleton_method(:eventFilter) do |obj, event|
|
|
651
|
-
if event.type == Qt::Event::KeyPress &&
|
|
652
|
-
(event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
|
653
|
-
return true
|
|
654
|
-
end
|
|
655
|
-
return false
|
|
656
|
-
end
|
|
657
|
-
installEventFilter(filter)
|
|
658
|
-
end
|
|
659
|
-
|
|
660
|
-
def keyPressEvent(event)
|
|
661
|
-
if @enable_key_delete
|
|
662
|
-
if (event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
|
663
|
-
takeItemColor(currentRow)
|
|
664
|
-
end
|
|
665
|
-
end
|
|
666
|
-
super(event)
|
|
667
|
-
end
|
|
668
|
-
|
|
669
|
-
def addItemColor(text, color = Cosmos::BLACK)
|
|
670
|
-
@colors << color
|
|
671
|
-
@maps << Qt::Pixmap.new(20,14)
|
|
672
|
-
color = Cosmos::getColor(color)
|
|
673
|
-
@maps[-1].fill(color)
|
|
674
|
-
icon = Qt::Icon.new
|
|
675
|
-
icon.addPixmap(@maps[-1], Qt::Icon::Normal)
|
|
676
|
-
icon.addPixmap(@maps[-1], Qt::Icon::Selected)
|
|
677
|
-
@icons << icon
|
|
678
|
-
item = Qt::ListWidgetItem.new(@icons[-1], text.to_s)
|
|
679
|
-
addItem(item)
|
|
680
|
-
end
|
|
681
|
-
|
|
682
|
-
def getItemColor(index)
|
|
683
|
-
@colors[index]
|
|
684
|
-
end
|
|
685
|
-
|
|
686
|
-
def takeItemColor(row)
|
|
687
|
-
item = takeItem(row)
|
|
688
|
-
if item
|
|
689
|
-
@colors.delete_at(row)
|
|
690
|
-
@maps.delete_at(row).dispose
|
|
691
|
-
@icons.delete_at(row).dispose
|
|
692
|
-
item.dispose
|
|
693
|
-
end
|
|
694
|
-
end
|
|
695
|
-
|
|
696
|
-
def clearItems
|
|
697
|
-
(0...count).each do
|
|
698
|
-
takeItemColor(0)
|
|
699
|
-
end
|
|
700
|
-
end
|
|
701
|
-
|
|
702
|
-
def dispose
|
|
703
|
-
super()
|
|
704
|
-
@maps.each {|map| map.dispose}
|
|
705
|
-
@icons.each {|icon| icon.dispose}
|
|
706
|
-
end
|
|
707
|
-
end
|
|
708
|
-
|
|
709
|
-
class Qt::Painter
|
|
710
|
-
def setPen(pen_color)
|
|
711
|
-
super(Cosmos::getColor(pen_color))
|
|
712
|
-
@pen_color = pen_color
|
|
713
|
-
end
|
|
714
|
-
def setBrush(brush)
|
|
715
|
-
super(Cosmos::getBrush(brush))
|
|
716
|
-
@brush = brush
|
|
717
|
-
end
|
|
718
|
-
|
|
719
|
-
def addLineColor(x, y, w, h, color = Cosmos::BLACK)
|
|
720
|
-
setPen(color) if color != @pen_color
|
|
721
|
-
drawLine(x,y,w,h)
|
|
722
|
-
end
|
|
723
|
-
|
|
724
|
-
def addRectColor(x, y, w, h, color = Cosmos::BLACK)
|
|
725
|
-
setPen(color) if color != @pen_color
|
|
726
|
-
setBrush(nil) if @brush
|
|
727
|
-
drawRect(x,y,w,h)
|
|
728
|
-
end
|
|
729
|
-
|
|
730
|
-
# Note if brush_color is not specified it will be the same as pen_color
|
|
731
|
-
def addRectColorFill(x, y, w, h, pen_color = Cosmos::BLACK, brush_color = nil)
|
|
732
|
-
setPen(pen_color) if pen_color != @pen_color
|
|
733
|
-
brush_color = pen_color unless brush_color
|
|
734
|
-
setBrush(brush_color) if brush_color != @brush
|
|
735
|
-
drawRect(x,y,w,h)
|
|
736
|
-
end
|
|
737
|
-
|
|
738
|
-
def addSimpleTextAt(text, x, y, color = Cosmos::BLACK)
|
|
739
|
-
setPen(color) if color != @pen_color
|
|
740
|
-
drawText(x,y,text)
|
|
741
|
-
end
|
|
742
|
-
|
|
743
|
-
def addEllipseColor(x, y, w, h, color = Cosmos::BLACK)
|
|
744
|
-
setPen(color) if color != @pen_color
|
|
745
|
-
setBrush(nil) if @brush
|
|
746
|
-
drawEllipse(x,y,w,h)
|
|
747
|
-
end
|
|
748
|
-
|
|
749
|
-
# Note if brush_color is not specified it will be the same as pen_color
|
|
750
|
-
def addEllipseColorFill(x, y, w, h, pen_color = Cosmos::BLACK, brush_color = nil)
|
|
751
|
-
setPen(pen_color) if pen_color != @pen_color
|
|
752
|
-
brush_color = pen_color unless brush_color
|
|
753
|
-
setBrush(brush_color) if brush_color != @brush
|
|
754
|
-
drawEllipse(x,y,w,h)
|
|
755
|
-
end
|
|
756
|
-
end
|
|
757
|
-
|
|
758
|
-
class Qt::MatrixLayout < Qt::GridLayout
|
|
759
|
-
def initialize(num_columns)
|
|
760
|
-
super(nil)
|
|
761
|
-
@num_columns = num_columns
|
|
762
|
-
@row = 0
|
|
763
|
-
@col = 0
|
|
764
|
-
end
|
|
765
|
-
|
|
766
|
-
def addWidget(widget)
|
|
767
|
-
super(widget, @row, @col)
|
|
768
|
-
increment_row_col()
|
|
769
|
-
end
|
|
770
|
-
|
|
771
|
-
def addLayout(layout)
|
|
772
|
-
super(layout, @row, @col)
|
|
773
|
-
increment_row_col()
|
|
774
|
-
end
|
|
775
|
-
|
|
776
|
-
private
|
|
777
|
-
|
|
778
|
-
def increment_row_col
|
|
779
|
-
@col += 1 if @col < @num_columns
|
|
780
|
-
if @col == @num_columns
|
|
781
|
-
@row += 1
|
|
782
|
-
@col = 0
|
|
783
|
-
end
|
|
784
|
-
end
|
|
785
|
-
end
|
|
786
|
-
|
|
787
|
-
class Qt::AdaptiveGridLayout < Qt::GridLayout
|
|
788
|
-
def addWidget(widget)
|
|
789
|
-
case (count() + 1)
|
|
790
|
-
when 3 # reorder things to add a second column
|
|
791
|
-
old = takeAt(1)
|
|
792
|
-
addItem(old, 0, 1)
|
|
793
|
-
super(widget)
|
|
794
|
-
when 7 # reorder everything to add a third column
|
|
795
|
-
items = []
|
|
796
|
-
# Take the items in reverse order because taking an item changes the indexes
|
|
797
|
-
5.downto(2).each {|index| items << takeAt(index)}
|
|
798
|
-
# Reverse the items to get them back into insertion order
|
|
799
|
-
items.reverse!
|
|
800
|
-
addItem(items[0], 0, 2)
|
|
801
|
-
addItem(items[1], 1, 0)
|
|
802
|
-
addItem(items[2], 1, 1)
|
|
803
|
-
addItem(items[3], 1, 2)
|
|
804
|
-
super(widget)
|
|
805
|
-
# When we have established the desired number of rows we can add things and GridLayout does the right thing
|
|
806
|
-
else
|
|
807
|
-
super(widget)
|
|
808
|
-
end
|
|
809
|
-
end
|
|
810
|
-
# removeWidget is not implemented. If you want to remove widgets, transfer the existing to a new layout like so:
|
|
811
|
-
# (0...old_layout.count).each do |index|
|
|
812
|
-
# new_layout.addWidget(old_layout.takeAt(0).widget)
|
|
813
|
-
# end
|
|
814
|
-
end
|
|
815
|
-
|
|
816
|
-
# Implement removeAll on all the layout managers.
|
|
817
|
-
# It would be easier to add this method on Qt::Layout which is the parent class to all but
|
|
818
|
-
# that doesn't work due to the way method_missing is used to call the actual method
|
|
819
|
-
%w(GridLayout BoxLayout VBoxLayout HBoxLayout FormLayout StackedLayout).each do |klass|
|
|
820
|
-
"Qt::#{klass}".to_class.class_eval do
|
|
821
|
-
def removeAll
|
|
822
|
-
(0...count).each do |index|
|
|
823
|
-
item = takeAt(0)
|
|
824
|
-
if item.layout
|
|
825
|
-
item.removeAll
|
|
826
|
-
else
|
|
827
|
-
item.widget.dispose
|
|
828
|
-
end
|
|
829
|
-
end
|
|
830
|
-
end
|
|
831
|
-
end
|
|
832
|
-
end
|
|
833
|
-
|
|
834
|
-
class Qt::BoxLayout
|
|
835
|
-
def initialize(*args)
|
|
836
|
-
super(*args)
|
|
837
|
-
setSpacing(5) if Kernel.is_mac?
|
|
838
|
-
end
|
|
839
|
-
end
|
|
840
|
-
|
|
841
|
-
class Qt::VBoxLayout
|
|
842
|
-
def initialize(*args)
|
|
843
|
-
super(*args)
|
|
844
|
-
setSpacing(5) if Kernel.is_mac?
|
|
845
|
-
end
|
|
846
|
-
end
|
|
847
|
-
|
|
848
|
-
class Qt::HBoxLayout
|
|
849
|
-
def initialize(*args)
|
|
850
|
-
super(*args)
|
|
851
|
-
setSpacing(5) if Kernel.is_mac?
|
|
852
|
-
end
|
|
853
|
-
end
|
|
854
|
-
|
|
855
|
-
class Qt::GridLayout
|
|
856
|
-
def initialize(*args)
|
|
857
|
-
super(*args)
|
|
858
|
-
setSpacing(5) if Kernel.is_mac?
|
|
859
|
-
end
|
|
860
|
-
end
|
|
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
|
+
|
|
98
|
+
if color_r && color_g && color_b
|
|
99
|
+
key = (color_r.to_i << 24) + (color_g.to_i << 16) + (color_b.to_i << 8)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if Cosmos::COLORS[key]
|
|
103
|
+
color = Cosmos::COLORS[key]
|
|
104
|
+
else
|
|
105
|
+
if color_r && color_g && color_b
|
|
106
|
+
color = Qt::Color.new(color_r.to_i, color_g.to_i, color_b.to_i)
|
|
107
|
+
else
|
|
108
|
+
color = Qt::Color.new(color_r)
|
|
109
|
+
end
|
|
110
|
+
Cosmos::COLORS[key] = color
|
|
111
|
+
end
|
|
112
|
+
color
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def self.getBrush(color)
|
|
116
|
+
return nil unless color
|
|
117
|
+
return color if color.is_a? Qt::Brush
|
|
118
|
+
brush = nil
|
|
119
|
+
color = Cosmos.getColor(color)
|
|
120
|
+
brush = BRUSHES[color]
|
|
121
|
+
unless brush
|
|
122
|
+
if color.is_a? Qt::LinearGradient
|
|
123
|
+
brush = Qt::Brush.new(color)
|
|
124
|
+
else
|
|
125
|
+
brush = Qt::Brush.new(color, Qt::SolidPattern)
|
|
126
|
+
end
|
|
127
|
+
BRUSHES[color] = brush
|
|
128
|
+
end
|
|
129
|
+
brush
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def self.getPalette(foreground, background)
|
|
133
|
+
foreground = Cosmos.getColor(foreground)
|
|
134
|
+
background = Cosmos.getColor(background)
|
|
135
|
+
PALETTES[foreground] ||= {}
|
|
136
|
+
p = PALETTES[foreground][background]
|
|
137
|
+
unless p
|
|
138
|
+
p = Qt::Palette.new
|
|
139
|
+
p.setColor(Qt::Palette::Text, foreground)
|
|
140
|
+
p.setColor(Qt::Palette::Base, background)
|
|
141
|
+
p.setColor(Qt::Palette::Window, background)
|
|
142
|
+
PALETTES[foreground][background] = p
|
|
143
|
+
end
|
|
144
|
+
p
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def self.getPen(color = nil)
|
|
148
|
+
color = Cosmos.getColor(color) if color
|
|
149
|
+
pen = nil
|
|
150
|
+
pen = PENS[color]
|
|
151
|
+
unless pen
|
|
152
|
+
if color
|
|
153
|
+
pen = Qt::Pen.new(color)
|
|
154
|
+
else
|
|
155
|
+
pen = Qt::Pen.new
|
|
156
|
+
end
|
|
157
|
+
PENS[color] = pen
|
|
158
|
+
end
|
|
159
|
+
pen
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def self.getFont(font_face, font_size, font_attrs = nil, font_italics = false)
|
|
163
|
+
FONTS[font_face] ||= {}
|
|
164
|
+
FONTS[font_face][font_size] ||= {}
|
|
165
|
+
FONTS[font_face][font_size][font_attrs] ||= {}
|
|
166
|
+
font = FONTS[font_face][font_size][font_attrs][font_italics]
|
|
167
|
+
unless font
|
|
168
|
+
if font_attrs and font_italics
|
|
169
|
+
font = Qt::Font.new(font_face, font_size, font_attrs, font_italics)
|
|
170
|
+
else
|
|
171
|
+
font = Qt::Font.new(font_face, font_size)
|
|
172
|
+
end
|
|
173
|
+
FONTS[font_face][font_size][font_attrs][font_italics] = font
|
|
174
|
+
end
|
|
175
|
+
font
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Get the default small font for the platform (Windows, Mac, Linux)
|
|
179
|
+
def self.get_default_small_font
|
|
180
|
+
if Kernel.is_windows?
|
|
181
|
+
Cosmos.getFont("courier", 9)
|
|
182
|
+
else
|
|
183
|
+
Cosmos.getFont("courier", 12)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Get the default font for the platform (Windows, Mac, Linux)
|
|
188
|
+
def self.get_default_font
|
|
189
|
+
if Kernel.is_windows?
|
|
190
|
+
Cosmos.getFont("Courier", 10)
|
|
191
|
+
else
|
|
192
|
+
Cosmos.getFont("Courier", 14)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def self.getFontMetrics(font)
|
|
197
|
+
font_metrics = FONT_METRICS[font]
|
|
198
|
+
unless font_metrics
|
|
199
|
+
font_metrics = Qt::FontMetrics.new(font)
|
|
200
|
+
FONT_METRICS[font] = font_metrics
|
|
201
|
+
end
|
|
202
|
+
font_metrics
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def self.getCursor(shape)
|
|
206
|
+
key = shape
|
|
207
|
+
key = shape.to_i if shape.is_a? Qt::Enum
|
|
208
|
+
cursor = CURSORS[key]
|
|
209
|
+
unless cursor
|
|
210
|
+
cursor = Qt::Cursor.new(shape)
|
|
211
|
+
CURSORS[key] = cursor
|
|
212
|
+
end
|
|
213
|
+
cursor
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
GREEN = getColor(0, 150, 0)
|
|
217
|
+
YELLOW = getColor(190, 135, 0)
|
|
218
|
+
RED = getColor(Qt::red)
|
|
219
|
+
BLUE = getColor(0, 100, 255)
|
|
220
|
+
PURPLE = getColor(200, 0, 200)
|
|
221
|
+
BLACK = getColor(Qt::black)
|
|
222
|
+
WHITE = getColor(Qt::white)
|
|
223
|
+
BLACK_NO_BRUSH = Qt::Brush.new(Cosmos::BLACK, Qt::NoBrush)
|
|
224
|
+
DEFAULT_PALETTE = Qt::Palette.new
|
|
225
|
+
RED_PALETTE = Qt::Palette.new(Qt::red)
|
|
226
|
+
DASHLINE_PEN = Qt::Pen.new(Qt::DashLine)
|
|
227
|
+
|
|
228
|
+
# Load the applications icon
|
|
229
|
+
def self.load_cosmos_icon(name='COSMOS_64x64.png')
|
|
230
|
+
icon = Cosmos.get_icon(name, false)
|
|
231
|
+
icon = Cosmos.get_icon('COSMOS_64x64.png', false) unless icon
|
|
232
|
+
Qt::Application.instance.setWindowIcon(icon) if icon
|
|
233
|
+
return icon
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Load the applications icon
|
|
237
|
+
def self.get_icon(name, fail_blank = true)
|
|
238
|
+
icon = Qt::Icon.new(Cosmos.data_path(name))
|
|
239
|
+
icon = nil if icon.isNull && !fail_blank
|
|
240
|
+
return icon
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Try to change to a configuration in a packet log reader
|
|
244
|
+
def self.check_log_configuration(packet_log_reader, log_filename)
|
|
245
|
+
config_change_success, change_error = packet_log_reader.open(log_filename)
|
|
246
|
+
unless config_change_success
|
|
247
|
+
Qt.execute_in_main_thread(true) do
|
|
248
|
+
if change_error
|
|
249
|
+
Qt::MessageBox.warning(Qt::Application.instance.activeWindow, 'Warning', "When opening: #{log_filename}\n\nAn error occurred when changing to saved configuration:\n#{packet_log_reader.configuration_name}\n\n#{change_error.formatted}\n\nUsing default configuration")
|
|
250
|
+
else
|
|
251
|
+
Qt::MessageBox.warning(Qt::Application.instance.activeWindow, 'Warning', "When opening: #{log_filename}\n\nThe following saved configuration was not found:\n#{packet_log_reader.configuration_name}\n\nUsing default configuration")
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
#### TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
|
259
|
+
class Qt::Application
|
|
260
|
+
def exec
|
|
261
|
+
begin
|
|
262
|
+
method_missing(:exec)
|
|
263
|
+
ensure
|
|
264
|
+
disable_threading()
|
|
265
|
+
self.dispose
|
|
266
|
+
Qt::Internal.application_terminated = true
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
class Qt::CoreApplication
|
|
272
|
+
def exec
|
|
273
|
+
begin
|
|
274
|
+
method_missing(:exec)
|
|
275
|
+
ensure
|
|
276
|
+
disable_threading()
|
|
277
|
+
self.dispose
|
|
278
|
+
Qt::Internal.application_terminated = true
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
#### END TEMPORARY UNTIL INCLUDED IN QTBINDINGS ####
|
|
283
|
+
|
|
284
|
+
class Qt::Icon
|
|
285
|
+
def initialize(param = nil)
|
|
286
|
+
if param
|
|
287
|
+
super(param)
|
|
288
|
+
else
|
|
289
|
+
super()
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
class Qt::Dialog
|
|
295
|
+
def initialize(parent = Qt::Application.activeWindow,
|
|
296
|
+
flags = (Qt::WindowTitleHint | Qt::WindowSystemMenuHint))
|
|
297
|
+
super(parent, flags)
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
class Qt::TableWidget
|
|
302
|
+
# Resizes the table, turns off scroll bars, and sets the minimum and maximum sizes
|
|
303
|
+
# to the full size of the table with all the elements in view
|
|
304
|
+
def displayFullSize
|
|
305
|
+
resizeColumnsToContents()
|
|
306
|
+
resizeRowsToContents()
|
|
307
|
+
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
|
308
|
+
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
|
309
|
+
setMinimumSize(fullWidth, fullHeight)
|
|
310
|
+
setMaximumSize(fullWidth, fullHeight)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def fullWidth
|
|
314
|
+
2*frameWidth() + horizontalHeader.length + verticalHeader.width
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def fullHeight
|
|
318
|
+
2*frameWidth() + verticalHeader.length + horizontalHeader.height
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
class Qt::TableWidgetItem
|
|
323
|
+
def initialize(string = "")
|
|
324
|
+
super(string)
|
|
325
|
+
setFlags(Qt::ItemIsEnabled)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
def textColor=(color)
|
|
329
|
+
setForeground(Cosmos.getBrush(color))
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
class Qt::TreeWidget
|
|
334
|
+
def initialize(parent = Qt::Application.activeWindow)
|
|
335
|
+
super(parent)
|
|
336
|
+
|
|
337
|
+
# Create a sensible default handler for clicking the checkboxes
|
|
338
|
+
# of a tree. If you check a node all the lower nodes get checked.
|
|
339
|
+
# If you uncheck a node all the lower nodes get unchecked.
|
|
340
|
+
# If you check a lower node all the parent nodes get checked.
|
|
341
|
+
connect(SIGNAL('itemClicked(QTreeWidgetItem*, int)')) do |node, col|
|
|
342
|
+
if node.checkState == Qt::Checked
|
|
343
|
+
# Set all nodes below this to checked
|
|
344
|
+
node.setCheckStateAll(Qt::Checked)
|
|
345
|
+
|
|
346
|
+
# Set all the nodes above this to checked
|
|
347
|
+
while node.parent
|
|
348
|
+
node = node.parent
|
|
349
|
+
node.setCheckState(0, Qt::Checked)
|
|
350
|
+
end
|
|
351
|
+
else
|
|
352
|
+
# Set all nodes below this to unchecked
|
|
353
|
+
node.setCheckStateAll(Qt::Unchecked)
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# Yields each of the top level items (those without a parent).
|
|
359
|
+
def topLevelItems
|
|
360
|
+
topLevelItemCount.times do |index|
|
|
361
|
+
yield topLevelItem(index)
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
class Qt::TreeWidgetItem
|
|
367
|
+
# Sets the check state of this TreeWidgetItem as well as all its children
|
|
368
|
+
# recursively.
|
|
369
|
+
#
|
|
370
|
+
# @param state [Integer] Must be Qt::Checked or Qt::Unchecked
|
|
371
|
+
def setCheckStateAll(state = Qt::Checked)
|
|
372
|
+
children() do |child|
|
|
373
|
+
child.setCheckStateAll(state)
|
|
374
|
+
end
|
|
375
|
+
setCheckState(0, state)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
# @return [Qt::TreeWidgetItem] The top level item for this TreeWidgetItem.
|
|
379
|
+
# The top level item does not have a parent. Note that this could return
|
|
380
|
+
# itself.
|
|
381
|
+
def topLevel
|
|
382
|
+
top = self
|
|
383
|
+
if !top.parent.nil?
|
|
384
|
+
while true
|
|
385
|
+
top = top.parent
|
|
386
|
+
break if top.parent.nil?
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
top
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
# Yields the children of the current node
|
|
393
|
+
def children
|
|
394
|
+
childCount.times do |index|
|
|
395
|
+
yield child(index)
|
|
396
|
+
end
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
# Define the default column to be 0
|
|
400
|
+
def background(column = 0)
|
|
401
|
+
super(column)
|
|
402
|
+
end
|
|
403
|
+
def checkState(column = 0)
|
|
404
|
+
super(column)
|
|
405
|
+
end
|
|
406
|
+
def font(column = 0)
|
|
407
|
+
super(column)
|
|
408
|
+
end
|
|
409
|
+
def foreground(column = 0)
|
|
410
|
+
super(column)
|
|
411
|
+
end
|
|
412
|
+
def icon(column = 0)
|
|
413
|
+
super(column)
|
|
414
|
+
end
|
|
415
|
+
def statusTip(column = 0)
|
|
416
|
+
super(column)
|
|
417
|
+
end
|
|
418
|
+
def sizeHint(column = 0)
|
|
419
|
+
super(column)
|
|
420
|
+
end
|
|
421
|
+
def text(column = 0)
|
|
422
|
+
super(column)
|
|
423
|
+
end
|
|
424
|
+
def toolTip(column = 0)
|
|
425
|
+
super(column)
|
|
426
|
+
end
|
|
427
|
+
def whatsThis(column = 0)
|
|
428
|
+
super(column)
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
class Qt::TabWidget
|
|
433
|
+
def tab(index)
|
|
434
|
+
widget(index)
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
def widgets
|
|
438
|
+
all = []
|
|
439
|
+
(0...self.count()).each do |index|
|
|
440
|
+
all << self.widget(index)
|
|
441
|
+
end
|
|
442
|
+
all
|
|
443
|
+
end
|
|
444
|
+
alias :tabs :widgets
|
|
445
|
+
|
|
446
|
+
def currentWidget
|
|
447
|
+
self.widget(self.currentIndex)
|
|
448
|
+
end
|
|
449
|
+
alias :currentTab :currentWidget
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
class Qt::LineEdit
|
|
453
|
+
def setColors(foreground, background)
|
|
454
|
+
setPalette(Cosmos.getPalette(foreground, background))
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
def text=(value)
|
|
458
|
+
setText(value)
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
class Qt::PlainTextEdit
|
|
463
|
+
BLANK = ''.freeze
|
|
464
|
+
BREAK = '<br/>'.freeze
|
|
465
|
+
AMP = '&'.freeze
|
|
466
|
+
NBSP = ' '.freeze
|
|
467
|
+
GT = '>'.freeze
|
|
468
|
+
LT = '<'.freeze
|
|
469
|
+
@@color_cache = {}
|
|
470
|
+
@@mapping = {'&'=>AMP,"\n"=>BLANK,"\s"=>NBSP,'>'=>GT,'<'=>LT}
|
|
471
|
+
@@regex = Regexp.union(@@mapping.keys)
|
|
472
|
+
|
|
473
|
+
def add_formatted_text(text, color = nil)
|
|
474
|
+
if text =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
|
475
|
+
text.chomp!
|
|
476
|
+
text = text.inspect.remove_quotes
|
|
477
|
+
text << "\n"
|
|
478
|
+
end
|
|
479
|
+
if text =~ /<G>/ or color == Cosmos::GREEN
|
|
480
|
+
text.gsub!(/<G>/, BLANK)
|
|
481
|
+
addText(text, Cosmos::GREEN)
|
|
482
|
+
elsif text =~ /<Y>/ or color == Cosmos::YELLOW
|
|
483
|
+
text.gsub!(/<Y>/, BLANK)
|
|
484
|
+
addText(text, Cosmos::YELLOW)
|
|
485
|
+
elsif text =~ /<R>/ or color == Cosmos::RED
|
|
486
|
+
text.gsub!(/<R>/, BLANK)
|
|
487
|
+
addText(text, Cosmos::RED)
|
|
488
|
+
elsif text =~ /<B>/ or color == Cosmos::BLUE
|
|
489
|
+
text.gsub!(/<B>/, BLANK)
|
|
490
|
+
addText(text, Cosmos::BLUE)
|
|
491
|
+
else
|
|
492
|
+
addText(text) # default is Cosmos::BLACK
|
|
493
|
+
end
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
def addText(text, color = Cosmos::BLACK)
|
|
497
|
+
@current_text ||= ''
|
|
498
|
+
@current_text << escape_text(text.chomp, color) << BREAK
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
def flush
|
|
502
|
+
appendHtml(@current_text)
|
|
503
|
+
@current_text.clear
|
|
504
|
+
end
|
|
505
|
+
|
|
506
|
+
def appendText(text, color = Cosmos::BLACK)
|
|
507
|
+
appendHtml(escape_text(text.chomp, color))
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
# Return the selected lines. If a partial line is selected the entire line will be returned.
|
|
511
|
+
# If there is no selection the line with the cursor will be returned
|
|
512
|
+
def selected_lines
|
|
513
|
+
cursor = textCursor
|
|
514
|
+
selection_end = cursor.selectionEnd
|
|
515
|
+
# Initially place the cursor at the beginning of the selection
|
|
516
|
+
# If nothing is selected this will just put the cursor at the beginning of the current line
|
|
517
|
+
cursor.setPosition(textCursor.selectionStart)
|
|
518
|
+
cursor.movePosition(Qt::TextCursor::StartOfLine)
|
|
519
|
+
# Move the cursor to the end of the selection while keeping the anchor
|
|
520
|
+
cursor.setPosition(selection_end, Qt::TextCursor::KeepAnchor)
|
|
521
|
+
# Normally we want to select the entire line where the end of selection is
|
|
522
|
+
# However if the user selects an exact number of lines
|
|
523
|
+
# the cursor will be at the beginning of the following line
|
|
524
|
+
# Therefore if the cursor is at the beginning of the line and we have a selection
|
|
525
|
+
# we'll skip moving to the end of the line
|
|
526
|
+
unless (cursor.atBlockStart and textCursor.hasSelection)
|
|
527
|
+
cursor.movePosition(Qt::TextCursor::EndOfLine, Qt::TextCursor::KeepAnchor)
|
|
528
|
+
end
|
|
529
|
+
# If there is no selection then just return nil
|
|
530
|
+
return nil if cursor.selectedText.nil?
|
|
531
|
+
|
|
532
|
+
cursor.selection.toPlainText
|
|
533
|
+
|
|
534
|
+
# The selectedText function returns the Unicode U+2029 paragraph separator character
|
|
535
|
+
# instead of newline \n. Thus we have to unpack as Unicode, covert to newlines, and then repack
|
|
536
|
+
#text = cursor.selectedText.unpack("U*")
|
|
537
|
+
#text.collect! {|letter| if letter == 63 then 10 else letter end }
|
|
538
|
+
#text.pack("U*")
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
# Return the line number (0 based) of the selection start
|
|
542
|
+
def selection_start_line
|
|
543
|
+
cursor = textCursor
|
|
544
|
+
cursor.setPosition(textCursor.selectionStart)
|
|
545
|
+
cursor.blockNumber
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
# Return the line number (0 based) of the selection end
|
|
549
|
+
def selection_end_line
|
|
550
|
+
cursor = textCursor
|
|
551
|
+
cursor.setPosition(textCursor.selectionEnd)
|
|
552
|
+
cursor.blockNumber
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
private
|
|
556
|
+
def escape_text(text, color)
|
|
557
|
+
@@color_cache[color] ||= "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
|
558
|
+
# You might think gsub! would use less memory but benchmarking proves gsub
|
|
559
|
+
# with a regular express argument is the fastest and uses the least memory.
|
|
560
|
+
# However, this is still an expensive operation due to how many times it is called.
|
|
561
|
+
"<font color=\"#{@@color_cache[color]}\">#{text.gsub(@@regex,@@mapping)}</font>"
|
|
562
|
+
end
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
class Qt::TextEdit
|
|
566
|
+
def setColors(foreground, background)
|
|
567
|
+
setPalette(Cosmos.getPalette(foreground, background))
|
|
568
|
+
end
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
class Qt::ComboBox
|
|
572
|
+
# Helper method to remove all items from a ComboBox
|
|
573
|
+
def clearItems
|
|
574
|
+
(0...count).to_a.reverse_each do |index|
|
|
575
|
+
removeItem(index)
|
|
576
|
+
end
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
# Alias currentText as text to make it more compatible with LineEdit which uses text
|
|
580
|
+
def text
|
|
581
|
+
currentText
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
# Helper method to set the current item using a text String instead of the index
|
|
585
|
+
def setCurrentText(arg)
|
|
586
|
+
setCurrentIndex(findText(arg.to_s))
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
def each
|
|
590
|
+
(0...count).each do |index|
|
|
591
|
+
yield self.itemText(index), self.itemData(index)
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
end
|
|
595
|
+
|
|
596
|
+
class Qt::ListWidget
|
|
597
|
+
# Helper method to remove all items from a ListWidget
|
|
598
|
+
def clearItems
|
|
599
|
+
(0...count).each do
|
|
600
|
+
takeItem(0).dispose
|
|
601
|
+
end
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
def each
|
|
605
|
+
(0...count).each do |index|
|
|
606
|
+
yield self.item(index)
|
|
607
|
+
end
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
def remove_selected_items
|
|
611
|
+
# Take the selected items and call row on each to get an array of the item indexes
|
|
612
|
+
# Sort that array because selectedItems is returned in the order selected, not numerical order
|
|
613
|
+
# Reverse this array of indices so we remove the last item first,
|
|
614
|
+
# this allows all the indexes to remain constant
|
|
615
|
+
# Call takeItem of each of the indices and then dispose the resulting ListWidgetItem that is returned
|
|
616
|
+
selectedItems.map {|x| row(x)}.sort.reverse.each { |index| takeItem(index).dispose }
|
|
617
|
+
end
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
# This class attempts to duplicate Fox's FXColorList
|
|
621
|
+
# by adding a colored icon to each item in the ListWidget
|
|
622
|
+
class Qt::ColorListWidget < Qt::ListWidget
|
|
623
|
+
attr_reader :original_parent
|
|
624
|
+
|
|
625
|
+
def initialize(parent, enable_key_delete = true)
|
|
626
|
+
super(parent)
|
|
627
|
+
# When a layout adds this widget it automatically gets re-parented so
|
|
628
|
+
# store the original parent in case someone needs it
|
|
629
|
+
@original_parent = parent
|
|
630
|
+
@enable_key_delete = enable_key_delete
|
|
631
|
+
@colors = []
|
|
632
|
+
@maps = []
|
|
633
|
+
@icons = []
|
|
634
|
+
setUniformItemSizes(true)
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
def resize_to_contents
|
|
638
|
+
return if count == 0
|
|
639
|
+
#setResizeMode(Qt::ListView::Adjust)
|
|
640
|
+
# Disable the vertical scrollbar and don't display it
|
|
641
|
+
verticalScrollBar.setDisabled(true)
|
|
642
|
+
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff)
|
|
643
|
+
# Get the height of an item and multiply by the number of items
|
|
644
|
+
setFixedHeight(visualItemRect(item(0)).height * (count + 1))
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
def set_read_only
|
|
648
|
+
setSelectionMode(Qt::AbstractItemView::NoSelection)
|
|
649
|
+
filter = Qt::Object.new
|
|
650
|
+
filter.define_singleton_method(:eventFilter) do |obj, event|
|
|
651
|
+
if event.type == Qt::Event::KeyPress &&
|
|
652
|
+
(event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
|
653
|
+
return true
|
|
654
|
+
end
|
|
655
|
+
return false
|
|
656
|
+
end
|
|
657
|
+
installEventFilter(filter)
|
|
658
|
+
end
|
|
659
|
+
|
|
660
|
+
def keyPressEvent(event)
|
|
661
|
+
if @enable_key_delete
|
|
662
|
+
if (event.key == Qt::Key_Delete || event.key == Qt::Key_Backspace)
|
|
663
|
+
takeItemColor(currentRow)
|
|
664
|
+
end
|
|
665
|
+
end
|
|
666
|
+
super(event)
|
|
667
|
+
end
|
|
668
|
+
|
|
669
|
+
def addItemColor(text, color = Cosmos::BLACK)
|
|
670
|
+
@colors << color
|
|
671
|
+
@maps << Qt::Pixmap.new(20,14)
|
|
672
|
+
color = Cosmos::getColor(color)
|
|
673
|
+
@maps[-1].fill(color)
|
|
674
|
+
icon = Qt::Icon.new
|
|
675
|
+
icon.addPixmap(@maps[-1], Qt::Icon::Normal)
|
|
676
|
+
icon.addPixmap(@maps[-1], Qt::Icon::Selected)
|
|
677
|
+
@icons << icon
|
|
678
|
+
item = Qt::ListWidgetItem.new(@icons[-1], text.to_s)
|
|
679
|
+
addItem(item)
|
|
680
|
+
end
|
|
681
|
+
|
|
682
|
+
def getItemColor(index)
|
|
683
|
+
@colors[index]
|
|
684
|
+
end
|
|
685
|
+
|
|
686
|
+
def takeItemColor(row)
|
|
687
|
+
item = takeItem(row)
|
|
688
|
+
if item
|
|
689
|
+
@colors.delete_at(row)
|
|
690
|
+
@maps.delete_at(row).dispose
|
|
691
|
+
@icons.delete_at(row).dispose
|
|
692
|
+
item.dispose
|
|
693
|
+
end
|
|
694
|
+
end
|
|
695
|
+
|
|
696
|
+
def clearItems
|
|
697
|
+
(0...count).each do
|
|
698
|
+
takeItemColor(0)
|
|
699
|
+
end
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
def dispose
|
|
703
|
+
super()
|
|
704
|
+
@maps.each {|map| map.dispose}
|
|
705
|
+
@icons.each {|icon| icon.dispose}
|
|
706
|
+
end
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
class Qt::Painter
|
|
710
|
+
def setPen(pen_color)
|
|
711
|
+
super(Cosmos::getColor(pen_color))
|
|
712
|
+
@pen_color = pen_color
|
|
713
|
+
end
|
|
714
|
+
def setBrush(brush)
|
|
715
|
+
super(Cosmos::getBrush(brush))
|
|
716
|
+
@brush = brush
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
def addLineColor(x, y, w, h, color = Cosmos::BLACK)
|
|
720
|
+
setPen(color) if color != @pen_color
|
|
721
|
+
drawLine(x,y,w,h)
|
|
722
|
+
end
|
|
723
|
+
|
|
724
|
+
def addRectColor(x, y, w, h, color = Cosmos::BLACK)
|
|
725
|
+
setPen(color) if color != @pen_color
|
|
726
|
+
setBrush(nil) if @brush
|
|
727
|
+
drawRect(x,y,w,h)
|
|
728
|
+
end
|
|
729
|
+
|
|
730
|
+
# Note if brush_color is not specified it will be the same as pen_color
|
|
731
|
+
def addRectColorFill(x, y, w, h, pen_color = Cosmos::BLACK, brush_color = nil)
|
|
732
|
+
setPen(pen_color) if pen_color != @pen_color
|
|
733
|
+
brush_color = pen_color unless brush_color
|
|
734
|
+
setBrush(brush_color) if brush_color != @brush
|
|
735
|
+
drawRect(x,y,w,h)
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
def addSimpleTextAt(text, x, y, color = Cosmos::BLACK)
|
|
739
|
+
setPen(color) if color != @pen_color
|
|
740
|
+
drawText(x,y,text)
|
|
741
|
+
end
|
|
742
|
+
|
|
743
|
+
def addEllipseColor(x, y, w, h, color = Cosmos::BLACK)
|
|
744
|
+
setPen(color) if color != @pen_color
|
|
745
|
+
setBrush(nil) if @brush
|
|
746
|
+
drawEllipse(x,y,w,h)
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
# Note if brush_color is not specified it will be the same as pen_color
|
|
750
|
+
def addEllipseColorFill(x, y, w, h, pen_color = Cosmos::BLACK, brush_color = nil)
|
|
751
|
+
setPen(pen_color) if pen_color != @pen_color
|
|
752
|
+
brush_color = pen_color unless brush_color
|
|
753
|
+
setBrush(brush_color) if brush_color != @brush
|
|
754
|
+
drawEllipse(x,y,w,h)
|
|
755
|
+
end
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
class Qt::MatrixLayout < Qt::GridLayout
|
|
759
|
+
def initialize(num_columns)
|
|
760
|
+
super(nil)
|
|
761
|
+
@num_columns = num_columns
|
|
762
|
+
@row = 0
|
|
763
|
+
@col = 0
|
|
764
|
+
end
|
|
765
|
+
|
|
766
|
+
def addWidget(widget)
|
|
767
|
+
super(widget, @row, @col)
|
|
768
|
+
increment_row_col()
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
def addLayout(layout)
|
|
772
|
+
super(layout, @row, @col)
|
|
773
|
+
increment_row_col()
|
|
774
|
+
end
|
|
775
|
+
|
|
776
|
+
private
|
|
777
|
+
|
|
778
|
+
def increment_row_col
|
|
779
|
+
@col += 1 if @col < @num_columns
|
|
780
|
+
if @col == @num_columns
|
|
781
|
+
@row += 1
|
|
782
|
+
@col = 0
|
|
783
|
+
end
|
|
784
|
+
end
|
|
785
|
+
end
|
|
786
|
+
|
|
787
|
+
class Qt::AdaptiveGridLayout < Qt::GridLayout
|
|
788
|
+
def addWidget(widget)
|
|
789
|
+
case (count() + 1)
|
|
790
|
+
when 3 # reorder things to add a second column
|
|
791
|
+
old = takeAt(1)
|
|
792
|
+
addItem(old, 0, 1)
|
|
793
|
+
super(widget)
|
|
794
|
+
when 7 # reorder everything to add a third column
|
|
795
|
+
items = []
|
|
796
|
+
# Take the items in reverse order because taking an item changes the indexes
|
|
797
|
+
5.downto(2).each {|index| items << takeAt(index)}
|
|
798
|
+
# Reverse the items to get them back into insertion order
|
|
799
|
+
items.reverse!
|
|
800
|
+
addItem(items[0], 0, 2)
|
|
801
|
+
addItem(items[1], 1, 0)
|
|
802
|
+
addItem(items[2], 1, 1)
|
|
803
|
+
addItem(items[3], 1, 2)
|
|
804
|
+
super(widget)
|
|
805
|
+
# When we have established the desired number of rows we can add things and GridLayout does the right thing
|
|
806
|
+
else
|
|
807
|
+
super(widget)
|
|
808
|
+
end
|
|
809
|
+
end
|
|
810
|
+
# removeWidget is not implemented. If you want to remove widgets, transfer the existing to a new layout like so:
|
|
811
|
+
# (0...old_layout.count).each do |index|
|
|
812
|
+
# new_layout.addWidget(old_layout.takeAt(0).widget)
|
|
813
|
+
# end
|
|
814
|
+
end
|
|
815
|
+
|
|
816
|
+
# Implement removeAll on all the layout managers.
|
|
817
|
+
# It would be easier to add this method on Qt::Layout which is the parent class to all but
|
|
818
|
+
# that doesn't work due to the way method_missing is used to call the actual method
|
|
819
|
+
%w(GridLayout BoxLayout VBoxLayout HBoxLayout FormLayout StackedLayout).each do |klass|
|
|
820
|
+
"Qt::#{klass}".to_class.class_eval do
|
|
821
|
+
def removeAll
|
|
822
|
+
(0...count).each do |index|
|
|
823
|
+
item = takeAt(0)
|
|
824
|
+
if item.layout
|
|
825
|
+
item.removeAll
|
|
826
|
+
else
|
|
827
|
+
item.widget.dispose
|
|
828
|
+
end
|
|
829
|
+
end
|
|
830
|
+
end
|
|
831
|
+
end
|
|
832
|
+
end
|
|
833
|
+
|
|
834
|
+
class Qt::BoxLayout
|
|
835
|
+
def initialize(*args)
|
|
836
|
+
super(*args)
|
|
837
|
+
setSpacing(5) if Kernel.is_mac?
|
|
838
|
+
end
|
|
839
|
+
end
|
|
840
|
+
|
|
841
|
+
class Qt::VBoxLayout
|
|
842
|
+
def initialize(*args)
|
|
843
|
+
super(*args)
|
|
844
|
+
setSpacing(5) if Kernel.is_mac?
|
|
845
|
+
end
|
|
846
|
+
end
|
|
847
|
+
|
|
848
|
+
class Qt::HBoxLayout
|
|
849
|
+
def initialize(*args)
|
|
850
|
+
super(*args)
|
|
851
|
+
setSpacing(5) if Kernel.is_mac?
|
|
852
|
+
end
|
|
853
|
+
end
|
|
854
|
+
|
|
855
|
+
class Qt::GridLayout
|
|
856
|
+
def initialize(*args)
|
|
857
|
+
super(*args)
|
|
858
|
+
setSpacing(5) if Kernel.is_mac?
|
|
859
|
+
end
|
|
860
|
+
end
|