cosmos 4.2.4-java → 4.3.0-java

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.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/Manifest.txt +12 -0
  5. data/autohotkey/tools/cmd_sequence.ahk +21 -20
  6. data/autohotkey/tools/cmd_sequence2.ahk +1 -1
  7. data/autohotkey/tools/config_editor.ahk +1 -1
  8. data/autohotkey/tools/launcher.ahk +1 -0
  9. data/autohotkey/tools/packet_viewer.ahk +6 -5
  10. data/autohotkey/tools/test_runner.ahk +8 -8
  11. data/bin/cosmos +37 -0
  12. data/bin/dart_util +0 -0
  13. data/data/config/item_modifiers.yaml +9 -0
  14. data/data/crc.txt +91 -86
  15. data/demo/Rakefile +2 -0
  16. data/demo/config/dart/Gemfile +1 -1
  17. data/demo/config/data/crc.txt +8 -5
  18. data/demo/config/system/system.txt +28 -0
  19. data/demo/config/system/system2.txt +21 -3
  20. data/demo/config/system/system_alt_ports.txt +69 -0
  21. data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +1 -0
  22. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server_chain.txt +18 -0
  23. data/demo/procedures/cosmos_api_test.rb +18 -14
  24. data/demo/procedures/local_screen_example.rb +51 -0
  25. data/ext/cosmos/ext/cosmos_io/cosmos_io.c +32 -4
  26. data/ext/cosmos/ext/packet/packet.c +6 -0
  27. data/ext/mkrf_conf.rb +2 -2
  28. data/install/config/dart/Gemfile +1 -1
  29. data/install/config/data/crc.txt +2 -2
  30. data/install/config/system/system.txt +23 -1
  31. data/lib/cosmos/conversions.rb +2 -0
  32. data/lib/cosmos/conversions/packet_time_formatted_conversion.rb +38 -0
  33. data/lib/cosmos/conversions/packet_time_seconds_conversion.rb +38 -0
  34. data/lib/cosmos/core_ext/cosmos_io.rb +2 -1
  35. data/lib/cosmos/dart/Gemfile +1 -1
  36. data/lib/cosmos/dart/examples/dart_stream_client.rb +6 -2
  37. data/lib/cosmos/dart/lib/dart_common.rb +1 -1
  38. data/lib/cosmos/dart/lib/dart_database_cleaner.rb +2 -2
  39. data/lib/cosmos/dart/lib/dart_decommutator.rb +4 -4
  40. data/lib/cosmos/dart/lib/dart_importer.rb +3 -3
  41. data/lib/cosmos/dart/lib/dart_packet_log_writer.rb +2 -2
  42. data/lib/cosmos/dart/processes/dart_ingester.rb +2 -0
  43. data/lib/cosmos/dart/processes/dart_util.rb +4 -4
  44. data/lib/cosmos/dart/spec/dart/dart_reducer_manager_spec.rb +3 -3
  45. data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +9 -5
  46. data/lib/cosmos/gui/dialogs/details_dialog.rb +29 -29
  47. data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +1 -1
  48. data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +3 -3
  49. data/lib/cosmos/gui/dialogs/interface_raw_dialog.rb +2 -2
  50. data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +1 -1
  51. data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +10 -10
  52. data/lib/cosmos/gui/qt.rb +10 -1
  53. data/lib/cosmos/gui/qt_tool.rb +17 -10
  54. data/lib/cosmos/gui/text/ruby_editor.rb +47 -8
  55. data/lib/cosmos/gui/utilities/classification_banner.rb +60 -0
  56. data/lib/cosmos/gui/utilities/script_module_gui.rb +26 -0
  57. data/lib/cosmos/interfaces.rb +1 -0
  58. data/lib/cosmos/interfaces/interface.rb +4 -0
  59. data/lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb +46 -0
  60. data/lib/cosmos/interfaces/protocols/preidentified_protocol.rb +68 -23
  61. data/lib/cosmos/packet_logs/packet_log_reader.rb +69 -26
  62. data/lib/cosmos/packet_logs/packet_log_writer.rb +13 -1
  63. data/lib/cosmos/packets/commands.rb +5 -1
  64. data/lib/cosmos/packets/packet.rb +36 -2
  65. data/lib/cosmos/packets/packet_config.rb +0 -1
  66. data/lib/cosmos/packets/parsers/format_string_parser.rb +0 -1
  67. data/lib/cosmos/packets/parsers/xtce_parser.rb +1 -1
  68. data/lib/cosmos/packets/telemetry.rb +4 -0
  69. data/lib/cosmos/script/api_shared.rb +2 -0
  70. data/lib/cosmos/script/limits.rb +4 -0
  71. data/lib/cosmos/script/script.rb +27 -11
  72. data/lib/cosmos/script/telemetry.rb +3 -1
  73. data/lib/cosmos/script/tools.rb +18 -8
  74. data/lib/cosmos/system/system.rb +21 -0
  75. data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +26 -24
  76. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +29 -29
  77. data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +65 -40
  78. data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +6 -6
  79. data/lib/cosmos/tools/cmd_tlm_server/api.rb +13 -0
  80. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +12 -9
  81. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +7 -1
  82. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +8 -8
  83. data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +13 -2
  84. data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +2 -2
  85. data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +13 -13
  86. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +4 -4
  87. data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +8 -8
  88. data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +5 -5
  89. data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +35 -20
  90. data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +15 -11
  91. data/lib/cosmos/tools/config_editor/config_editor.rb +69 -69
  92. data/lib/cosmos/tools/data_viewer/data_viewer.rb +42 -38
  93. data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +1 -0
  94. data/lib/cosmos/tools/data_viewer/dump_component.rb +1 -0
  95. data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +4 -4
  96. data/lib/cosmos/tools/launcher/launcher.rb +1 -1
  97. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +28 -24
  98. data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +42 -42
  99. data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +56 -53
  100. data/lib/cosmos/tools/script_runner/script_runner.rb +112 -95
  101. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +48 -30
  102. data/lib/cosmos/tools/table_manager/table_manager.rb +42 -42
  103. data/lib/cosmos/tools/test_runner/test_runner.rb +45 -27
  104. data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +3 -3
  105. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +45 -45
  106. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +4 -4
  107. data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +3 -3
  108. data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +7 -7
  109. data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +10 -10
  110. data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +10 -3
  111. data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +6 -6
  112. data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +14 -14
  113. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +83 -83
  114. data/lib/cosmos/tools/tlm_viewer/screen.rb +73 -13
  115. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +15 -15
  116. data/lib/cosmos/tools/tlm_viewer/widgets.rb +1 -0
  117. data/lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb +40 -0
  118. data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +1 -1
  119. data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +6 -1
  120. data/lib/cosmos/top_level.rb +14 -1
  121. data/lib/cosmos/version.rb +5 -5
  122. data/lib/cosmos/win32/excel.rb +63 -12
  123. data/make_gems.sh +10 -0
  124. data/spec/conversions/packet_time_formatted_conversion_spec.rb +58 -0
  125. data/spec/conversions/packet_time_seconds_conversion_spec.rb +60 -0
  126. data/spec/interfaces/protocols/ignore_packet_protocol_spec.rb +243 -0
  127. data/spec/interfaces/protocols/preidentified_protocol_spec.rb +227 -4
  128. data/spec/io/serial_driver_spec.rb +15 -13
  129. data/spec/packet_logs/packet_log_reader_spec.rb +72 -17
  130. data/spec/packets/packet_config_spec.rb +5 -16
  131. data/spec/packets/parsers/format_string_parser_spec.rb +0 -11
  132. data/spec/packets/parsers/macro_parser_spec.rb +36 -36
  133. data/spec/packets/parsers/state_parser_spec.rb +36 -0
  134. data/spec/packets/telemetry_spec.rb +11 -9
  135. data/spec/script/script_spec.rb +2 -3
  136. data/spec/script/scripting_spec.rb +2 -1
  137. data/spec/script/tools_spec.rb +0 -1
  138. data/spec/tools/cmd_tlm_server/api_spec.rb +28 -20
  139. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +33 -0
  140. data/spec/tools/cmd_tlm_server/commanding_spec.rb +25 -1
  141. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +15 -0
  142. data/tasks/gemfile_stats.rake +3 -2
  143. metadata +14 -2
