mirror of https://github.com/nicolargo/glances
batterie -> battery
Remove unused variables No whitespace inside parentheses Add missing whitespace around arithmetic operator Fix indentation Remove trailing whitespacespull/353/merge
parent
21b5a27ed6
commit
950b12cfcf
|
@ -81,10 +81,10 @@ temperature_core_critical=80
|
|||
temperature_hdd_careful=45
|
||||
temperature_hdd_warning=52
|
||||
temperature_hdd_critical=60
|
||||
# Batterie % limits
|
||||
batterie_careful=80
|
||||
batterie_warning=90
|
||||
batterie_critical=95
|
||||
# Battery % limits
|
||||
battery_careful=80
|
||||
battery_warning=90
|
||||
battery_critical=95
|
||||
|
||||
[processlist]
|
||||
# Limit values for CPU/MEM per process in %
|
||||
|
|
|
@ -81,10 +81,10 @@ temperature_core_critical=80
|
|||
temperature_hdd_careful=45
|
||||
temperature_hdd_warning=52
|
||||
temperature_hdd_critical=60
|
||||
# Batterie % limits
|
||||
batterie_careful=80
|
||||
batterie_warning=90
|
||||
batterie_critical=95
|
||||
# Battery % limits
|
||||
battery_careful=80
|
||||
battery_warning=90
|
||||
battery_critical=95
|
||||
|
||||
[processlist]
|
||||
# Limit values for CPU/MEM per process in %
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import time
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
import msvcrt
|
||||
try:
|
||||
|
|
|
@ -32,7 +32,7 @@ from glances.plugins.glances_plugin import GlancesPlugin
|
|||
|
||||
class Plugin(GlancesPlugin):
|
||||
"""
|
||||
Glances's batterie capacity Plugin
|
||||
Glances battery capacity plugin
|
||||
|
||||
stats is a list
|
||||
"""
|
||||
|
@ -59,7 +59,7 @@ class Plugin(GlancesPlugin):
|
|||
def update(self):
|
||||
|
||||
"""
|
||||
Update batterie capacity stats using the input method
|
||||
Update battery capacity stats using the input method
|
||||
"""
|
||||
|
||||
# Reset stats
|
||||
|
@ -77,9 +77,10 @@ class Plugin(GlancesPlugin):
|
|||
|
||||
return self.stats
|
||||
|
||||
|
||||
class glancesGrabBat:
|
||||
"""
|
||||
Get batteries stats using the Batinfo librairie
|
||||
Get batteries stats using the Batinfo library
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -91,11 +92,10 @@ class glancesGrabBat:
|
|||
self.initok = True
|
||||
self.bat_list = []
|
||||
self.update()
|
||||
except Exception as e:
|
||||
# print(_("Warning: Can not grab batterie sensor. Missing BatInfo lib (%s).") % e)
|
||||
except Exception:
|
||||
# print(_("Warning: Cannot grab battery sensor. Missing BatInfo library."))
|
||||
self.initok = False
|
||||
|
||||
|
||||
def update(self):
|
||||
"""
|
||||
Update the stats
|
||||
|
@ -103,13 +103,13 @@ class glancesGrabBat:
|
|||
if self.initok:
|
||||
try:
|
||||
self.bat.update()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
self.bat_list = []
|
||||
else:
|
||||
self.bat_list = []
|
||||
new_item = { 'label': _("Batterie (%)"),
|
||||
'value': self.getcapacitypercent() }
|
||||
self.bat_list.append(new_item)
|
||||
new_item = {'label': _("Battery (%)"),
|
||||
'value': self.getcapacitypercent()}
|
||||
self.bat_list.append(new_item)
|
||||
else:
|
||||
self.bat_list = []
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ class Plugin(GlancesPlugin):
|
|||
sx = self.auto_unit(int(i['rx'] // i['time_since_update'])
|
||||
+ int(i['tx'] // i['time_since_update']))
|
||||
else:
|
||||
# Bits per second (for real network administrator | Default)
|
||||
# Bits per second (for real network administrator | Default)
|
||||
if args.network_cumul:
|
||||
rx = self.auto_unit(int(i['cumulative_rx'] * 8)) + "b"
|
||||
tx = self.auto_unit(int(i['cumulative_tx'] * 8)) + "b"
|
||||
|
@ -248,12 +248,12 @@ class Plugin(GlancesPlugin):
|
|||
ret.append(self.curse_add_line(msg))
|
||||
else:
|
||||
msg = "{0:>7}".format(rx)
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_alert(int(i['rx'] // i['time_since_update'] * 8),
|
||||
header=ifname+'_rx')))
|
||||
ret.append(self.curse_add_line(
|
||||
msg, self.get_alert(int(i['rx'] // i['time_since_update'] * 8),
|
||||
header=ifname + '_rx')))
|
||||
msg = "{0:>7}".format(tx)
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_alert(int(i['tx'] // i['time_since_update'] * 8),
|
||||
header=ifname+'_tx')))
|
||||
ret.append(self.curse_add_line(
|
||||
msg, self.get_alert(int(i['tx'] // i['time_since_update'] * 8),
|
||||
header=ifname + '_tx')))
|
||||
|
||||
return ret
|
||||
|
|
|
@ -26,9 +26,9 @@ except ImportError:
|
|||
|
||||
# Import Glances lib
|
||||
from glances.core.glances_globals import is_py3
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
from glances.plugins.glances_hddtemp import Plugin as HddTempPlugin
|
||||
from glances.plugins.glances_batpercent import Plugin as BatPercentPlugin
|
||||
from glances.plugins.glances_hddtemp import Plugin as HddTempPlugin
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
|
||||
|
||||
class Plugin(GlancesPlugin):
|
||||
|
@ -85,8 +85,8 @@ class Plugin(GlancesPlugin):
|
|||
hddtemp = self.__set_type(self.hddtemp_plugin.update(), 'temperature_hdd')
|
||||
self.stats.extend(hddtemp)
|
||||
# Append Batteries %
|
||||
batpercent = self.__set_type(self.batpercent_plugin.update(), 'batterie')
|
||||
self.stats.extend(batpercent)
|
||||
batpercent = self.__set_type(self.batpercent_plugin.update(), 'battery')
|
||||
self.stats.extend(batpercent)
|
||||
elif self.get_input() == 'snmp':
|
||||
# Update stats using SNMP
|
||||
# No standard: http://www.net-snmp.org/wiki/index.php/Net-SNMP_and_lm-sensors_on_Ubuntu_10.04
|
||||
|
@ -99,10 +99,10 @@ class Plugin(GlancesPlugin):
|
|||
3 types of stats is possible in the Sensors plugins:
|
||||
- Core temperature
|
||||
- HDD temperature
|
||||
- Batterie capacity
|
||||
- Battery capacity
|
||||
"""
|
||||
for i in stats:
|
||||
i.update({ 'type': sensor_type })
|
||||
i.update({'type': sensor_type})
|
||||
return stats
|
||||
|
||||
def msg_curse(self, args=None):
|
||||
|
@ -132,7 +132,7 @@ class Plugin(GlancesPlugin):
|
|||
msg = "{0:18}".format(item['label'][:18])
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0:>5}".format(item['value'])
|
||||
if item['type'] == 'batterie':
|
||||
if item['type'] == 'battery':
|
||||
ret.append(self.curse_add_line(msg, self.get_alert(100 - item['value'], header=item['type'])))
|
||||
else:
|
||||
ret.append(self.curse_add_line(msg, self.get_alert(item['value'], header=item['type'])))
|
||||
|
|
Loading…
Reference in New Issue