mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-21 16:22:03 +03:00
Solve an issue when screen size < 80 columns
This commit is contained in:
parent
c39eb76a03
commit
74323a392a
@ -978,6 +978,7 @@ class GlancesStats:
|
||||
|
||||
|
||||
class GlancesStatsServer(GlancesStats):
|
||||
|
||||
def __init__(self):
|
||||
GlancesStats.__init__(self)
|
||||
|
||||
@ -1014,6 +1015,7 @@ class GlancesStatsServer(GlancesStats):
|
||||
|
||||
|
||||
class GlancesStatsClient(GlancesStats):
|
||||
|
||||
def __init__(self):
|
||||
GlancesStats.__init__(self)
|
||||
# Cached informations (no need to be refreshed)
|
||||
@ -1656,8 +1658,11 @@ class glancesScreen:
|
||||
return 0
|
||||
screen_x = self.screen.getmaxyx()[1]
|
||||
screen_y = self.screen.getmaxyx()[0]
|
||||
memblocksize = 46
|
||||
extblocksize = 18
|
||||
if (screen_y > self.mem_y + 5 and
|
||||
screen_x > self.mem_x + offset_x + 38):
|
||||
screen_x > self.mem_x + offset_x + memblocksize - extblocksize):
|
||||
|
||||
# RAM
|
||||
self.term_window.addnstr(self.mem_y,
|
||||
self.mem_x + offset_x, _("Mem"), 8,
|
||||
@ -1692,6 +1697,9 @@ class glancesScreen:
|
||||
self.mem_y + 3, self.mem_x + offset_x + 7,
|
||||
format(self.__autoUnit(mem['free']), '>5'), 5)
|
||||
|
||||
if (screen_x > self.mem_x + offset_x + memblocksize):
|
||||
# Display extended informations if space is available
|
||||
|
||||
# active and inactive (only available for psutil >= 0.6)
|
||||
if psutil_mem_vm:
|
||||
# active
|
||||
@ -1726,6 +1734,10 @@ class glancesScreen:
|
||||
self.mem_y + 3, self.mem_x + offset_x + 24,
|
||||
format(self.__autoUnit(mem['cached']), '>5'), 5)
|
||||
|
||||
else:
|
||||
# If space is NOT available then mind the gap...
|
||||
offset_x -= extblocksize
|
||||
|
||||
# Swap
|
||||
self.term_window.addnstr(self.mem_y,
|
||||
self.mem_x + offset_x + 32, _("Swap"), 4,
|
||||
@ -2634,6 +2646,17 @@ class GlancesInstance():
|
||||
self.__update__()
|
||||
return json.dumps(stats.getAll())
|
||||
|
||||
def getSystem(self):
|
||||
# Return operating system info
|
||||
# No need to update...
|
||||
#~ self.__update__()
|
||||
return json.dumps(stats.getSystem())
|
||||
|
||||
def getCore(self):
|
||||
# Update and return number of Core
|
||||
self.__update__()
|
||||
return json.dumps(stats.getCore())
|
||||
|
||||
def getCpu(self):
|
||||
# Update and return CPU stats
|
||||
self.__update__()
|
||||
|
Loading…
Reference in New Issue
Block a user