@@ -36,7 +36,7 @@ module Cosmos
36
36
  @list = Qt::ListWidget.new
37
37
  @exception_list.each_with_index do |exception, index|
38
38
  string = "#{index + 1}. #{exception.class} : #{exception.message}"
39
- Qt::ListWidgetItem.new(tr(string), @list)
39
+ Qt::ListWidgetItem.new(string, @list)
40
40
  end
41
41
  layout.addWidget(@list)
42
42
  @list.connect(SIGNAL('itemSelectionChanged ()')) do
@@ -103,9 +103,9 @@ module Cosmos
103
103
  def create_input_layout
104
104
  input_layout = Qt::FormLayout.new
105
105
  @find_box = Qt::LineEdit.new
106
- input_layout.addRow(tr("Fi&nd what:"), @find_box)
106
+ input_layout.addRow("Fi&nd what:", @find_box)
107
107
  @replace_box = Qt::LineEdit.new
108
- replace_label = Qt::Label.new(tr("Re&place with:"))
108
+ replace_label = Qt::Label.new("Re&place with:")
109
109
  replace_label.setBuddy(@replace_box)
110
110
  @replace_items << replace_label
111
111
  input_layout.addRow(replace_label, @replace_box)
@@ -141,7 +141,7 @@ module Cosmos
141
141
  direction_layout.addWidget(@up)
