cosmos 3.8.3 → 3.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/Manifest.txt +14 -0
  4. data/Rakefile +35 -2
  5. data/autohotkey/config/targets/INST/screens/_footer.txt +4 -0
  6. data/autohotkey/config/targets/INST/screens/hs.txt +1 -4
  7. data/autohotkey/config/tools/table_manager/OldOneDimensionalTable_def.txt +19 -0
  8. data/autohotkey/config/tools/table_manager/OldTwoDimensionalTable_def.txt +248 -0
  9. data/autohotkey/config/tools/table_manager/OneDimensionalTable_def.txt +27 -15
  10. data/autohotkey/config/tools/table_manager/TwoDimensionalTable_def.txt +12 -232
  11. data/autohotkey/procedures/example_test.rb +4 -0
  12. data/autohotkey/tools/TableManagerAHK +4 -9
  13. data/autohotkey/tools/TableManagerAHK2 +18 -0
  14. data/autohotkey/tools/TableManagerAHK3 +18 -0
  15. data/autohotkey/tools/TableManagerAHK4 +24 -0
  16. data/autohotkey/tools/TlmViewerAHK +1 -1
  17. data/autohotkey/tools/autohotkey.rb +2 -1
  18. data/autohotkey/tools/open_gl_builder.ahk +1 -1
  19. data/autohotkey/tools/table_manager.ahk +141 -70
  20. data/cosmos.gemspec +3 -3
  21. data/data/crc.txt +70 -68
  22. data/data/legal.txt +4 -5
  23. data/demo/config/data/crc.txt +10 -9
  24. data/demo/config/targets/INST/screens/_footer.txt +4 -0
  25. data/demo/config/targets/INST/screens/hs.txt +1 -6
  26. data/demo/config/targets/INST/screens/limits.txt +3 -11
  27. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +1 -0
  28. data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +33 -22
  29. data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +30 -22
  30. data/demo/config/tools/table_manager/PPSSelectionTable_def.txt +8 -7
  31. data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +13 -13
  32. data/demo/lib/example_background_task.rb +6 -12
  33. data/demo/procedures/example_test.rb +5 -0
  34. data/lib/cosmos/conversions/conversion.rb +3 -7
  35. data/lib/cosmos/core_ext/class.rb +3 -1
  36. data/lib/cosmos/core_ext/file.rb +1 -0
  37. data/lib/cosmos/core_ext/io.rb +18 -0
  38. data/lib/cosmos/core_ext/range.rb +1 -5
  39. data/lib/cosmos/core_ext/time.rb +3 -3
  40. data/lib/cosmos/gui/dialogs/about_dialog.rb +60 -36
  41. data/lib/cosmos/gui/dialogs/calendar_dialog.rb +10 -14
  42. data/lib/cosmos/gui/dialogs/cmd_details_dialog.rb +4 -5
  43. data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +31 -17
  44. data/lib/cosmos/gui/dialogs/details_dialog.rb +63 -47
  45. data/lib/cosmos/gui/dialogs/exception_dialog.rb +77 -68
  46. data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +6 -5
  47. data/lib/cosmos/gui/dialogs/legal_dialog.rb +34 -21
  48. data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +19 -43
  49. data/lib/cosmos/gui/dialogs/progress_dialog.rb +79 -42
  50. data/lib/cosmos/gui/dialogs/pry_dialog.rb +9 -5
  51. data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +6 -4
  52. data/lib/cosmos/gui/dialogs/select_dialog.rb +23 -18
  53. data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +34 -10
  54. data/lib/cosmos/gui/dialogs/splash.rb +18 -8
  55. data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +38 -43
  56. data/lib/cosmos/gui/dialogs/tlm_edit_dialog.rb +51 -53
  57. data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +1 -1
  58. data/lib/cosmos/gui/line_graph/lines.rb +1 -1
  59. data/lib/cosmos/gui/qt.rb +9 -2
  60. data/lib/cosmos/gui/qt_tool.rb +50 -8
  61. data/lib/cosmos/gui/widgets/packet_log_frame.rb +53 -27
  62. data/lib/cosmos/interfaces/linc_interface.rb +103 -62
  63. data/lib/cosmos/io/json_drb_object.rb +3 -3
  64. data/lib/cosmos/io/raw_logger.rb +4 -8
  65. data/lib/cosmos/io/tcpip_server.rb +2 -2
  66. data/lib/cosmos/packets/binary_accessor.rb +1 -1
  67. data/lib/cosmos/packets/limits.rb +2 -5
  68. data/lib/cosmos/packets/packet.rb +1 -1
  69. data/lib/cosmos/packets/packet_config.rb +54 -19
  70. data/lib/cosmos/packets/parsers/packet_item_parser.rb +7 -1
  71. data/lib/cosmos/script/scripting.rb +4 -5
  72. data/lib/cosmos/system/system.rb +2 -1
  73. data/lib/cosmos/system/target.rb +4 -0
  74. data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +13 -5
  75. data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +37 -27
  76. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +6 -2
  77. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +7 -5
  78. data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +21 -10
  79. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +11 -11
  80. data/lib/cosmos/tools/script_runner/script_runner.rb +2 -18
  81. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +6 -6
  82. data/lib/cosmos/tools/table_manager/table.rb +32 -41
  83. data/lib/cosmos/tools/table_manager/table_config.rb +140 -729
  84. data/lib/cosmos/tools/table_manager/table_item.rb +20 -36
  85. data/lib/cosmos/tools/table_manager/table_item_parser.rb +46 -0
  86. data/lib/cosmos/tools/table_manager/table_manager.rb +754 -691
  87. data/lib/cosmos/tools/table_manager/table_manager_core.rb +172 -358
  88. data/lib/cosmos/tools/table_manager/table_parser.rb +75 -0
  89. data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
  90. data/lib/cosmos/tools/test_runner/test_runner.rb +11 -0
  91. data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +2 -2
  92. data/lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb +2 -2
  93. data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +2 -2
  94. data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +4 -4
  95. data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +13 -13
  96. data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +9 -9
  97. data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +9 -9
  98. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +4 -4
  99. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +1 -1
  100. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +8 -18
  101. data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +7 -4
  102. data/lib/cosmos/top_level.rb +12 -0
  103. data/lib/cosmos/version.rb +5 -5
  104. data/run_gui_tests.bat +6 -0
  105. data/spec/core_ext/array_spec.rb +1 -1
  106. data/spec/interfaces/linc_interface_spec.rb +4 -4
  107. data/spec/io/json_drb_spec.rb +2 -2
  108. data/spec/io/json_rpc_spec.rb +1 -1
  109. data/spec/io/raw_logger_spec.rb +5 -1
  110. data/spec/packet_logs/packet_log_writer_spec.rb +1 -1
  111. data/spec/packets/packet_config_spec.rb +144 -0
  112. data/spec/packets/parsers/packet_item_parser_spec.rb +60 -0
  113. data/spec/spec_helper.rb +11 -0
  114. data/spec/system/target_spec.rb +5 -1
  115. data/spec/tools/cmd_tlm_server/background_task_spec.rb +15 -3
  116. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +117 -31
  117. data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +4 -0
  118. data/spec/tools/launcher/launcher_config_spec.rb +1 -1
  119. data/spec/tools/table_manager/table_config_spec.rb +226 -0
  120. data/spec/tools/table_manager/table_item_spec.rb +57 -0
  121. data/spec/tools/table_manager/table_parser_spec.rb +96 -0
  122. data/spec/tools/table_manager/table_spec.rb +90 -0
  123. data/spec/tools/table_manager/tablemanager_core_spec.rb +557 -0
  124. data/spec/top_level/top_level_spec.rb +9 -0
  125. data/spec/utilities/csv_spec.rb +3 -3
  126. metadata +30 -11
