class Config: """ User configuration Here, the status bar items and update intervals are defined """ UPDATE_INTERVAL = 1 bar_items = [ Network("eno1", interval=30), Volume(), Clock(interval=5), SimpleText(Tools.sym(""), on_clicked=logout), ]
def main(fullscreen, resolution): logging.info('Started the mirror') logging.info('Loading modules') pygame.init() mode = 0 if fullscreen: logging.info('Launching in full screen mode') mode = pygame.FULLSCREEN resolution = [0, 0] screen = pygame.display.set_mode(resolution, mode) screen.fill(COLORS['black']) modules = [ Weather(), Clock(), Birthday(), Calendar(), Vasttrafik(), SystemInfo(), ] try: # Check if vcgencmd is installed, to see if it is running on a # raspberry pi with the requires software installed call("vcgencmd") # modules.append(DisplayOnOff()) except FileNotFoundError: pass for module in modules: module.start() pygame.mouse.set_visible(MOUSE_VISIBLE) try: while True: screen.fill(COLORS['black']) for module in modules: data = module.data for surface, position in data: screen.blit(surface, position) pygame.display.flip() # pygame.image.save(screen, 'screen_shot.jpg') sleep(1) if check_if_exit(): return finally: logging.info('Stopping all threads') for module in modules: module.stop() logging.info('Stopped all threads')
from screenfactory import create_screen from modules.clock import Clock import config import time import pygame screen = create_screen() clock = Clock(screen) clock.start() while True: if config.virtual_hardware: pygame.time.wait(10) for event in pygame.event.get(): pass else: time.sleep(0.01)
def get_module(self, screen): from modules.clock import Clock return Clock(screen)