class Opsicle::Monitor::Screen
Attributes
height[R]
width[R]
Public Class Methods
new()
click to toggle source
# 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
Public Instance Methods
close()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 32 def close @panels.each { |pname, panel| panel.close } if @panels Curses.close_screen end
missized?()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 50 def missized? @height != term_height || @width != term_width end
next_key()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 46 def next_key Curses.getch end
panel_main()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 54 def panel_main @panels[:header].panel_main end
panel_main=(pname)
click to toggle source
# 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()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 38 def refresh @panels.each { |pname, panel| panel.refresh } end
refresh_spies()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 42 def refresh_spies @panels.each { |pname, panel| panel.refresh_spies } end
Private Instance Methods
term_height()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 75 def term_height (ENV['LINES'] || Curses.lines).to_i end
term_width()
click to toggle source
# File lib/opsicle/monitor/screen.rb, line 79 def term_width (ENV['COLUMNS'] || Curses.cols).to_i end