"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_battery.py" between
dstat-0.7.3.tar.gz and dstat-0.7.4.tar.gz

About: dstat is a versatile resource statistic tool and a replacement for vmstat, iostat and ifstat (using Python).

dstat_battery.py  (dstat-0.7.3):dstat_battery.py  (dstat-0.7.4)
skipping to change at line 21 skipping to change at line 21
self.width = 4 self.width = 4
self.scale = 34 self.scale = 34
self.battery_type = "none" self.battery_type = "none"
def check(self): def check(self):
if os.path.exists('/proc/acpi/battery/'): if os.path.exists('/proc/acpi/battery/'):
self.battery_type = "procfs" self.battery_type = "procfs"
elif glob.glob('/sys/class/power_supply/BAT*'): elif glob.glob('/sys/class/power_supply/BAT*'):
self.battery_type = "sysfs" self.battery_type = "sysfs"
else: else:
raise Exception, "No ACPI battery information found." raise Exception('No ACPI battery information found.')
def vars(self): def vars(self):
ret = [] ret = []
if self.battery_type == "procfs": if self.battery_type == "procfs":
for battery in os.listdir('/proc/acpi/battery/'): for battery in os.listdir('/proc/acpi/battery/'):
for line in dopen('/proc/acpi/battery/'+battery+'/state').readli nes(): for line in dopen('/proc/acpi/battery/'+battery+'/state').readli nes():
l = line.split() l = line.split()
if len(l) < 2: continue if len(l) < 2: continue
if l[0] == 'present:' and l[1] == 'yes': if l[0] == 'present:' and l[1] == 'yes':
ret.append(battery) ret.append(battery)
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)