mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-24 01:35:23 +03:00
Index error when displaying programs on MacOS #2360
This commit is contained in:
parent
25efd90924
commit
59c68acf68
@ -294,12 +294,13 @@ def key_exist_value_not_none(k, d):
|
||||
return k in d and d[k] is not None
|
||||
|
||||
|
||||
def key_exist_value_not_none_not_v(k, d, v=''):
|
||||
def key_exist_value_not_none_not_v(k, d, value='', lengh=None):
|
||||
# Return True if:
|
||||
# - key k exists
|
||||
# - d[k] is not None
|
||||
# - d[k] != v
|
||||
return k in d and d[k] is not None and d[k] != v
|
||||
# - d[k] != value
|
||||
# - if lengh is not None and len(d[k]) >= lengh
|
||||
return k in d and d[k] is not None and d[k] != value and (lengh is None or len(d[k]) >= lengh)
|
||||
|
||||
|
||||
def disable(class_name, var):
|
||||
|
@ -222,7 +222,7 @@ class Plugin(GlancesPlugin):
|
||||
|
||||
def _get_process_curses_vms(self, p, selected, args):
|
||||
"""Return process VMS curses"""
|
||||
if key_exist_value_not_none_not_v('memory_info', p, ''):
|
||||
if key_exist_value_not_none_not_v('memory_info', p, '', 1):
|
||||
msg = self.layout_stat['virt'].format(self.auto_unit(p['memory_info'][1], low_precision=False))
|
||||
ret = self.curse_add_line(msg, optional=True)
|
||||
else:
|
||||
@ -232,7 +232,7 @@ class Plugin(GlancesPlugin):
|
||||
|
||||
def _get_process_curses_rss(self, p, selected, args):
|
||||
"""Return process RSS curses"""
|
||||
if key_exist_value_not_none_not_v('memory_info', p, ''):
|
||||
if key_exist_value_not_none_not_v('memory_info', p, '', 0):
|
||||
msg = self.layout_stat['res'].format(self.auto_unit(p['memory_info'][0], low_precision=False))
|
||||
ret = self.curse_add_line(msg, optional=True)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user