mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-27 19:25:27 +03:00
Merge branch 'issue1256' into develop
This commit is contained in:
commit
1c324efada
1
NEWS
1
NEWS
@ -54,6 +54,7 @@ Bugs corrected:
|
||||
* [Glances 3.0 RC1] Client/Server is broken #1244
|
||||
* Fixing horizontal scrolling #1248
|
||||
* Stats updated during export (thread issue) #1250
|
||||
* Glances --browser crashed when more than 40 glances servers on screen 78x45 #1256
|
||||
|
||||
Backward-incompatible changes:
|
||||
|
||||
|
@ -27,7 +27,7 @@ import signal
|
||||
import sys
|
||||
|
||||
# Global name
|
||||
__version__ = '3.0.rc3'
|
||||
__version__ = '3.0.rc4'
|
||||
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
|
||||
__license__ = 'LGPLv3'
|
||||
|
||||
|
@ -29,11 +29,10 @@ from glances.timer import Timer
|
||||
|
||||
|
||||
class GlancesCursesBrowser(_GlancesCurses):
|
||||
|
||||
"""Class for the Glances curse client browser."""
|
||||
|
||||
def __init__(self, args=None):
|
||||
# Init the father class
|
||||
"""Init the father class."""
|
||||
super(GlancesCursesBrowser, self).__init__(args=args)
|
||||
|
||||
_colors_list = {
|
||||
@ -168,13 +167,15 @@ class GlancesCursesBrowser(_GlancesCurses):
|
||||
# Get the current screen size
|
||||
screen_x = self.screen.getmaxyx()[1]
|
||||
screen_y = self.screen.getmaxyx()[0]
|
||||
servers_list_max = screen_y - 3
|
||||
servers_list_len = len(servers_list)
|
||||
|
||||
# Init position
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
# Display top header
|
||||
if len(servers_list) == 0:
|
||||
if servers_list_len == 0:
|
||||
if self.first_scan and not self.args.disable_autodiscover:
|
||||
msg = 'Glances is scanning your network. Please wait...'
|
||||
self.first_scan = False
|
||||
@ -183,15 +184,21 @@ class GlancesCursesBrowser(_GlancesCurses):
|
||||
elif len(servers_list) == 1:
|
||||
msg = 'One Glances server available'
|
||||
else:
|
||||
msg = '{} Glances servers available'.format(len(servers_list))
|
||||
msg = '{} Glances servers available'.format(servers_list_len)
|
||||
if self.args.disable_autodiscover:
|
||||
msg += ' ' + '(auto discover is disabled)'
|
||||
self.term_window.addnstr(y, x,
|
||||
msg,
|
||||
screen_x - x,
|
||||
self.colors_list['TITLE'])
|
||||
msg += ' (auto discover is disabled)'
|
||||
if screen_y > 1:
|
||||
self.term_window.addnstr(y, x,
|
||||
msg,
|
||||
screen_x - x,
|
||||
self.colors_list['TITLE'])
|
||||
if servers_list_len > servers_list_max and screen_y > 2:
|
||||
msg = 'Warning: Only {} servers will be displayed (please increase your terminal size)'.format(servers_list_max)
|
||||
self.term_window.addnstr(y + 1, x,
|
||||
msg,
|
||||
screen_x - x)
|
||||
|
||||
if len(servers_list) == 0:
|
||||
if servers_list_len == 0:
|
||||
return False
|
||||
|
||||
# Display the Glances server list
|
||||
@ -232,6 +239,9 @@ class GlancesCursesBrowser(_GlancesCurses):
|
||||
# Display table
|
||||
line = 0
|
||||
for v in servers_list:
|
||||
# Limit the number of displayed server (see issue #1256)
|
||||
if line >= servers_list_max:
|
||||
continue
|
||||
# Get server stats
|
||||
server_stat = {}
|
||||
for c in column_def:
|
||||
|
Loading…
Reference in New Issue
Block a user