142
142
  direction_layout.addWidget(down)
143
143
  direction_layout.addStretch
144
- direction = Qt::GroupBox.new(tr("Direction"))
144
+ direction = Qt::GroupBox.new("Direction")
145
145
  direction.setLayout(direction_layout)
146
146
  direction
147
147
  end
@@ -43,14 +43,14 @@ module Cosmos
43
43
  top_layout = Qt::HBoxLayout.new
44
44
  text_layout = Qt::VBoxLayout.new
45
45
 
46
- title_label = Qt::Label.new(tr(title))
46
+ title_label = Qt::Label.new(title)
47
47
  text_layout.addWidget(title_label)
48
48
  @read_raw_data_time = Qt::Label.new("Read Raw Data Time: ")
49
49
  text_layout.addWidget(@read_raw_data_time)
50
50
  top_layout.addLayout(text_layout)
51
51
  top_layout.addStretch(1)
52
52
 
53
- button = Qt::PushButton.new(tr("Pause"))
53
+ button = Qt::PushButton.new("Pause")
54
54
  top_layout.addWidget(button)
55
55
  button.connect(SIGNAL('clicked()')) do
56
56
  if button.text == "Pause"
@@ -20,7 +20,7 @@ module Cosmos
20
20
  # are written back into the packet.
21
21
  class SetTlmDialog < Qt::Dialog
22
22
  # @return [Array<String>] Items which should not be displayed in the dialog
23
- IGNORED_ITEMS = ['RECEIVED_TIMESECONDS', 'RECEIVED_TIMEFORMATTED', 'RECEIVED_COUNT', 'PKTID', 'CONFIG']
23
+ IGNORED_ITEMS = ['PACKET_TIMESECONDS', 'PACKET_TIMEFORMATTED', 'RECEIVED_TIMESECONDS', 'RECEIVED_TIMEFORMATTED', 'RECEIVED_COUNT', 'PKTID', 'CONFIG']
24
24
 
25
25
  # @return [String] Errors encountered when trying to set the values back
26
26
  # into the packet