@@ -1,25 +1,33 @@
1
- TABLE "MC Configuration" "Memory Control Configuration Table" ONE_DIMENSIONAL BIG_ENDIAN 9
2
- PARAMETER "Scrub Region 1 Start Addr" "Scrub Region 1 Start Address" UINT 32 HEX 0 0x03FFFFFB 0
3
- PARAMETER "Scrub Region 1 End Addr" "Scrub Region 1 End Address" UINT 32 HEX 0 0x03FFFFFF 0x03FFFFFF
4
- PARAMETER "Scrub Region 1 Error Check Size" "Scrub Region 1 Error Check Size" UINT 32 HEX 0 0x03FFFFFB 0x10000
5
- PARAMETER "Scrub Region 1 Throttle Count" "Scrub Region 1 Throttle Count" UINT 32 DEC 0 0x03FFFFFF 6000
6
- PARAMETER "Scrub Region 1 Throttle Ticks" "Scrub Region 1 Throttle Ticks" UINT 32 DEC 0 0x0FFFFFFFF 2
7
- PARAMETER "Scrub Region 2 Start Addr" "Scrub Region 2 Start Address" UINT 32 HEX 0 0x03FFFFB 0
8
- PARAMETER "Scrub Region 2 End Addr" "Scrub Region 2 End Address" UINT 32 HEX 0 0x03FFFFF 0x03FFFFF
9
- PARAMETER "Scrub Region 2 Error Check Size" "Scrub Region 2 Error Check Size" UINT 32 HEX 0 0x03FFFFF 0x10000
10
- PARAMETER "Scrub Region 2 Throttle Count" "Scrub Region 2 Throttle Count" UINT 32 DEC 0 0x03FFFFF 6000
11
- PARAMETER "Scrub Region 2 Throttle Ticks" "Scrub Region 2 Throttle Ticks" UINT 32 DEC 0 0x0FFFFFFFF 2
12
- PARAMETER "Dump Packet Throttle (sec)" "Number of seconds to wait between dumping large (>65k) packets" UINT 32 DEC 0 0x0FFFFFFFF 2
13
- PARAMETER "Memory Scrubbing" "Memory Scrubbing" UINT 8 STATE 0 1 1
1
+ TABLE "MC Configuration" BIG_ENDIAN ONE_DIMENSIONAL "Memory Control Configuration Table"
2
+ APPEND_PARAMETER "Scrub Region 1 Start Addr" 32 UINT 0 0x03FFFFFB 0
3
+ FORMAT_STRING "0x%0X"
4
+ APPEND_PARAMETER "Scrub Region 1 End Addr" 32 UINT 0 0x03FFFFFF 0x03FFFFFF
5
+ FORMAT_STRING "0x%0X"
6
+ APPEND_PARAMETER "Scrub Region 1 Error Check Size" 32 UINT 0 0x03FFFFFB 0x10000
7
+ FORMAT_STRING "0x%0X"
8
+ APPEND_PARAMETER "Scrub Region 1 Throttle Count" 32 UINT 0 0x03FFFFFF 6000
9
+ FORMAT_STRING "0x%0X"
10
+ APPEND_PARAMETER "Scrub Region 1 Throttle Ticks" 32 UINT 0 0x0FFFFFFFF 2
11
+ FORMAT_STRING "0x%0X"
12
+ APPEND_PARAMETER "Scrub Region 2 Start Addr" 32 UINT 0 0x03FFFFB 0
13
+ FORMAT_STRING "0x%0X"
14
+ APPEND_PARAMETER "Scrub Region 2 End Addr" 32 UINT 0 0x03FFFFF 0x03FFFFF
15
+ FORMAT_STRING "0x%0X"
16
+ APPEND_PARAMETER "Scrub Region 2 Error Check Size" 32 UINT 0 0x03FFFFF 0x10000
17
+ FORMAT_STRING "0x%0X"
18
+ APPEND_PARAMETER "Scrub Region 2 Throttle Count" 32 UINT 0 0x03FFFFF 6000
19
+ APPEND_PARAMETER "Scrub Region 2 Throttle Ticks" 32 UINT 0 0x0FFFFFFFF 2
20
+ APPEND_PARAMETER "Dump Packet Throttle (sec)" 32 UINT 0 0x0FFFFFFFF 2 "Number of seconds to wait between dumping large packets"
21
+ APPEND_PARAMETER "Memory Scrubbing" 8 UINT 0 1 1
14
22
  STATE DISABLE 0
