42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
#!/usr/bin/python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from curses import wrapper as start, init_pair as set_pair, color_pair as get_pair, COLOR_BLACK as black, COLOR_RED as red, COLOR_GREEN as green, COLOR_WHITE as white, COLOR_BLUE as blue, COLOR_YELLOW as yellow
|
|
|
|
# C'est pour importer des modules du repertoire courant
|
|
from os.path import dirname
|
|
from sys import path as pythonpath
|
|
pythonpath.insert (0, dirname (__file__))
|
|
|
|
from utils import groupbythree, seconds_to_time, sleep_to_next_second
|
|
from modules import title, uptime, loadavg, ram, network, sensors, hddtemp, df, dnsmasq_bounds, user
|
|
modules = (title, uptime, loadavg, ram, network, sensors, hddtemp, df, dnsmasq_bounds, user)
|
|
|
|
def Main (screen):
|
|
old_line = 0
|
|
screen.clear ()
|
|
set_pair (1, white, black)
|
|
set_pair (2, blue, black)
|
|
set_pair (3, green, black)
|
|
set_pair (4, red, black)
|
|
set_pair (5, yellow, black)
|
|
while True:
|
|
line = 0
|
|
height, width = screen.getmaxyx ()
|
|
for i in range (0, old_line + 1):
|
|
for j in range (0, width - 1):
|
|
screen.addstr (i, j, ' ', get_pair (1))
|
|
for i in modules:
|
|
line = i.main (line, screen)
|
|
line += 1
|
|
|
|
screen.refresh ()
|
|
old_line = line
|
|
try:
|
|
sleep_to_next_second ()
|
|
except KeyboardInterrupt:
|
|
break
|
|
|
|
|
|
start (Main)
|
|
print ('Quit') |