@@ -50,15 +50,15 @@ module Cosmos
50
50
  setWindowTitle("#{@target_name} #{@packet_name} #{@item_name} Details")
51
51
 
52
52
  layout = Qt::VBoxLayout.new
53
- layout.addWidget(Qt::Label.new(tr("#{target_name} #{packet_name} #{item_name}")))
53
+ layout.addWidget(Qt::Label.new("#{target_name} #{packet_name} #{item_name}"))
54
54
 
55
55
  # Display the item values
56
- item_values = Qt::GroupBox.new(tr("Item Values"))
56
+ item_values = Qt::GroupBox.new("Item Values")
57
57
 
58
58
  values_layout = Qt::FormLayout.new
59
59
  @raw_value = Qt::LineEdit.new
60
60
  @raw_value.setReadOnly(true)
61
- values_layout.addRow(tr("Raw Value:"), @raw_value)
61
+ values_layout.addRow("Raw Value:", @raw_value)
62
62
  @hex_raw_value = nil
63
63
  @hex_raw_num_digits = 0
64
64
  case item.data_type
@@ -67,21 +67,21 @@ module Cosmos
67
67
  @hex_raw_value = Qt::LineEdit.new
68
68
  @hex_raw_value.setReadOnly(true)
69
69
  @hex_raw_num_digits = (((item.bit_size - 1) / 8) + 1) * 2
70
- values_layout.addRow(tr("Hex Raw Value:"), @hex_raw_value)
70
+ values_layout.addRow("Hex Raw Value:", @hex_raw_value)
71
71
  end
72
72
  end
73
73
  @converted_value = Qt::LineEdit.new
74
74
  @converted_value.setReadOnly(true)
75
- values_layout.addRow(tr("Converted Value:"), @converted_value)
75
+ values_layout.addRow("Converted Value:", @converted_value)
76
76
  @formatted_value = Qt::LineEdit.new
77
77
  @formatted_value.setReadOnly(true)
78
- values_layout.addRow(tr("Formatted Value:"), @formatted_value)
78
+ values_layout.addRow("Formatted Value:", @formatted_value)
79
79
  @formatted_with_units_value = Qt::LineEdit.new
80
80
  @formatted_with_units_value.setReadOnly(true)
81
- values_layout.addRow(tr("Formatted with Units Value:"), @formatted_with_units_value)
81
+ values_layout.addRow("Formatted with Units Value:", @formatted_with_units_value)
82
82
  @limits_state = Qt::LineEdit.new
83
83
  @limits_state.setReadOnly(true)
84
- values_layout.addRow(tr("Limits State:"), @limits_state)
84
+ values_layout.addRow("Limits State:", @limits_state)
85
85
 
86
86
  item_values.setLayout(values_layout)
87
87
  layout.addWidget(item_values)
@@ -101,7 +101,7 @@ module Cosmos
101
101
  end
102
102
 
103
103
  # Display the item details
104
- item_details = Qt::GroupBox.new(tr("Item Details"))
104
+ item_details = Qt::GroupBox.new("Item Details")
105
105
  item_details.setLayout(build_details_layout(item, :TLM))
106
106
  layout.addWidget(item_details)
107
107
 
@@ -159,7 +159,7 @@ module Cosmos
159
159
  elsif @limits_layout
160
160
  label = Qt::Label.new(label_text)
161
161
  @limits_labels[limits_set] = label
162
- @limits_layout.addRow(tr("#{limits_set}:"), label)
162
+ @limits_layout.addRow("#{limits_set}:", label)
163
163
  end
164
164
  end
165
165
 
@@ -12,6 +12,7 @@
12
12
  # adding workarounds should they be needed to work through problems with
13
13
  # interacting with QT from Ruby.
14
14
 
15
+ require 'stringio'
15
16
  require 'cosmos'
16
17
  check_filename = File.join(Cosmos::USERPATH, "#{File.basename($0, File.extname($0))}_qt_check.txt")
17
18
  qt_in_system_folder = false