15
23
  STATE ENABLE 1
16
- PARAMETER "SIOC Memory Config" "SIOC Memory Config" UINT 8 DEC 1 3 3
17
- CONSTRAINT_START
18
- if packet.read("Memory Scrubbing") == 'DISABLE'
19
- packet.get_item("SIOC Memory Config").range = (10..20)
20
- else
21
- packet.get_item("SIOC Memory Config").range = (1..3)
22
- end
23
- CONSTRAINT_END
24
- PARAMETER "Pad" "Pad" UINT 16 HEX-U 0 0 0
24
+ APPEND_PARAMETER "SIOC Memory Config" 8 UINT 1 3 3
25
+ #CONSTRAINT_START
26
+ # if packet.read("Memory Scrubbing") == 'DISABLE'
27
+ # packet.get_item("SIOC Memory Config").range = (10..20)
28
+ # else
29
+ # packet.get_item("SIOC Memory Config").range = (1..3)
30
+ # end
31
+ #CONSTRAINT_END
32
+ APPEND_PARAMETER "Pad" 16 UINT 0 0 0
25
33
 
@@ -1,8 +1,9 @@
1
- TABLE "PPS Selection" "Payload Clock Control Pulse Per Second Selection Table" ONE_DIMENSIONAL BIG_ENDIAN 10
2
- PARAMETER "Primary PPS" "Primary PPS" UINT 8 STATE 0 1 1
3
- STATE DISABLE 0
4
- STATE ENABLE 1
5
- PARAMETER "Redundant PPS" "Redundant PPS" UINT 8 STATE 0 1 0
6
- STATE DISABLE 0
7
- STATE ENABLE 1
1
+ TABLE "PPS Selection" BIG_ENDIAN ONE_DIMENSIONAL "Payload Clock Control Pulse Per Second Selection Table"
2
+ APPEND_PARAMETER "Primary PPS" 8 UINT 0 1 1
3
+ STATE CHECKED 1
4
+ STATE UNCHECKED 0
5
+ APPEND_PARAMETER "Redundant PPS" 8 UINT 0 1 1
6
+ UNEDITABLE
7
+ STATE UNCHECKED 0
8
+ STATE CHECKED 1
8
9
 
