mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-22 00:31:37 +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):
|
class GlancesStatsServer(GlancesStats):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
GlancesStats.__init__(self)
|
GlancesStats.__init__(self)
|
||||||
|
|
||||||
@ -1014,6 +1015,7 @@ class GlancesStatsServer(GlancesStats):
|
|||||||
|
|
||||||
|
|
||||||
class GlancesStatsClient(GlancesStats):
|
class GlancesStatsClient(GlancesStats):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
GlancesStats.__init__(self)
|
GlancesStats.__init__(self)
|
||||||
# Cached informations (no need to be refreshed)
|
# Cached informations (no need to be refreshed)
|
||||||
@ -1656,8 +1658,11 @@ class glancesScreen:
|
|||||||
return 0
|
return 0
|
||||||
screen_x = self.screen.getmaxyx()[1]
|
screen_x = self.screen.getmaxyx()[1]
|
||||||
screen_y = self.screen.getmaxyx()[0]
|
screen_y = self.screen.getmaxyx()[0]
|
||||||
|
memblocksize = 46
|
||||||
|
extblocksize = 18
|
||||||
if (screen_y > self.mem_y + 5 and
|
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
|
# RAM
|
||||||
self.term_window.addnstr(self.mem_y,
|
self.term_window.addnstr(self.mem_y,
|
||||||
self.mem_x + offset_x, _("Mem"), 8,
|
self.mem_x + offset_x, _("Mem"), 8,
|
||||||
@ -1692,39 +1697,46 @@ class glancesScreen:
|
|||||||
self.mem_y + 3, self.mem_x + offset_x + 7,
|
self.mem_y + 3, self.mem_x + offset_x + 7,
|
||||||
format(self.__autoUnit(mem['free']), '>5'), 5)
|
format(self.__autoUnit(mem['free']), '>5'), 5)
|
||||||
|
|
||||||
# active and inactive (only available for psutil >= 0.6)
|
if (screen_x > self.mem_x + offset_x + memblocksize):
|
||||||
if psutil_mem_vm:
|
# Display extended informations if space is available
|
||||||
# active
|
|
||||||
self.term_window.addnstr(self.mem_y,
|
# active and inactive (only available for psutil >= 0.6)
|
||||||
|
if psutil_mem_vm:
|
||||||
|
# active
|
||||||
|
self.term_window.addnstr(self.mem_y,
|
||||||
|
self.mem_x + offset_x + 14,
|
||||||
|
_("active:"), 7)
|
||||||
|
self.term_window.addnstr(
|
||||||
|
self.mem_y, self.mem_x + offset_x + 24,
|
||||||
|
format(self.__autoUnit(mem['active']), '>5'), 5)
|
||||||
|
|
||||||
|
# inactive
|
||||||
|
self.term_window.addnstr(self.mem_y + 1,
|
||||||
|
self.mem_x + offset_x + 14,
|
||||||
|
_("inactive:"), 9)
|
||||||
|
self.term_window.addnstr(
|
||||||
|
self.mem_y + 1, self.mem_x + offset_x + 24,
|
||||||
|
format(self.__autoUnit(mem['inactive']), '>5'), 5)
|
||||||
|
|
||||||
|
# buffers (Linux, BSD)
|
||||||
|
self.term_window.addnstr(self.mem_y + 2,
|
||||||
self.mem_x + offset_x + 14,
|
self.mem_x + offset_x + 14,
|
||||||
_("active:"), 7)
|
_("buffers:"), 8)
|
||||||
self.term_window.addnstr(
|
self.term_window.addnstr(
|
||||||
self.mem_y, self.mem_x + offset_x + 24,
|
self.mem_y + 2, self.mem_x + offset_x + 24,
|
||||||
format(self.__autoUnit(mem['active']), '>5'), 5)
|
format(self.__autoUnit(mem['buffers']), '>5'), 5)
|
||||||
|
|
||||||
# inactive
|
# cached (Linux, BSD)
|
||||||
self.term_window.addnstr(self.mem_y + 1,
|
self.term_window.addnstr(self.mem_y + 3,
|
||||||
self.mem_x + offset_x + 14,
|
self.mem_x + offset_x + 14,
|
||||||
_("inactive:"), 9)
|
_("cached:"), 7)
|
||||||
self.term_window.addnstr(
|
self.term_window.addnstr(
|
||||||
self.mem_y + 1, self.mem_x + offset_x + 24,
|
self.mem_y + 3, self.mem_x + offset_x + 24,
|
||||||
format(self.__autoUnit(mem['inactive']), '>5'), 5)
|
format(self.__autoUnit(mem['cached']), '>5'), 5)
|
||||||
|
|
||||||
# buffers (Linux, BSD)
|
else:
|
||||||
self.term_window.addnstr(self.mem_y + 2,
|
# If space is NOT available then mind the gap...
|
||||||
self.mem_x + offset_x + 14,
|
offset_x -= extblocksize
|
||||||
_("buffers:"), 8)
|
|
||||||
self.term_window.addnstr(
|
|
||||||
self.mem_y + 2, self.mem_x + offset_x + 24,
|
|
||||||
format(self.__autoUnit(mem['buffers']), '>5'), 5)
|
|
||||||
|
|
||||||
# cached (Linux, BSD)
|
|
||||||
self.term_window.addnstr(self.mem_y + 3,
|
|
||||||
self.mem_x + offset_x + 14,
|
|
||||||
_("cached:"), 7)
|
|
||||||
self.term_window.addnstr(
|
|
||||||
self.mem_y + 3, self.mem_x + offset_x + 24,
|
|
||||||
format(self.__autoUnit(mem['cached']), '>5'), 5)
|
|
||||||
|
|
||||||
# Swap
|
# Swap
|
||||||
self.term_window.addnstr(self.mem_y,
|
self.term_window.addnstr(self.mem_y,
|
||||||
@ -2634,6 +2646,17 @@ class GlancesInstance():
|
|||||||
self.__update__()
|
self.__update__()
|
||||||
return json.dumps(stats.getAll())
|
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):
|
def getCpu(self):
|
||||||
# Update and return CPU stats
|
# Update and return CPU stats
|
||||||
self.__update__()
|
self.__update__()
|
||||||
|
Loading…
Reference in New Issue
Block a user