@@ -70,8 +71,16 @@ if Kernel.is_windows?
70
71
  end
71
72
  end
72
73
 
74
+ if Kernel.is_windows?
75
+ temp_stderr = $stderr.clone
76
+ $stderr.reopen(File.new('nul', 'w'))
77
+ end
73
78
  # This will either lock up or raise an error if older Qt dlls are present in the Windows system folders
74
- require 'Qt'
79
+ begin
80
+ require 'Qt'
81
+ ensure
82
+ $stderr.reopen(temp_stderr) if Kernel.is_windows?
83
+ end
75
84
  File.delete(check_filename) if Kernel.is_windows? and File.exist?(check_filename)
76
85
 
77
86
  module Cosmos
@@ -14,10 +14,12 @@ require 'cosmos/gui/dialogs/about_dialog'
14
14
  require 'cosmos/gui/dialogs/exception_dialog'
15
15
  require 'cosmos/gui/dialogs/pry_dialog'
16
16
  require 'cosmos/gui/dialogs/scroll_text_dialog'
17
+ require 'cosmos/gui/utilities/classification_banner'
17
18
  require 'ostruct'
18
19
  require 'optparse'
19
20
 
20
21
  module Cosmos
22
+
21
23
  # Base class of all COSMOS GUI Tools based on QT. It creates the help menu
22
24
  # which contains the About menu option. It provides configuration to all
23
25
  # tools to remember both the application window location and size across
@@ -28,6 +30,8 @@ module Cosmos
28
30
 
29
31
  @@redirect_io_thread = nil
30
32
 
33
+ include ClassificationBanner
34
+
31
35
  # Create a new application. IO is redirected such that writing to stdout or
32
36
  # stderr will result in a popup to be displayed to the user. Thus
33
37
  # applications should not write to stdout (i.e. puts or write) or stderr
@@ -65,6 +69,9 @@ module Cosmos
65
69
  @options.config_file = config_path(@options.config_file, ".txt", tool_name)
66
70
  @options.stylesheet = config_path(@options.stylesheet, ".css", tool_name)
67
71
  end
72
+
73
+ # Add a banner based on system configuration
74
+ add_classification_banner
68
75
  end
69
76
 
70
77
  # Creates a path to a configuration file. If the file is given it is
@@ -96,17 +103,17 @@ module Cosmos
96
103
  # placed in the File menu and must be manually added by the user. The
97
104
  # about_action is added to the Help menu by {#initialize_help_menu}.
98
105
  def initialize_actions
99
- @exit_action = Qt::Action.new(Cosmos.get_icon('close.png'), tr('E&xit'), self)
100
- @exit_keyseq = Qt::KeySequence.new(tr('Ctrl+Q'))
106
+ @exit_action = Qt::Action.new(Cosmos.get_icon('close.png'), 'E&xit', self)
107
+ @exit_keyseq = Qt::KeySequence.new('Ctrl+Q')
101
108
  @exit_action.shortcut = @exit_keyseq
102
- @exit_action.statusTip = tr('Exit the application')
109
+ @exit_action.statusTip = 'Exit the application'
103
110
  connect(@exit_action, SIGNAL('triggered()'), self, SLOT('close()'))
104
111
 
105
- @about_action = Qt::Action.new(Cosmos.get_icon('help.png'), tr('&About'), self)
106
- @about_action.statusTip = tr('About the application')
112
+ @about_action = Qt::Action.new(Cosmos.get_icon('help.png'), '&About', self)
113
+ @about_action.statusTip = 'About the application'
107
114
  connect(@about_action, SIGNAL('triggered()'), self, SLOT('about()'))
108
- @documentation_action = Qt::Action.new(tr('&Documentation'), self)
109
- @documentation_action.statusTip = tr('COSMOS Online Documentation')
115
+ @documentation_action = Qt::Action.new('&Documentation', self)
116
+ @documentation_action.statusTip = 'COSMOS Online Documentation'
110
117
  self.connect(@documentation_action, SIGNAL('triggered()')) do