@@ -1,31 +1,31 @@
1
- TABLE "TLM Monitoring" "Telemetry Monitoring Table" TWO_DIMENSIONAL BIG_ENDIAN 4
2
- PARAMETER "Threshold" "Telemetry item threshold at which point persistance is incremented" UINT 32 HEX 0 4294967295 0
3
- PARAMETER "Offset" "Offset into the telemetry packet to monitor" UINT 32 DEC 0 4294967295 0
4
- PARAMETER "Data Size" "Amount of data to monitor (bytes)" UINT 32 STATE 0 3 0
1
+ TABLE "TLM Monitoring" BIG_ENDIAN TWO_DIMENSIONAL 200 "Telemetry Monitoring Table"
2
+ APPEND_PARAMETER "Threshold" 32 UINT MIN MAX 0 "Telemetry item threshold at which point persistance is incremented"
3
+ APPEND_PARAMETER "Offset" 32 UINT MIN MAX 0 "Offset into the telemetry packet to monitor"
4
+ APPEND_PARAMETER "Data Size" 32 UINT 0 3 0 "Amount of data to monitor (bytes)"
5
5
  STATE BITS 0
6
6
  STATE BYTE 1
7
7
  STATE WORD 2
8
8
  STATE LONGWORD 3
9
- PARAMETER "Bit Mask" "Bit Mask to apply to the Data Size before the value is compared ot the Threshold" UINT 32 HEX 0 4294967295 0
10
- PARAMETER "Persistence" "Number of times the Threshold must be exceeded before Action is triggered" UINT 32 DEC 0 4294967295 0
11
- PARAMETER "Type" "How the Threshold is compared against" UINT 32 STATE 0 3 0
9
+ APPEND_PARAMETER "Bit Mask" 32 UINT MIN MAX 0 "Bit Mask to apply to the Data Size before the value is compared ot the Threshold"
10
+ APPEND_PARAMETER "Persistence" 32 UINT MIN MAX 0 "Number of times the Threshold must be exceeded before Action is triggered"
11
+ APPEND_PARAMETER "Type" 32 UINT 0 3 0 "How the Threshold is compared against"
12
12
  STATE LESS_THAN 0
13
13
  STATE GREATER_THAN 1
14
14
  STATE EQUAL_TO 2
15
15
  STATE NOT_EQUAL_TO 3
16
- PARAMETER "Action" "Action to take when Persistance is met" UINT 32 STATE 0 4 0
16
+ APPEND_PARAMETER "Action" 32 UINT 0 4 0 "Action to take when Persistance is met"
17
17
  STATE NO_ACTION_REQUIRED 0
18
18
  STATE INITIATE_RESET 1
19
19
  STATE CHANGE_MODE_SAFE 2
20
- PARAMETER "Group" "Telemetry group this monitor item belongs to. Groups are automatically enabled due to payload events." UINT 32 STATE 1 4 1
20
+ APPEND_PARAMETER "Group" 32 UINT 1 4 1 "Telemetry group this monitor item belongs to. Groups are automatically enabled due to payload events."
21
21
  STATE ALL_MODES 1
22
22
  STATE SAFE_MODE 2
23
- PARAMETER "Signed" "Whether to treat the Data Size data as signed or unsigned when comparing to the Threshold" UINT 8 STATE 0 2 0
23
+ APPEND_PARAMETER "Signed" 8 UINT 0 2 0 "Whether to treat the Data Size data as signed or unsigned when comparing to the Threshold"
24
24
  STATE NOT_APPLICABLE 0
25
25
  STATE UNSIGNED 1
