370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
|
# File 'lib/wassup/pane.rb', line 370
def update_title
return unless self.should_box
title = self.title || "<No Title>"
if self.focus_number.nil?
full_title = title
else
full_title = "#{self.focus_number} - #{title}"
end
full_title += " "
self.win.setpos(0, 3)
self.win.addstr(full_title)
self.win.setpos(0, 3 + full_title.size)
alert = ""
alert_count = self.alert_count
case self.alert_level
when AlertLevel::HIGH
self.win.attrset(Curses.color_pair(Wassup::Color::Pair::RED))
if alert_count == 1
alert += "(#{alert_count} HIGH ALERT)"
elsif alert_count > 0
alert += "(#{alert_count} HIGH ALERTS)"
end
when AlertLevel::MEDIUM
self.win.attrset(Curses.color_pair(Wassup::Color::Pair::YELLOW))
if alert_count == 1
alert += "(#{alert_count} MEDIUM ALERT)"
elsif alert_count > 0
alert += "(#{alert_count} MEDIUM ALERTS)"
end
when AlertLevel::LOW
self.win.attrset(Curses.color_pair(Wassup::Color::Pair::CYAN))
if alert_count == 1
alert += "(#{alert_count} LOW ALERT)"
elsif alert_count > 0
alert += "(#{alert_count} LOW ALERTS)"
end
end
self.win.addstr(alert)
self.subwin.attrset(Curses.color_pair(Wassup::Color::Pair::NORMAL))
self.win.refresh
end
|