111
118
  Qt::DesktopServices.openUrl(Qt::Url.new("http://cosmosrb.com"))
112
119
  end
@@ -130,7 +137,7 @@ module Cosmos
130
137
  default_dirs = [default_dirs] unless default_dirs.is_a? Array
131
138
  default_dirs.each do |default_dir|
132
139
  default_context = default_dir.split('/')[-2..-1].join('/')
133
- action = Qt::Action.new(tr(default_context), self)
140
+ action = Qt::Action.new(default_context, self)
134
141
  action.statusTip = status_tip if status_tip
135
142
  action.connect(SIGNAL('triggered()')) { callback.call(default_dir) }
136
143
  menu.addAction(action)
@@ -149,7 +156,7 @@ module Cosmos
149
156
  else
150
157
  name = "#{target_name}/#{target_sub_dir}"
151
158
  end
152
- action = Qt::Action.new(tr(name), self)
159
+ action = Qt::Action.new(name, self)
153
160
  action.statusTip = status_tip if status_tip
154
161
  action.connect(SIGNAL('triggered()')) { callback.call(dir) }
155
162
  menu.addAction(action)
@@ -160,7 +167,7 @@ module Cosmos
160
167
  # Creates the Help menu and adds the about_action to it. Thus this MUST be
161
168
  # called after initialize_actions.
162
169
  def initialize_help_menu
163
- @help_menu = menuBar().addMenu(tr('&Help'))
170
+ @help_menu = menuBar().addMenu('&Help')
164
171
  @help_menu.addAction(@about_action)
165
172
  @help_menu.addAction(@documentation_action)
166
173
  end
@@ -24,6 +24,7 @@ module Cosmos
24
24
  signals 'breakpoint_set(int)'
25
25
  signals 'breakpoint_cleared(int)'
26
26
  signals 'breakpoints_cleared()'
27
+ signals 'font_changed(const QFont &)'
27
28
 
28
29
  attr_accessor :enable_breakpoints
29
30
  attr_accessor :filename
@@ -156,10 +157,10 @@ module Cosmos
156
157
  CHAR_57 = Qt::Char.new(57)
157
158
  BREAKPOINT_SET = 1
158
159
  BREAKPOINT_CLEAR = -1
160
+ MINIMUM_POINT_SIZE = 4
159
161
 
160
- def initialize(parent)
162
+ def initialize(parent, font = Cosmos.get_default_font)
161
163
  super(parent)
162
- font = Cosmos.get_default_font
163
164
  setFont(font)
164
165
  @fontMetrics = Cosmos.getFontMetrics(font)
165
166
 
@@ -180,6 +181,18 @@ module Cosmos
180
181
  line_count_changed(-1)
181
182
  end
182
183
 
184
+ def wheelEvent(event)
185
+ if event.modifiers() == Qt::ControlModifier && event.delta > 0
186
+ event.setAccepted(true)
187
+ zoom_in()
188
+ elsif event.modifiers() == Qt::ControlModifier && event.delta < 0
189
+ event.setAccepted(true)
190
+ zoom_out()
191
+ else
192
+ super(event)
193
+ end
194
+ end
195
+
183
196
  def dispose
184
197
  super()
185
198
  @syntax.dispose
@@ -288,6 +301,31 @@ module Cosmos
288
301
  cursor.endEditBlock
289
302
  end
290
303
 