26
26
  STATE SIGNED 2
27
27
 
28
- <% 200.times do %>
29
- DEFAULT 0x0 0 BITS 0x0 0 LESS_THAN NO_ACTION_REQUIRED ALL_MODES UNSIGNED
30
- <% end %>
28
+ #<% 200.times do %>
29
+ # DEFAULT 0x0 0 BITS 0x0 0 LESS_THAN NO_ACTION_REQUIRED ALL_MODES UNSIGNED
30
+ #<% end %>
31
31
 
@@ -13,25 +13,20 @@
13
13
  require 'cosmos/tools/cmd_tlm_server/background_task'
14
14
 
15
15
  module Cosmos
16
-
17
- # ExampleBackgroundTask class
18
- #
19
- # This class is an example background task
20
- #
16
+ # Starts by sleeping 5 seconds then sends up to three collect commands
21
17
  class ExampleBackgroundTask < BackgroundTask
22
-
23
18
  def initialize
24
19
  super()
25
20
  @name = 'Example Background Task'
26
- @sleeper = Sleeper.new
27
21
  end
28
22
 
29
23
  def call
30
24
  sent_count = 0
25
+ @sleeper = Sleeper.new
31
26
  @status = "Sleeping for 5 seconds"
32
27
  return if @sleeper.sleep(5) # allow interfaces time to start
33
28
  loop do
34
- #Make sure we start up with 3 collects
29
+ # Start up with at least 3 collects
35
30
  if (tlm('INST', 'HEALTH_STATUS', 'COLLECTS') < 3)
36
31
  begin
37
32
  cmd('INST', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 1)
@@ -50,8 +45,7 @@ module Cosmos
50
45
 
51
46
  def stop
52
47
  @sleeper.cancel
48
+ @status = "Stopped at #{Time.now.formatted}"
53
49
  end
54
-
55
- end # class ExampleBackgroundTask
56
-
57
- end # module Cosmos
50
+ end
51
+ end
@@ -11,12 +11,14 @@ class ExampleTest < Cosmos::Test
11
11
 
12
12
  # Setup the test case by doing stuff
13
13
  def setup
14
+ status_bar("setup")
14
15
  puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
15
16
  wait(2)
16
17
  end
17
18
 
18
19
  # test_1 verifies requirement 1
19
20
  def test_case_with_long_name_1
21
+ status_bar("test_case_with_long_name_1")
20
22
  puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
21
23
  Cosmos::Test.puts "This test verifies requirement 1"
22
24
  wait(2)
@@ -24,6 +26,7 @@ class ExampleTest < Cosmos::Test
24
26
 
25
27
  # test_2 verifies requirement 2
26
28
  def test_2
29
+ status_bar("test_2")
27
30
  puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
28
31
  Cosmos::Test.puts "This test verifies requirement 2"
29
32
  if $manual
@@ -35,12 +38,14 @@ class ExampleTest < Cosmos::Test
35
38
  end
36
39
 
37
40
  def test_3xx
41
+ status_bar("test_3xx")
38
42
  puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
39
43
  wait 1
40
44
  end
41
45
 
42
46
  # Teardown the test case by doing other stuff
43
47
  def teardown
48
+ status_bar("teardown")
44
49
  puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
45
50
  wait(2)
46
51
  end
@@ -9,10 +9,8 @@
9
9
  # attribution addendums as found in the LICENSE.txt
10
10
 
11
11
  module Cosmos
12
-
13
12
  # Performs a general conversion via the implementation of the call method
14
13
  class Conversion
15
-
16
14
  # @return [Symbol] The converted data type. Must be one of
17
15
  # {Cosmos::StructureItem#data_type}
18
16
  attr_reader :converted_type
@@ -42,12 +40,10 @@ module Cosmos
42
40
  self.class.to_s.split('::')[-1]
43
41
  end
44
42
 
45
- # @param (see Conversion#to_config)
43
+ # @param read_or_write [String] Either 'READ' or 'WRITE'
46
44
  # @return [String] Config fragment for this conversion
47
45
  def to_config(read_or_write)
48
46
  " #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename}\n"
49
47
  end
50
-
51
- end # class Conversion
52
-
53
- end # module Cosmos
48
+ end
49
+ end
@@ -32,7 +32,7 @@ class Class
32
32
  # MyClass.test # returns "Test"
33
33
  #
34
34
  # @param args [Array<Symbol>] Array of symbols which should be turned into
35
- # instance variables with class method accessors
35
+ # instance variables with class method readers
36
36
  def instance_attr_reader(*args)
