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