304
+ def zoom_in
305
+ font = Cosmos.getFont(font().family, font().pointSize + 1)
306
+ setFont(font)
307
+ @fontMetrics = Cosmos.getFontMetrics(font)
308
+ emit font_changed(font)
309
+ end
310
+
311
+ def zoom_out
312
+ return if font().pointSize <= MINIMUM_POINT_SIZE
313
+ font = Cosmos.getFont(font().family, font().pointSize - 1)
314
+ setFont(font)
315
+ @fontMetrics = Cosmos.getFontMetrics(font)
316
+ emit font_changed(font)
317
+ end
318
+
319
+ def zoom_default
320
+ font = Cosmos.get_default_font
321
+ setFont(font)
322
+ @fontMetrics = Cosmos.getFontMetrics(font)
323
+ # Force a repaint of the number area by doing a small scroll
324
+ verticalScrollBar.setValue(verticalScrollBar.minimum+1)
325
+ verticalScrollBar.setValue(verticalScrollBar.minimum)
326
+ emit font_changed(font)
327
+ end
328
+
291
329
  def resizeEvent(e)
292
330
  super(e)
293
331
  cr = self.contentsRect()
@@ -302,6 +340,7 @@ module Cosmos
302
340
 
303
341
  def line_number_area_paint_event(event)
304
342
  painter = Qt::Painter.new(@lineNumberArea)
343
+ painter.setFont(font())
305
344
  # Check for weird bad initialization conditions
306
345
  if painter.isActive and not painter.paintEngine.nil?
307
346
  event_rect = event.rect()
@@ -403,8 +442,8 @@ module Cosmos
403
442
  end
404
443
 
405
444
  def create_add_breakpoint_action(point)
406
- action = Qt::Action.new(tr("Add Breakpoint"), self)
407
- action.statusTip = tr("Add a breakpoint at this line")
445
+ action = Qt::Action.new("Add Breakpoint", self)
446
+ action.statusTip = "Add a breakpoint at this line"
408
447
  action.connect(SIGNAL('triggered()')) do
409
448
  line_at_point(point) do |line|
410
449
  add_breakpoint(line)
@@ -415,8 +454,8 @@ module Cosmos
415
454
  end
416
455
 
417
456
  def create_clear_breakpoint_action(point)
418
- action = Qt::Action.new(tr("Clear Breakpoint"), self)
419
- action.statusTip = tr("Clear an existing breakpoint at this line")
457
+ action = Qt::Action.new("Clear Breakpoint", self)
458
+ action.statusTip = "Clear an existing breakpoint at this line"
420
459
  action.connect(SIGNAL('triggered()')) do
421
460
  line_at_point(point) do |line|
422
461
  clear_breakpoint(line)
@@ -427,8 +466,8 @@ module Cosmos
427
466
  end
428
467
 
429
468
  def create_clear_all_breakpoints_action
430
- action = Qt::Action.new(tr("Clear All Breakpoints"), self)
431
- action.statusTip = tr("Clear all existing breakpoints")
469
+ action = Qt::Action.new("Clear All Breakpoints", self)
470
+ action.statusTip = "Clear all existing breakpoints"
432
471
  action.connect(SIGNAL('triggered()')) do
433
472
  clear_breakpoints
434
473
  emit breakpoints_cleared