37
37
  args.each do |arg|
38
38
  self.class_eval("def #{arg};@#{arg};end")
@@ -40,6 +40,8 @@ class Class
40
40
  end
41
41
  end
42
42
 
43
+ # @param args [Array<Symbol>] Array of symbols which should be turned into
44
+ # instance variables with class method accessors (read and write)
43
45
  def instance_attr_accessor(*args)
44
46
  args.each do |arg|
45
47
  self.class_eval("def #{arg};@#{arg};end")
@@ -12,6 +12,7 @@ require 'find'
12
12
 
13
13
  # COSMOS specific additions to the Ruby File class
14
14
  class File
15
+ # Non printable ASCII characters
15
16
  NON_ASCII_PRINTABLE = /[^\x21-\x7e\s]/
16
17
 
17
18
  # @return [Boolean] Whether the file only contains ASCII characters
@@ -13,9 +13,23 @@ require 'cosmos/core_ext/cosmos_io'
13
13
  class IO
14
14
  include CosmosIO
15
15
 
16
+ # Initial timeout to call IO.select with. Timeouts are increased by doubling
17
+ # this value until the SELET_MAX_TIMEOUT value is reached.
16
18
  SELECT_BASE_TIMEOUT = 0.0004
19
+ # The maximum timeout at which point we call IO.select with whatever
20
+ # remaining timeout is left.
17
21
  SELECT_MAX_TIMEOUT = 0.016
18
22
 
23
+ # The method is identical to IO.select but instead of calling IO.select with
24
+ # the full timeout, it calls IO.select with a small timeout and then
25
+ # doubles the timeout twice until eventually it calls IO.select with the
26
+ # remaining passed in timeout value.
27
+ # TODO: Ryan why was this originally done?
28
+ #
29
+ # @param read_sockets [Array<IO>] IO objects to wait to be ready to read
30
+ # @param write_sockets [Array<IO>] IO objects to wait to be ready to write
31
+ # @param error_array [Array<IO>] IO objects to wait for exceptions
32
+ # @param timeout [Numeric] Number of seconds to wait
19
33
  def self.fast_select(read_sockets = nil, write_sockets = nil, error_array = nil, timeout = nil)
20
34
  # Always try a zero timeout first
21
35
  current_timeout = SELECT_BASE_TIMEOUT
@@ -65,10 +79,14 @@ class IO
65
79
  end # while true
66
80
  end # fast_select
67
81
 
82
+ # @param read_sockets [Array<IO>] IO objects to wait to be ready to read
83
+ # @param timeout [Numeric] Number of seconds to wait
68
84
  def self.fast_read_select(read_sockets, timeout)
69
85
  return fast_select(read_sockets, nil, nil, timeout)
70
86
  end
71
87
 
88
+ # @param write_sockets [Array<IO>] IO objects to wait to be ready to write
89
+ # @param timeout [Numeric] Number of seconds to wait
72
90
  def self.fast_write_select(write_sockets, timeout)
73
91
  return fast_select(nil, write_sockets, nil, timeout)
74
92
  end
@@ -13,10 +13,6 @@ class Range
13
13
  # @return [Array<Float>] Array of each value within the Range converted to
14
14
  # Float
15
15
  def to_a_to_f
16
- array = []
17
- self.each do |value|
18
- array << value.to_f
19
- end
20
- array
16
+ collect {|value| value.to_f }
21
17
  end
22
18
  end
@@ -339,7 +339,7 @@ class Time
339
339
  (day + JULIAN_DATE_OF_CCSDS_EPOCH) + ((ms.to_f + (us / 1000.0)) / MSEC_PER_DAY_FLOAT)
340
340
  end
341
341
 
342
- # @param [Float] julian date
342
+ # @param jdate [Float] julian date
343
343
  # @return [Array<day, ms, us>] Julian converted to CCSDS
344
344
  def self.julian2ccsds(jdate)
345
345
  day = jdate - JULIAN_DATE_OF_CCSDS_EPOCH
@@ -363,8 +363,8 @@ class Time
363
363
  (self.ccsds2julian(day, ms, us) - sec_epoch_jd) * SEC_PER_DAY_FLOAT
364
364
  end
365
365
 
366
- # @param seconds [Float]
367
- # @param sec_epoch_jd [Float] Epoch to of seconds value
366
+ # @param sec [Float] Number of seconds to convert
367
+ # @param sec_epoch_jd [Float] Epoch of seconds value
368
368
  # @return [Array<day, ms, us>] CCSDS date
