コード例 #1
0
ファイル: config.py プロジェクト: chirtz/i3stuff
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),
    ]
コード例 #2
0
ファイル: main.py プロジェクト: sibuser/magic_mirror
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')
コード例 #3
0
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)
コード例 #4
0
ファイル: menuitems.py プロジェクト: nteej/pixelpi
	def get_module(self, screen):
		from modules.clock import Clock
		return Clock(screen)