@@ -0,0 +1,60 @@
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
+ module ClassificationBanner
12
+
13
+ # Add to Qt::MainWindow the ability to display a classification banner. Typically used on every QtTool and Screen
14
+ class Qt::MainWindow
15
+
16
+ def add_classification_banner
17
+ # Add a classification banner if the system configuration called for one
18
+ classification_banner = Cosmos::System.instance.classificiation_banner
19
+ unless classification_banner.nil?
20
+ # Get the RGB color information from the classification_banner
21
+ color_red = classification_banner['color'].red
22
+ color_green = classification_banner['color'].green
23
+ color_blue = classification_banner['color'].blue
24
+ color_rgb = "#{color_red},#{color_green},#{color_blue}"
25
+
26
+ # Create a classification toolbar
27
+ classification_toolbar = Qt::ToolBar.new
28
+ # Disable right clicking on the bar (prevents it from being hidden unintentionally)
29
+ classification_toolbar.setContextMenuPolicy(Qt::PreventContextMenu)
30
+ # Freeze the bar at the top
31
+ classification_toolbar.setFloatable(false)
32
+ classification_toolbar.setMovable(false)
33
+ # Specify sizes and set the style (background = background color, color = text color)
34
+ classification_toolbar.minimumHeight = 20
35
+ classification_toolbar.maximumHeight = 20
36
+ classification_toolbar.setStyleSheet("background:rgb(#{color_rgb});color:white;text-align:center;border:none;")
37
+
38
+ # Create a frame that will hold a horizontal layout
39
+ label_frame = Qt::Frame.new
40
+ label_layout = Qt::HBoxLayout.new(label_frame)
41
+ label_layout.setContentsMargins(0,1,0,0) # Centers the text nicely inside the horizontal layout
42
+
43
+ # Create a label of the classification and add it the horizontal layout
44
+ label = Qt::Label.new("#{classification_banner['display_text']}")
45
+ label.setStyleSheet("margin:0px;")
46
+
47
+ # Add stretchers on either side so it is always in the middle and looks nice
48
+ label_layout.addStretch(1)
49
+ label_layout.addWidget(label)
50
+ label_layout.addStretch(1)
51
+
52
+ # Add the frame to the main toolbar, then add the toolbar to the MainWindow
53
+ classification_toolbar.addWidget(label_frame)
54
+ self.addToolBar(classification_toolbar)
55
+ end
56
+
57
+ end
58
+
59
+ end
60
+ end
@@ -10,6 +10,7 @@
10
10
 
11
11
  require 'cosmos/script/script'
12
12
  require 'cosmos/gui/choosers/combobox_chooser'
13
+ require 'cosmos/tools/tlm_viewer/screen'
13
14
 
14
15
  $cmd_tlm_gui_window = nil
15
16
 
@@ -358,6 +359,31 @@ module Cosmos
358
359
  $cmd_tlm_gui_window
359
360
  end
360
361
 
362
+ def local_screen(title = "Local Screen", screen_def = nil, x_pos = nil, y_pos = nil, &block)
363
+ screen = nil
364
+ if block_given?
365
+ screen_def = yield
366
+ end
367
+
368
+ Qt.execute_in_main_thread(true) do
369
+ begin
370
+ if block_given?
371
+ screen = Screen.new(title, screen_def, nil, :REALTIME, x_pos, y_pos, nil, nil, false, false, block.binding )
372
+ else
373
+ screen = Screen.new(title, screen_def, nil, :REALTIME, x_pos, y_pos, nil, nil, false, false)
374
+ end
375
+ rescue Exception => err
376
+ puts err.formatted
377
+ end
378
+ end
379
+
380
+ screen
381
+ end
382
+
383
+ def close_local_screens
384
+ Qt.execute_in_main_thread(true) { Screen.close_all_screens(nil) }
385
+ end
386
+
361
387
  end # module Script
362
388
  $VERBOSE = old_verbose
363
389
 
@@ -20,3 +20,4 @@ require 'cosmos/interfaces/protocols/template_protocol'
20
20
  require 'cosmos/interfaces/protocols/terminated_protocol'
21
21
 
22
22
  require 'cosmos/interfaces/protocols/override_protocol'
23
+ require 'cosmos/interfaces/protocols/crc_protocol'
@@ -46,6 +46,9 @@ module Cosmos
46
46
  # @return [Array] Array of packet logger classes for this interface
47
47
  attr_accessor :packet_log_writer_pairs
48
48
 
49
+ # @return [Array] Array of stored packet log writers
50
+ attr_accessor :stored_packet_log_writer_pairs
51
+
49
52
  # @return [RawLoggerPair] RawLoggerPair instance or nil
50
53
  attr_accessor :raw_logger_pair
51
54
 
@@ -122,6 +125,7 @@ module Cosmos
122
125
  @reconnect_delay = 5.0
123
126
  @disable_disconnect = false
124
127
  @packet_log_writer_pairs = []
128
+ @stored_packet_log_writer_pairs = []
125
129
  @raw_logger_pair = RawLoggerPair.new(@name)
126
130
  @routers = []
127
131
  @cmd_routers = []