Fixed a typo

This commit is contained in:
Manuel Cortez 2017-03-30 09:13:53 -06:00
parent e0ed4086f6
commit 99248e3c57
2 changed files with 25 additions and 2 deletions

View File

@ -5,9 +5,9 @@ mkdir -p guicurses_0.5/usr/lib/python3/dist-packages/guicurses
mkdir -p guicurses_0.5/usr/share/doc/guicurses mkdir -p guicurses_0.5/usr/share/doc/guicurses
#copy files #copy files
cp guicurses/__init__.py guicurses/widgets.py guicurses/window.py guicurses_0.5/usr/lib/python3/dist-packages/guicurses cp guicurses/__init__.py guicurses/widgets.py guicurses/window.py guicurses_0.5/usr/lib/python3/dist-packages/guicurses
cp copyright guicurses/usr/share/doc/guicurses cp copyright guicurses_0.5/usr/share/doc/guicurses
cp changelog.Debian guicurses_0.5/usr/share/doc/guicurses cp changelog.Debian guicurses_0.5/usr/share/doc/guicurses
gzip -9 guicurses_0.5/usr/share/doc/guicurses gzip -9 guicurses_0.5/usr/share/doc/guicurses/changelog.Debian
chown -R root.root guicurses_0.5 chown -R root.root guicurses_0.5
chmod -R 755 guicurses_0.5 chmod -R 755 guicurses_0.5
chmod 644 guicurses_0.5/DEBIAN/control chmod 644 guicurses_0.5/DEBIAN/control

23
guicurses/utils.py Normal file
View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
""" Module with some useful utilities, not related to GUI."""
import shutil
def get_disk_usage(value=2):
""" Gets disk usage in bites. 0 = total, 1 = used, 2 = free."""
return shutil.disk_usage("/")[value]
def convert_bites(number_of_bites, convert_to="gb"):
n = 1
if convert_to == "kb":
n = 1<<10
if convert_to == "mb":
n = 1<<20
elif convert_to == "gb":
n = 1<<30
if number_of_bites != 0 and n != 1:
return number_of_bites/n
def get_temperature():
""" Retrieves current temperature for CPU in a raspberry pi.
Didn't tried this in other SoC's"""
return int(open('/sys/class/thermal/thermal_zone0/temp').read()) / 1e3