Module: Cosmos::AgingWidget
- Included in:
- ArrayWidget, TextboxWidget, ValueWidget
- Defined in:
- lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#coloring ⇒ Object
Returns the value of attribute coloring.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#coloring ⇒ Object
Returns the value of attribute coloring.
17 18 19 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb', line 17 def coloring @coloring end |
Class Method Details
.included(base) ⇒ Object
37 38 39 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb', line 37 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#process_aging_settings ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb', line 90 def process_aging_settings @settings.each do |setting_name, setting_values| case setting_name.upcase when 'GRAY_RATE', 'GREY_RATE' gray_rate = settings_values[0].to_i @gray_rate = gray_rate when 'MIN_GRAY', 'MIN_GREY' gray = setting_values[0].to_i @min_gray = gray unless gray < 0 when 'ENABLE_AGING' enable_aging = ConfigParser::handle_true_false(setting_values[0]) @enable_aging = enable_aging when 'COLORBLIND' @colorblind = ConfigParser::handle_true_false(setting_values[0]) end end end |
#setup_aging ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb', line 19 def setup_aging @previous_value = 0 @gray_level = 255 @enable_aging = true @min_gray = 200 @gray_rate = 3 @gray_tolerance = nil @colorblind = false @coloring = true @foreground = Cosmos::BLACK @background = Cosmos::WHITE end |
#value=(data, text = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb', line 41 def value=(data, text = nil) text = data.to_s unless text if @coloring case @limits_state when :RED, :RED_HIGH @foreground = Cosmos::RED text << ' (R)' if @colorblind when :RED_LOW @foreground = Cosmos::RED text << ' (r)' if @colorblind when :YELLOW, :YELLOW_HIGH @foreground = Cosmos::YELLOW text << ' (Y)' if @colorblind when :YELLOW_LOW @foreground = Cosmos::YELLOW text << ' (y)' if @colorblind when :GREEN, :GREEN_HIGH @foreground = Cosmos::GREEN text << ' (G)' if @colorblind when :GREEN_LOW @foreground = Cosmos::GREEN text << ' (g)' if @colorblind when :BLUE @foreground = Cosmos::BLUE text << ' (B)' if @colorblind when :STALE @foreground = Cosmos::PURPLE text << ' ($)' if @colorblind else @foreground = Cosmos::BLACK end end # Implement Telemetry Aging if @enable_aging if (@previous_value == data) || (@gray_tolerance && ((@previous_value.to_f - data.to_f).abs <= @gray_tolerance)) @gray_level -= @gray_rate @gray_level = @min_gray if @gray_level < @min_gray else @gray_level = 255 end @background = Cosmos::getColor(@gray_level, @gray_level, @gray_level) @previous_value = data end text end |