コード例 #1
0
class Main:
    def __init__(self):
        self._script_dir = os.path.dirname(os.path.realpath('__file__'))
        self._quotesManager = QuotesManager()
        self._displayManager = DisplayManager()

    def main(self):
        try:
            while (True):
                quote = self.retrieve_quote()
                self.display_quote(quote)
                time.sleep(constants.REFRESH_TIME_SEC)
        except Exception as e: 
            self.log_message(e)
    
    def retrieve_quote(self):
        quote = self._quotesManager.GetRandomQuote(constants.INSPIRATIONAL)
        print(quote)
        return quote        
    
    def display_quote(self, quote):
        self._displayManager.printQuote(quote)

    def log_message(self, msg):
        print(msg)
        f = open(self._script_dir + "/files/logs.txt", "a")
        f.write("[%s] %s.\n" % (datetime.datetime.now(), msg))
        f.close()    
コード例 #2
0
ファイル: main.py プロジェクト: RhysRead/CarSoft
class Main(object):
    def __init__(self):
        self.__display_manager = DisplayManager(self)
        self.thread_manager = ThreadManager()
        self.interface_manager = InterfaceManager()

        logging.info('All managers initialised.')

    def start(self):
        logging.info('Starting CarSoft...')

        # Starting managers
        self.thread_manager.start()

        logging.info('Finished starting. Displaying window on main thread.')
        # Beginning display manager on main thread
        self.__display_manager.start()
コード例 #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import os
import time
import threading
import argparse

#Custom classes
from parser import LogParser
from display import DisplayManager

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Parses http log files to generate useful stat')

    parser.add_argument('-t', '--threshold', metavar='threshold', type=int, default = 1000, help='The threshold of page served by 2min which will generate alarms')
    parser.add_argument('filenames', metavar='log files', nargs='+', help='Files where are stocked http logs')
    args = parser.parse_args()

    # This lock serve too avoid reading data when the parser is updating them
    updatingDataLock = threading.Lock()
    parser = LogParser(args.filenames, updatingDataLock, args.threshold)
    displayManager = DisplayManager(parser ,updatingDataLock)
    parser.parserManager.start()
    displayManager.displayManager.start()
    displayManager.stdscr.getch()
    displayManager.clearCurse()
コード例 #4
0
 def __init__(self):
     self._script_dir = os.path.dirname(os.path.realpath('__file__'))
     self._quotesManager = QuotesManager()
     self._displayManager = DisplayManager()
コード例 #5
0
ファイル: main.py プロジェクト: RhysRead/CarSoft
    def __init__(self):
        self.__display_manager = DisplayManager(self)
        self.thread_manager = ThreadManager()
        self.interface_manager = InterfaceManager()

        logging.info('All managers initialised.')
コード例 #6
0
                "left_3": left3, "right_3": right3,
                "left_4": left4, "right_4": right4,
                "left_5": left5, "right_5": right5}

    dimensions = {"screenwidth": 1024, "screenheight": 576, 
                "overlay_width": 1024, "overlay_height": 576}

    # Initialise DataManager
    points = DataManager(dimensions, options, FPS, hub_radius=200)

    # Initialise InputManager, get idle_axis, update points with idle_axis.
    inputs = InputManager(joystick_num=0, points=points, rumble_ms=40)
    points.update_idle_points(inputs.idle_axis)
    
    # Initialise the display.
    display = DisplayManager(points=points, no_frame=False)

    # Used to manage how fast it updates
    clock = pygame.time.Clock()

    # Loop variables.
    done = False
    variant = 0
    wait_time = 220

    while done != True:
        # Get controller data
        state = inputs.get_controller_state()
        # It's a bit odd in the initial state
        mod1 = abs(int(state["input"]["buttons"][5])) == 1
        upper = abs(int(state["input"]["buttons"][4])) == 1
コード例 #7
0
ファイル: start.py プロジェクト: taylorlloyd/wedding-rfid
(stdin, stdout) = (sys.stdin, sys.stdout)
(sys.stdin, sys.stdout) = (None, None)
screen = pygame.display.set_mode(size, pygame.HWSURFACE | pygame.DOUBLEBUF)
(sys.stdin, sys.stdout) = (stdin, stdout)
print("Display mode set")
# Clear the screen to start
screen.fill((0, 0, 0))
# Initialise font support
pygame.font.init()
# Render the screen
pygame.display.flip()
# Hide the cursor
pygame.mouse.set_visible(0)

if MODE == 'activator':
    prompt = ActivationPrompt()
elif MODE == 'tables':
    prompt = TablePrompt()
else:
    prompt = FlipperPrompt()

print("Starting display manager")
display_manager = DisplayManager(screen, prompt)
rfid_loop()
display_thread = threading.Thread(target=display_manager.activity_loop)
display_thread.daemon = True
display_thread.start()

while (True):
    continue
コード例 #8
0
    move each `Person` from `Site` to `Site` according to its commuting patterns.
    for each `Site`:
        update the infection status for all `Person`s in the `Site`
"""
from initialize import create_people, create_sites
from update import move_people, update_people_status
from metrics import MetricManager
from display import DisplayManager
from timing import time_iter

sites = create_sites()
people = create_people(sites)

policy = None
metrics = MetricManager(people, sites)
display = DisplayManager(people, sites)
# policy = PolicyObject(people, sites)

# time step, in minutes
time_step = 5

display_interval = 2
metric_interval = 72

for step, time in enumerate(time_iter(time_step)):
    if step % metric_interval == 0:
        metrics.show(time)
    if step % display_interval == 0:
        display.update(time)
    # display.update(people, sites, step)
    # policy.update(people, sites, metrics)