cosmos 4.0.0 → 4.0.1
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/Manifest.txt +16 -3
- data/autohotkey/tools/ConfigEditor +16 -0
- data/autohotkey/tools/packet_viewer.ahk +2 -1
- data/autohotkey/tools/tlm_viewer.ahk +2 -0
- data/autohotkey/tools/tool_launch.rb +38 -0
- data/data/COSMOS_Architecture.png +0 -0
- data/data/config/system.yaml +79 -2
- data/data/crc.txt +29 -28
- data/demo/Gemfile +1 -1
- data/demo/config/data/crc.txt +7 -2
- data/demo/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +1 -1
- data/demo/tools/mac/ConfigEditor.app/Contents/Info.plist +38 -0
- data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb +16 -0
- data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +10 -0
- data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb +38 -0
- data/demo/tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns +0 -0
- data/install/Gemfile +1 -1
- data/install/config/data/crc.txt +6 -1
- data/install/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +9 -0
- data/install/tools/mac/ConfigEditor.app/Contents/Info.plist +38 -0
- data/install/tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb +16 -0
- data/install/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +10 -0
- data/install/tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb +38 -0
- data/install/tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns +0 -0
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +3 -0
- data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +7 -13
- data/lib/cosmos/interfaces/interface.rb +1 -1
- data/lib/cosmos/packets/commands.rb +5 -0
- data/lib/cosmos/packets/packet.rb +8 -0
- data/lib/cosmos/packets/packet_item.rb +9 -0
- data/lib/cosmos/script/api_shared.rb +1 -29
- data/lib/cosmos/script/scripting.rb +2 -4
- data/lib/cosmos/script/telemetry.rb +38 -22
- data/lib/cosmos/system/system.rb +51 -53
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +27 -4
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +1 -7
- data/lib/cosmos/tools/config_editor/config_editor.rb +9 -1
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +16 -1
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +1 -9
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb +33 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +14 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +15 -17
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +17 -15
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +13 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +5 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +8 -11
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +2 -4
- data/lib/cosmos/top_level.rb +14 -0
- data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
- data/lib/cosmos/version.rb +4 -4
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +3 -3
- data/spec/install/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
- data/spec/packets/commands_spec.rb +10 -0
- data/spec/packets/packet_spec.rb +62 -0
- data/spec/script/telemetry_spec.rb +8 -6
- data/spec/system/system_spec.rb +192 -0
- data/spec/system/target_spec.rb +6 -5
- metadata +18 -5
- data/demo/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +0 -16
- data/install/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +0 -14
- data/spec/install/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +0 -16
@@ -23,6 +23,13 @@ require 'cosmos/gui/choosers/file_chooser'
|
|
23
23
|
require 'cosmos/config/meta_config_parser'
|
24
24
|
|
25
25
|
module Cosmos
|
26
|
+
class FocusComboBox < Qt::ComboBox
|
27
|
+
signals 'focus_in()'
|
28
|
+
def focusInEvent(event)
|
29
|
+
emit focus_in
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
26
33
|
class ConfigEditorFrame < Qt::Widget
|
27
34
|
slots 'context_menu(const QPoint&)'
|
28
35
|
slots 'undo_available(bool)'
|
@@ -576,7 +583,7 @@ module Cosmos
|
|
576
583
|
process_parameters(attribute_value[current_value]['parameters'], parameter_index + 1)
|
577
584
|
end
|
578
585
|
elsif attribute_value.is_a? Array # Just a bunch of strings
|
579
|
-
value_widget =
|
586
|
+
value_widget = FocusComboBox.new()
|
580
587
|
value_widget.addItems(attribute_value)
|
581
588
|
if required && current_value.nil?
|
582
589
|
value_widget.setStyleSheet("border: 1px solid red")
|
@@ -585,6 +592,14 @@ module Cosmos
|
|
585
592
|
value_widget.addItem(current_value) unless attribute_value.include?(current_value)
|
586
593
|
value_widget.setCurrentText(current_value)
|
587
594
|
end
|
595
|
+
# If a user is typing in a line from scratch and tabs to a ComboBox
|
596
|
+
# field we want to insert the current value as it gets focus so
|
597
|
+
# something gets populated. This will happen even in a fully populated
|
598
|
+
# line as well but has no effect since we're replacing with the currentText.
|
599
|
+
value_widget.connect(SIGNAL('focus_in()')) do |event|
|
600
|
+
value_widget.setStyleSheet("")
|
601
|
+
insert_word(value_widget.currentText(), parameter_index)
|
602
|
+
end
|
588
603
|
value_widget.connect(SIGNAL('currentIndexChanged(const QString&)')) do |word|
|
589
604
|
value_widget.setStyleSheet("")
|
590
605
|
insert_word(word, parameter_index)
|
@@ -276,7 +276,7 @@ module Cosmos
|
|
276
276
|
file = File.read(filename)
|
277
277
|
# Wild card the target name because it is not used and is often aliased
|
278
278
|
if file =~ /TELEMETRY\s+.*\s+#{@packet_select.text}/
|
279
|
-
Cosmos.
|
279
|
+
Cosmos.run_cosmos_tool('ConfigEditor', "-f #{filename}")
|
280
280
|
found = true
|
281
281
|
break
|
282
282
|
end
|
@@ -556,13 +556,6 @@ module Cosmos
|
|
556
556
|
graph_action.statusTip = tr("Create a new COSMOS graph of #{target_name} #{packet_name} #{item_name}")
|
557
557
|
graph_action.connect(SIGNAL('triggered()')) do
|
558
558
|
@table.clearSelection
|
559
|
-
if Kernel.is_windows?
|
560
|
-
Cosmos.run_process("rubyw tools/TlmGrapher -i \"#{target_name} #{packet_name} #{item_name}\" --system #{File.basename(System.initial_filename)}")
|
561
|
-
elsif Kernel.is_mac? and File.exist?("tools/mac/TlmGrapher.app")
|
562
|
-
Cosmos.run_process("open tools/mac/TlmGrapher.app --args -i \"#{target_name} #{packet_name} #{item_name}\" --system #{File.basename(System.initial_filename)}")
|
563
|
-
else
|
564
|
-
Cosmos.run_process("ruby tools/TlmGrapher -i \"#{target_name} #{packet_name} #{item_name}\" --system #{File.basename(System.initial_filename)}")
|
565
|
-
end
|
566
559
|
TlmGraphDialog.new(self, target_name, packet_name, item_name)
|
567
560
|
end
|
568
561
|
menu.addAction(graph_action)
|
@@ -613,4 +606,3 @@ module Cosmos
|
|
613
606
|
end # class PacketViewer
|
614
607
|
|
615
608
|
end # module Cosmos
|
616
|
-
|
@@ -258,7 +258,7 @@ module Cosmos
|
|
258
258
|
# Access the variant we created for this screen name
|
259
259
|
string = combo.itemData(combo.currentIndex)
|
260
260
|
# The second part of the variant after the semicolon is the screen filename
|
261
|
-
Cosmos.
|
261
|
+
Cosmos.run_cosmos_tool('ConfigEditor', "-f #{string.value.split(';')[1]}")
|
262
262
|
end
|
263
263
|
grid.addWidget(edit_button, row, 3)
|
264
264
|
end
|
@@ -0,0 +1,33 @@
|
|
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 Cosmos
|
12
|
+
module CanvasClickable
|
13
|
+
# Requires @x, @y, @x_end, and @y_end to be defined
|
14
|
+
def on_click(event, x, y)
|
15
|
+
return false unless @screen_settings
|
16
|
+
if (x < @x_end) && (x > @x) && (y < @y_end) && (y > @y)
|
17
|
+
display(@screen_settings[0], @screen_settings[1].to_i, @screen_settings[2].to_i)
|
18
|
+
true
|
19
|
+
else
|
20
|
+
false
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def set_setting(setting_name, setting_values)
|
25
|
+
case setting_name.upcase
|
26
|
+
when 'SCREEN'
|
27
|
+
@screen_settings = setting_values
|
28
|
+
else
|
29
|
+
super(setting_name, setting_values)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -17,14 +17,13 @@ require 'cosmos/tools/tlm_viewer/widgets/widget'
|
|
17
17
|
require 'cosmos/tools/tlm_viewer/widgets/layout_widget'
|
18
18
|
|
19
19
|
module Cosmos
|
20
|
-
|
21
20
|
class CanvasWidget < Qt::Widget
|
22
21
|
include Widget
|
23
22
|
include LayoutWidget
|
24
23
|
|
25
24
|
def initialize(parent_layout, width, height)
|
26
25
|
super()
|
27
|
-
@
|
26
|
+
@repaint_objects = []
|
28
27
|
self.minimumWidth = width.to_i
|
29
28
|
self.minimumHeight = height.to_i
|
30
29
|
parent_layout.addWidget(self) if parent_layout
|
@@ -35,7 +34,7 @@ module Cosmos
|
|
35
34
|
# the order in which child widgets are painted is the order in which they
|
36
35
|
# are created.
|
37
36
|
def add_repaint(obj)
|
38
|
-
@
|
37
|
+
@repaint_objects << obj
|
39
38
|
end
|
40
39
|
|
41
40
|
def paintEvent(event)
|
@@ -44,7 +43,7 @@ module Cosmos
|
|
44
43
|
painter.begin(self)
|
45
44
|
painter.setBackgroundMode(Qt::OpaqueMode)
|
46
45
|
painter.setBackground(Cosmos.getBrush(Qt::white))
|
47
|
-
@
|
46
|
+
@repaint_objects.each do |obj|
|
48
47
|
obj.paint(painter)
|
49
48
|
end
|
50
49
|
painter.end
|
@@ -54,9 +53,18 @@ module Cosmos
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
56
|
+
def mouseReleaseEvent(event)
|
57
|
+
cur_x = mapFromGlobal(self.cursor.pos).x
|
58
|
+
cur_y = mapFromGlobal(self.cursor.pos).y
|
59
|
+
@repaint_objects.each do |obj|
|
60
|
+
if obj.respond_to?(:on_click)
|
61
|
+
break if obj.on_click(event, cur_x, cur_y)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
def update_widget
|
58
67
|
self.update
|
59
68
|
end
|
60
69
|
end
|
61
|
-
|
62
|
-
end # module Cosmos
|
70
|
+
end
|
@@ -11,47 +11,46 @@
|
|
11
11
|
require 'cosmos/tools/tlm_viewer/widgets/widget'
|
12
12
|
|
13
13
|
module Cosmos
|
14
|
-
|
15
14
|
class CanvasdotWidget
|
16
15
|
include Widget
|
17
|
-
|
18
|
-
def initialize(parent_layout, x, y, color='black', width=3)
|
16
|
+
|
17
|
+
def initialize(parent_layout, x, y, color = 'black', width = 3)
|
19
18
|
super()
|
20
19
|
if is_numeric?(x)
|
21
20
|
@x = x.to_i
|
22
21
|
else
|
23
22
|
@x = x.to_s
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
if is_numeric?(y)
|
27
26
|
@y = y.to_i
|
28
27
|
else
|
29
28
|
@y = y.to_s
|
30
29
|
end
|
31
|
-
|
30
|
+
|
32
31
|
@point = Qt::Point.new(0, 0)
|
33
32
|
update_point
|
34
|
-
|
33
|
+
|
35
34
|
@width = width.to_i
|
36
35
|
@color = Cosmos::getColor(color)
|
37
36
|
parent_layout.add_repaint(self)
|
38
|
-
end
|
39
|
-
|
37
|
+
end
|
38
|
+
|
40
39
|
def update_point
|
41
40
|
if is_numeric?(@x)
|
42
41
|
@point.x = @x
|
43
42
|
else
|
44
43
|
@point.x = eval_str(@x)
|
45
44
|
end
|
46
|
-
|
45
|
+
|
47
46
|
if is_numeric?(@y)
|
48
47
|
@point.y = @y
|
49
48
|
else
|
50
49
|
@point.y = eval_str(@y)
|
51
50
|
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def is_numeric?(obj)
|
51
|
+
end
|
52
|
+
|
53
|
+
def is_numeric?(obj)
|
55
54
|
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
|
56
55
|
end
|
57
56
|
|
@@ -61,11 +60,11 @@ module Cosmos
|
|
61
60
|
painter.drawEllipse(@point, @width, @width)
|
62
61
|
painter.restore
|
63
62
|
end
|
64
|
-
|
63
|
+
|
65
64
|
def eval_str(string_to_eval)
|
66
65
|
@screen.instance_eval(string_to_eval)
|
67
66
|
end
|
68
|
-
|
67
|
+
|
69
68
|
def update_widget
|
70
69
|
update_point
|
71
70
|
end
|
@@ -74,6 +73,5 @@ module Cosmos
|
|
74
73
|
super()
|
75
74
|
@point.dispose
|
76
75
|
end
|
77
|
-
end
|
78
|
-
|
79
|
-
end # module Cosmos
|
76
|
+
end
|
77
|
+
end
|
@@ -9,11 +9,12 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
require 'cosmos/tools/tlm_viewer/widgets/widget'
|
12
|
+
require 'cosmos/tools/tlm_viewer/widgets/canvas_clickable'
|
12
13
|
|
13
14
|
module Cosmos
|
14
|
-
|
15
15
|
class CanvasimageWidget
|
16
16
|
include Widget
|
17
|
+
include CanvasClickable
|
17
18
|
|
18
19
|
def initialize(parent_layout, filename, x, y)
|
19
20
|
super()
|
@@ -26,6 +27,8 @@ module Cosmos
|
|
26
27
|
end
|
27
28
|
@image = Qt::Image.new(filename)
|
28
29
|
parent_layout.add_repaint(self)
|
30
|
+
@x_end = @x + @image.width
|
31
|
+
@y_end = @y + @image.height
|
29
32
|
end
|
30
33
|
|
31
34
|
def paint(painter)
|
@@ -37,5 +40,4 @@ module Cosmos
|
|
37
40
|
@image.dispose
|
38
41
|
end
|
39
42
|
end
|
40
|
-
|
41
|
-
end # module Cosmos
|
43
|
+
end
|
@@ -14,44 +14,46 @@
|
|
14
14
|
# telemetry point value of 1 or 0 respectively.
|
15
15
|
|
16
16
|
require 'cosmos/tools/tlm_viewer/widgets/canvasvalue_widget'
|
17
|
+
require 'cosmos/tools/tlm_viewer/widgets/canvas_clickable'
|
17
18
|
|
18
19
|
module Cosmos
|
19
|
-
|
20
20
|
class CanvasimagevalueWidget < CanvasvalueWidget
|
21
|
-
|
22
|
-
|
21
|
+
include CanvasClickable
|
22
|
+
|
23
|
+
def initialize(parent_layout, target_name, packet_name, item_name, filename, x, y, value_type = :RAW)
|
23
24
|
super(parent_layout, target_name, packet_name, item_name, value_type)
|
24
25
|
@x = x.to_i
|
25
26
|
@y = y.to_i
|
26
|
-
@
|
27
|
-
@
|
27
|
+
@image_on = nil
|
28
|
+
@image_off = nil
|
28
29
|
|
29
|
-
filenameOn = File.join(::Cosmos::USERPATH, 'config', 'data', filename+'on
|
30
|
+
filenameOn = Dir[File.join(::Cosmos::USERPATH, 'config', 'data', filename + 'on.*')][0]
|
30
31
|
unless File.exist?(filenameOn)
|
31
32
|
raise "Can't find the file #{filenameOn} in #{::Cosmos::USERPATH}/config/data"
|
32
33
|
end
|
33
|
-
@
|
34
|
+
@image_on = Qt::Image.new(filenameOn)
|
34
35
|
|
35
|
-
filenameOff = File.join(::Cosmos::USERPATH, 'config', 'data', filename+'off
|
36
|
+
filenameOff = Dir[File.join(::Cosmos::USERPATH, 'config', 'data', filename + 'off.*')][0]
|
36
37
|
unless File.exist?(filenameOff)
|
37
38
|
raise "Can't find the file #{filenameOff} in #{::Cosmos::USERPATH}/config/data"
|
38
39
|
end
|
39
|
-
@
|
40
|
+
@image_off = Qt::Image.new(filenameOff)
|
41
|
+
@x_end = @x + [@image_on.width, @image_off.width].max
|
42
|
+
@y_end = @y + [@image_on.height, @image_off.height].max
|
40
43
|
end
|
41
44
|
|
42
45
|
def draw_widget(painter, on_value)
|
43
46
|
if on_value
|
44
|
-
painter.drawImage(@x, @y, @
|
47
|
+
painter.drawImage(@x, @y, @image_on) if @image_on
|
45
48
|
else
|
46
|
-
painter.drawImage(@x, @y, @
|
49
|
+
painter.drawImage(@x, @y, @image_off) if @image_off
|
47
50
|
end
|
48
51
|
end
|
49
52
|
|
50
53
|
def dispose
|
51
54
|
super()
|
52
|
-
@
|
53
|
-
@
|
55
|
+
@image_on.dispose
|
56
|
+
@image_off.dispose
|
54
57
|
end
|
55
58
|
end
|
56
|
-
|
57
|
-
end # module Cosmos
|
59
|
+
end
|
@@ -9,19 +9,27 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
require 'cosmos/tools/tlm_viewer/widgets/widget'
|
12
|
+
require 'cosmos/tools/tlm_viewer/widgets/canvas_clickable'
|
12
13
|
|
13
14
|
module Cosmos
|
14
|
-
|
15
15
|
class CanvaslabelWidget
|
16
16
|
include Widget
|
17
|
+
include CanvasClickable
|
17
18
|
|
18
|
-
def initialize(parent_layout, x, y, text, font_size = 12, color='black')
|
19
|
+
def initialize(parent_layout, x, y, text, font_size = 12, color = 'black')
|
19
20
|
super()
|
20
21
|
@x = x.to_i
|
21
|
-
@
|
22
|
+
@paint_y = y.to_i
|
22
23
|
@text = text
|
23
24
|
@color = Cosmos::getColor(color)
|
24
25
|
@font = Cosmos.getFont("helvetica", font_size.to_i)
|
26
|
+
fm = Qt::FontMetrics.new(@font)
|
27
|
+
@x_end = @x + fm.width(text)
|
28
|
+
# drawText uses the y value as the bottom of the text
|
29
|
+
# Thus for the clickable area we need to set the y_end to the y value
|
30
|
+
# and calculate the top y value by subtracting the font height
|
31
|
+
@y_end = y.to_i
|
32
|
+
@y = @y_end - fm.height()
|
25
33
|
parent_layout.add_repaint(self)
|
26
34
|
end
|
27
35
|
|
@@ -29,9 +37,8 @@ module Cosmos
|
|
29
37
|
painter.save
|
30
38
|
painter.setPen(@color)
|
31
39
|
painter.setFont(@font)
|
32
|
-
painter.drawText(@x, @
|
40
|
+
painter.drawText(@x, @paint_y, @text)
|
33
41
|
painter.restore
|
34
42
|
end
|
35
43
|
end
|
36
|
-
|
37
|
-
end # module Cosmos
|
44
|
+
end
|
@@ -14,7 +14,6 @@ require 'cosmos/tools/tlm_viewer/widgets/canvasvalue_widget'
|
|
14
14
|
module Cosmos
|
15
15
|
|
16
16
|
class CanvaslabelvalueWidget < CanvasvalueWidget
|
17
|
-
|
18
17
|
def initialize(parent_layout, target_name, packet_name, item_name, x1, y1, font_size = 12, color = 'black', frame = true, frame_width = 3, value_type = :CONVERTED)
|
19
18
|
super(parent_layout, target_name, packet_name, item_name, value_type)
|
20
19
|
@x = x1.to_i
|
@@ -44,13 +43,12 @@ module Cosmos
|
|
44
43
|
h = @fm.height
|
45
44
|
w = @fm.width(@value.to_s)
|
46
45
|
@pen.setWidth(@frame_width)
|
47
|
-
painter.drawLine(@x-5, @y+5, @x+w+10, @y+5) # bottom line
|
48
|
-
painter.drawLine(@x-5, @y+5, @x-5, @y-h-5) # left line
|
49
|
-
painter.drawLine(@x-5, @y-h-5, @x+w+10, @y-h-5) # top line
|
50
|
-
painter.drawLine(@x+w+10, @y+5, @x+w+10, @y-h-5) # right line
|
46
|
+
painter.drawLine(@x - 5, @y + 5, @x + w + 10, @y + 5) # bottom line
|
47
|
+
painter.drawLine(@x - 5, @y + 5, @x - 5, @y - h - 5) # left line
|
48
|
+
painter.drawLine(@x - 5, @y - h - 5, @x + w + 10, @y - h - 5) # top line
|
49
|
+
painter.drawLine(@x + w + 10, @y + 5, @x + w + 10, @y - h - 5) # right line
|
51
50
|
end
|
52
51
|
painter.restore
|
53
52
|
end
|
54
53
|
end
|
55
|
-
|
56
|
-
end # module Cosmos
|
54
|
+
end
|
@@ -11,11 +11,10 @@
|
|
11
11
|
require 'cosmos/tools/tlm_viewer/widgets/widget'
|
12
12
|
|
13
13
|
module Cosmos
|
14
|
-
|
15
14
|
class CanvaslineWidget
|
16
15
|
include Widget
|
17
16
|
|
18
|
-
def initialize(parent_layout, x1, y1, x2, y2, color='black', width=1, connector='NO_CONNECTOR')
|
17
|
+
def initialize(parent_layout, x1, y1, x2, y2, color = 'black', width = 1, connector = 'NO_CONNECTOR')
|
19
18
|
super()
|
20
19
|
@x1 = x1.to_i
|
21
20
|
@y1 = y1.to_i
|
@@ -51,5 +50,4 @@ module Cosmos
|
|
51
50
|
@point.dispose
|
52
51
|
end
|
53
52
|
end
|
54
|
-
|
55
|
-
end # module Cosmos
|
53
|
+
end
|
@@ -15,10 +15,8 @@
|
|
15
15
|
require 'cosmos/tools/tlm_viewer/widgets/canvasvalue_widget'
|
16
16
|
|
17
17
|
module Cosmos
|
18
|
-
|
19
18
|
class CanvaslinevalueWidget < CanvasvalueWidget
|
20
|
-
|
21
|
-
def initialize (parent_layout, target_name, packet_name, item_name, x1, y1, x2, y2, coloron='green', coloroff='blue', width=3, connector='NO_CONNECTOR', value_type = :RAW)
|
19
|
+
def initialize(parent_layout, target_name, packet_name, item_name, x1, y1, x2, y2, color_on = 'green', color_off = 'blue', width = 3, connector = 'NO_CONNECTOR', value_type = :RAW)
|
22
20
|
super(parent_layout, target_name, packet_name, item_name, value_type)
|
23
21
|
@x1 = x1.to_i
|
24
22
|
@y1 = y1.to_i
|
@@ -30,10 +28,10 @@ module Cosmos
|
|
30
28
|
else
|
31
29
|
@connector = false
|
32
30
|
end
|
33
|
-
@
|
34
|
-
@
|
35
|
-
@pen_on = Cosmos::getPen(
|
36
|
-
@pen_off = Cosmos::getPen(
|
31
|
+
@color_on = Cosmos::getColor(color_on)
|
32
|
+
@color_off = Cosmos::getColor(color_off)
|
33
|
+
@pen_on = Cosmos::getPen(color_on)
|
34
|
+
@pen_off = Cosmos::getPen(color_off)
|
37
35
|
@width = width.to_i
|
38
36
|
end
|
39
37
|
|
@@ -41,10 +39,10 @@ module Cosmos
|
|
41
39
|
painter.save
|
42
40
|
if (on_state == true)
|
43
41
|
pen = @pen_on
|
44
|
-
color = @
|
42
|
+
color = @color_on
|
45
43
|
else
|
46
44
|
pen = @pen_off
|
47
|
-
color = @
|
45
|
+
color = @color_off
|
48
46
|
end
|
49
47
|
|
50
48
|
pen.setWidth(@width)
|
@@ -62,5 +60,4 @@ module Cosmos
|
|
62
60
|
@point.dispose
|
63
61
|
end
|
64
62
|
end
|
65
|
-
|
66
|
-
end # module Cosmos
|
63
|
+
end
|