369
369
  def self.sec2ccsds(sec, sec_epoch_jd = JULIAN_DATE_OF_CCSDS_EPOCH)
370
370
  self.julian2ccsds((sec / SEC_PER_DAY_FLOAT) + sec_epoch_jd)
@@ -9,56 +9,77 @@
9
9
  # attribution addendums as found in the LICENSE.txt
10
10
 
11
11
  module Cosmos
12
-
12
+ # Help->About dialog which is part of all COSMOS tools. Displays the license,
13
+ # software versions, environment variables, and general COSMOS information.
14
+ # Also provides a backdoor to a PRY dialog to aid in debugging. See
15
+ # {PryDialog} for more details.
13
16
  class AboutDialog < Qt::Dialog
14
- ABOUT_COSMOS = ''
15
- ABOUT_COSMOS << "COSMOS application icons are courtesy of http://icons8.com.\n"
16
- ABOUT_COSMOS << "COSMOS application sounds are courtesy of http://www.freesfx.co.uk.\n"
17
- ABOUT_COSMOS << "\n"
18
- ABOUT_COSMOS << "COSMOS utilizes the QtRuby (http://rubyforge.org/projects/korundum) library under "
19
- ABOUT_COSMOS << "the GNU Lesser General Public License. QtRuby is a Ruby extension module that provides an "
20
- ABOUT_COSMOS << "interface to the Qt Gui Toolkit (http://qt-project.org) by Digia "
21
- ABOUT_COSMOS << "under the GNU Lesser General Public License.\n"
22
- ABOUT_COSMOS << "\n"
23
- ABOUT_COSMOS << "Ruby Version: ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]\n"
24
- ABOUT_COSMOS << "Rubygems Version: #{Gem::VERSION}\n"
25
- ABOUT_COSMOS << "Qt Version: #{Qt::qVersion}\n"
26
- ABOUT_COSMOS << "Cosmos::PATH: #{Cosmos::PATH}\n"
27
- ABOUT_COSMOS << "Cosmos::USERPATH: #{Cosmos::USERPATH}\n"
28
- ABOUT_COSMOS << "\n"
29
- ABOUT_COSMOS << "Environment Variables:\n"
30
- ABOUT_COSMOS << "RUBYLIB: #{ENV['RUBYLIB']}\n"
31
- ABOUT_COSMOS << "RUBYOPT: #{ENV['RUBYOPT']}\n"
32
- ABOUT_COSMOS << "GEM_PATH: #{ENV['GEM_PATH']}\n"
33
- ABOUT_COSMOS << "GEM_HOME: #{ENV['GEM_HOME']}\n"
34
- ABOUT_COSMOS << "\n"
35
- ABOUT_COSMOS << "Loaded Gems:\n"
17
+ # About text to display in the dialog
18
+ ABOUT_COSMOS = "COSMOS application icons are courtesy of http://icons8.com.\n"\
19
+ "COSMOS application sounds are courtesy of http://www.freesfx.co.uk.\n"\
20
+ "\n"\
21
+ "COSMOS utilizes the QtRuby (http://rubyforge.org/projects/korundum) "\
22
+ "library under the GNU Lesser General Public License. "\
23
+ "QtRuby is a Ruby extension module that provides an "\
24
+ "interface to the Qt Gui Toolkit (http://qt-project.org) by Digia "\
25
+ "under the GNU Lesser General Public License.\n\n"\
26
+ "Ruby Version: ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} "\
27
+ "patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]\n"\
28
+ "Rubygems Version: #{Gem::VERSION}\n"\
29
+ "Qt Version: #{Qt::qVersion}\n"\
30
+ "Cosmos::PATH: #{Cosmos::PATH}\n"\
31
+ "Cosmos::USERPATH: #{Cosmos::USERPATH}\n\n"\
32
+ "Environment Variables:\n"\
33
+ "RUBYLIB: #{ENV['RUBYLIB']}\n"\
34
+ "RUBYOPT: #{ENV['RUBYOPT']}\n"\
35
+ "GEM_PATH: #{ENV['GEM_PATH']}\n"\
36
+ "GEM_HOME: #{ENV['GEM_HOME']}\n\n"\
37
+ "Loaded Gems:\n"
36
38
  Gem.loaded_specs.values.map {|x| ABOUT_COSMOS << "#{x.name} #{x.version} #{x.platform}\n"}
37
39
 
38
40
  @@pry_dialogs = []
39
41
 
