Class: Opsicle::Monitor::Screen
- Inherits:
-
Object
- Object
- Opsicle::Monitor::Screen
- Defined in:
- lib/opsicle/monitor/screen.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ Screen
constructor
A new instance of Screen.
- #missized? ⇒ Boolean
- #next_key ⇒ Object
- #panel_main ⇒ Object
- #panel_main=(pname) ⇒ Object
- #refresh ⇒ Object
- #refresh_spies ⇒ Object
Constructor Details
#initialize ⇒ Screen
Returns a new instance of Screen.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/opsicle/monitor/screen.rb', line 10 def initialize Curses.init_screen Curses.nl Curses.noecho Curses.curs_set(0) @height = term_height @width = term_width @panels = { # attach panels, defining height, width, top, left :header => Monitor::Panels::Header.new( 6, @width, 0, 0), } self.panel_main = :deployments Curses.refresh rescue close raise end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
7 8 9 |
# File 'lib/opsicle/monitor/screen.rb', line 7 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
8 9 10 |
# File 'lib/opsicle/monitor/screen.rb', line 8 def width @width end |
Instance Method Details
#close ⇒ Object
32 33 34 35 36 |
# File 'lib/opsicle/monitor/screen.rb', line 32 def close @panels.each { |pname, panel| panel.close } if @panels Curses.close_screen end |
#missized? ⇒ Boolean
50 51 52 |
# File 'lib/opsicle/monitor/screen.rb', line 50 def missized? @height != term_height || @width != term_width end |
#next_key ⇒ Object
46 47 48 |
# File 'lib/opsicle/monitor/screen.rb', line 46 def next_key Curses.getch end |
#panel_main ⇒ Object
54 55 56 |
# File 'lib/opsicle/monitor/screen.rb', line 54 def panel_main @panels[:header].panel_main end |
#panel_main=(pname) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/opsicle/monitor/screen.rb', line 58 def panel_main=(pname) @panels[:header].panel_main = pname @panels[:main].close if @panels[:main] @panels[:main] = case pname when :deployments Monitor::Panels::Deployments.new((@height - 4), @width, 4, 0) when :instances Monitor::Panels::Instances.new((@height - 4), @width, 4, 0) when :help Monitor::Panels::Help.new((@height - 4), @width, 4, 0) end end |
#refresh ⇒ Object
38 39 40 |
# File 'lib/opsicle/monitor/screen.rb', line 38 def refresh @panels.each { |pname, panel| panel.refresh } end |
#refresh_spies ⇒ Object
42 43 44 |
# File 'lib/opsicle/monitor/screen.rb', line 42 def refresh_spies @panels.each { |pname, panel| panel.refresh_spies } end |