Ejemplo n.º 1
0
def main():
  logging.config.fileConfig('logging.conf')

  discovery = Discovery(
    discard_timestamps=args.discard_timestamps,
    correct_timestamps=args.correct_timestamps
  )

  analysis = Analysis(discovery)
  ui = Application(discovery)

  discovery.start()
  analysis.start()
  ui.start()
Ejemplo n.º 2
0
def main():
    # create sounds dir if it not exists
    create_sound_dir()

    # initialize UI and BG
    tasks = Queue()
    settings = init_settings()
    handler = TaskHandler(tasks, settings)
    app = Application(tasks, settings)

    # initialize processes
    handler.start()
    app.start()

    # stop BG process when UI is closed
    handler.stop()
Ejemplo n.º 3
0
def main():
    """
    Show the intervention screen.
    """
    application = Application(sys.argv, ignore_close=not SKIP_FILTER)

    # platform.hide_cursor()

    with open(resource_filename(__name__, 'intervention.css')) as css:
        application.setStyleSheet(css.read())

    # exec() is required for objc so we must use spawn
    # multiprocessing.set_start_method('spawn')

    # target = do_nothing

    # if sys.platform == 'darwin' and not SKIP_FILTER:
    #     from filters import filter_input
    #     target = filter_input

    # pool = multiprocessing.Pool(1)  # pylint: disable=not-callable

    # def filter_input_done_cb(ignored):
    #     application.closeAllWindows()

    # result = pool.apply_async(target, callback=filter_input_done_cb)

    # pylint: disable=unused-variable
    @atexit.register
    def exit_handler():
        """
        Clean up.
        """
        logging.info('atexit triggered')

        platform.show_cursor()

    #     # terminate the pool so we don't sit forever waiting on our get()
    #     logging.info('Terminating pool...')
    #     pool.terminate()

    #     logging.info('Joining pool...')
    #     pool.join()

    #     logging.info('Retrieving result...')
    #     try:
    #         # raise any exceptions raised by the input filtering code
    #         result.get(0)
    #     except multiprocessing.TimeoutError:
    #         logging.info('Timed out waiting for result.')

    # def duration_reached():
    #     logging.info('Duration reached, exiting...')

    #     sys.exit(0)

    # Run for DURATION and then exit
    # QtCore.QTimer.singleShot(DURATION, duration_reached)

    application.run()
Ejemplo n.º 4
0
from ui import Application, Display
from ui.threaded import ThreadedDisplay, start_app
from ui.components import DraggableContainer

app = Application(Display(800, 600))

td = ThreadedDisplay(*start_app("test.py"))

td.focused = True

win = DraggableContainer(
    **{
        "target": td,
        "orientation": "vertical",
        "x": 50,
        "y": 50,
        "style": {
            "color": (200, 200, 200)
        }
    })

app.display.root.style["background_color"] = (255, 255, 255)
app.display.root.add(win)

app.launch()
Ejemplo n.º 5
0
def main():
    root = Tk()
    app = Application(root)
    app.start()
Ejemplo n.º 6
0
            continue
        conn = socket.socket()
        utils.set_keepalive(conn)
        try:
            conn.connect((ip, HOST_PORT))
            conn = ssl.wrap_socket(
                sock=conn, certfile=CERT_FILE, keyfile=PRIVATE_KEY_FILE, server_side=True)
            hosts[ip] = conn
            update_hosts(utils.Event(hosts=hosts.keys()))
        except:
            conn.close()
    BDlistener.close()


if __name__ == "__main__":
    CERT_FILE = utils.resource_path("cert.pem")
    PRIVATE_KEY_FILE = utils.resource_path("key.pem")
    THREADS = 32

    private_key = RSA.import_key(open(PRIVATE_KEY_FILE).read())
    cipher_rsa = PKCS1_OAEP.new(private_key)
    hosts = {}
    pool = ThreadPool(processes=THREADS)
    
    app = Application(fetch_file)
    Thread(target=fetch_files, args=(app.on_file_fetched,
                                     app.get_interval, app.update_hosts), daemon=True).start()
    Thread(target=listen_to_hosts, args=(
        app.update_hosts,), daemon=True).start()
    app.mainloop()
Ejemplo n.º 7
0
def main():
    root = tk.Tk()
    root.bind("<Key>", keypress)
    root.bind("<Button-1>", mouseclick)
    app = Application(master=root)
    app.mainloop()
Ejemplo n.º 8
0
from ui import Application, Display
from ui.components import Text

app = Application(Display(640, 480))

txt = Text(
    **{
        "text": "Hello World\n\nWelcome to Polaron!",
        "x": 20,
        "y": 20,
        "width": 400,
        "height": 300,
        "style": {
            "color": (255, 255, 255)
        }
    })

app.display.root.style["background_color"] = (50, 50, 50)
app.display.root.add(txt)

app.launch()