40
- def initialize (parent, about_string)
42
+ # @param parent [Qt::Widget] Part of the dialog (the application)
43
+ # @param about_string [String] Application specific informational text
44
+ def initialize(parent, about_string)
41
45
  super(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
42
46
  @saved_text = ''
43
47
  setWindowTitle('About')
44
48
 
45
- # Get Word Icon
46
49
  filename = File.join(::Cosmos::USERPATH, 'config', 'data', 'cosmos_word.gif')
47
50
  filename = File.join(::Cosmos::PATH, 'data', 'cosmos_word.gif') unless File.exist?(filename)
48
51
  word_icon = Qt::Label.new
49
52
  word_icon.setPixmap(Qt::Pixmap.new(filename))
50
53
 
51
- copyright = Qt::Label.new("Copyright 2014 - Ball Aerospace & Technologies Corp.")
54
+ copyright = Qt::Label.new("Copyright 2017 - Ball Aerospace & Technologies Corp.")
55
+ copyright.setFont(Cosmos.getFont("Arial", 12))
52
56
  authors = Qt::Label.new("Created by Ryan Melton (ryanmelt) and Jason Thomas (jmthomas)")
53
- ver = Qt::Label.new("Version: " + COSMOS_VERSION)
54
- user_ver = nil
55
- user_ver = Qt::Label.new("User Version: " + USER_VERSION) if defined? USER_VERSION and USER_VERSION != 'Unofficial'
57
+ authors.setFont(Cosmos.getFont("Arial", 12))
58
+
59
+ cosmos_layout = Qt::GridLayout.new
60
+ version = Qt::Label.new("Version: " + COSMOS_VERSION)
61
+ version.setFont(Cosmos.getFont("Arial", 14))
62
+ open_cosmos_code = Qt::PushButton.new("Open COSMOS Gem Code") do
63
+ connect(SIGNAL('clicked()')) { Cosmos.open_file_browser(Cosmos::PATH) }
64
+ end
65
+ cosmos_layout.addWidget(version, 0, 0)
66
+ cosmos_layout.addWidget(open_cosmos_code, 0, 1)
67
+
68
+ if USER_VERSION && USER_VERSION != 'Unofficial'
69
+ user_version = Qt::Label.new("Project Version: " + USER_VERSION)
70
+ user_version.setFont(Cosmos.getFont("Arial", 14))
71
+ cosmos_layout.addWidget(user_version, 1, 0)
72
+ end
73
+ open_user_code = Qt::PushButton.new("Open Project Code") do
74
+ connect(SIGNAL('clicked()')) { Cosmos.open_file_browser(Cosmos::USERPATH) }
75
+ end
76
+ cosmos_layout.addWidget(open_user_code, 1, 1)
77
+
56
78
  icon_layout = Qt::VBoxLayout.new do
57
79
  addWidget(word_icon)
58
80
  addWidget(copyright)
59
81
  addWidget(authors)
60
- addWidget(ver)
61
- addWidget(user_ver) if user_ver
82
+ addLayout(cosmos_layout)
62
83
  addStretch
63
84
  end
64
85
 
@@ -68,7 +89,9 @@ module Cosmos
68
89
  configurable_about_text = File.read(filename)
69
90
  configurable_about_text.gsub!("\r", '') unless Kernel.is_windows?
70
91
  if Kernel.is_windows?
71
- configurable_about_text << "\n" + "Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width + 16} height:#{parent.frameGeometry.height + 38}\n\n" + ABOUT_COSMOS
92
+ configurable_about_text << "\n" \
93
+ "Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width + 16} " \
94
+ "height:#{parent.frameGeometry.height + 38}\n\n" + ABOUT_COSMOS
72
95
  else
73
96
  configurable_about_text << "\n" + "Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width} height:#{parent.frameGeometry.height}\n\n" + ABOUT_COSMOS end
74
97
 
@@ -104,11 +127,14 @@ module Cosmos
104
127
  end
105
128
 
106
129
  setMaximumWidth(800)
130
+ ok.setFocus
107
131
  self.raise()
108
132
  exec()
109
133
  dispose()
110
134
  end
111
135
 
136
+ # Register key press events to listen for 'p', 'r', 'y' and popup a {PryDialog}
137
+ # @param event [Qt::Event] The keypress event
112
138
  def keyPressEvent(event)
113
139
  @saved_text << event.text.to_s
114
140
  if @saved_text[0] == 'p'
@@ -131,7 +157,5 @@ module Cosmos
131
157
  end
132
158
  super(event)
133
159
  end
134
-
135
- end # class AboutDialog
136
-
137
- end # module Cosmos
160
+ end
161
+ end