Exemplo n.º 1
0
    def __init__(self, score, time):
        "Initialises resources and start level"

        self.background = pygame.image.load("sprites/sky.jpg")
        self.background.convert()  #for blitting more faster

        self.screen = Constants.SCREEN
        self.score = score
        self.display_items = pygame.sprite.Group()
        self.timeclock = GameTime((0.05, 0.05), time)
        self.display_items.add(self.timeclock, self.score)

        self.time_speed = pygame.time.Clock()
        self.time = 0.0

        self.quit = False
        self.pause = False
        self.start = False
        self.completed = False
        self.gameover = False
        self.message = None

        self.polygon = Polygon(self)
        self.event_manager = EventManager(self)
        self.on_enter()
Exemplo n.º 2
0
    def __init__(self,
                 messageManager,
                 iface,
                 settingsPrefix="/SeismicRisk",
                 organizationName=None,
                 applicationName=None):
        QObject.__init__(self)
        self.msg = messageManager
        self.settings = QSettings(
            organizationName, applicationName
        ) if organizationName and applicationName else QSettings()
        self.dictAutoFields = OrderedDict()
        self.settingsPrefix = settingsPrefix
        self.eventManager = EventManager(self.msg, iface, settingsPrefix)
        self.eventManager.layersAddedCheckIfAutoFields.connect(
            self.checkAndEnableAutoFieldsForLayers)
        self.eventManager.autoFieldsReadyToBeDisabled.connect(
            self.disableAutoFields)
        self.eventManager.attributesAddedCheckIfAutoFields.connect(
            self.checkAndEnableAutoFieldsForLayerFields)
        self.eventManager.attributesDeletedCheckIfAutoFields.connect(
            self.checkAndDisableAutoFieldsForLayer)

        self.eventManager.setAFM(self)

        self.fieldCalculator = FieldCalculator(self.msg, iface)
Exemplo n.º 3
0
def setupEnv():
    em = EventManager()
    em.listVpns()
    em.createVpn(vpnName)
    em.createQ(vpnName, "q1")
    em.addQSubscription(vpnName, "q1", "a/b")
    em.addQSubscription(vpnName, "q1", "d/>")
Exemplo n.º 4
0
    def test_apply(self):
        em = EventManager()
        events = TestEvents()
        em.apply(events)

        with self.assertRaises(TestError):
            em.test()
Exemplo n.º 5
0
    def test_fire_global(self):
        em = EventManager()
        em.test = Event(test_func)
        em.got_event.add_handler(test_func_global)

        with self.assertRaises(TestError):
            em.test()
Exemplo n.º 6
0
def main():
    # initializing and drawing background UI elements
    background = UIBox(g_const.screen_size, (0, 0, 0), (0, 0))
    arena = UIBox(g_const.arena_size, (50, 50, 50), g_const.arena_pos)
    sidebar = UIBox(g_const.sidebar_size, (50, 50, 50), g_const.sidebar_pos)
    background.draw()
    sidebar.draw()

    evt_man = EventManager()
    terrain = Terrain()
    game_state = GameState(terrain)

    start = time.time()
    evt_man.start_world_update()

    while True:
        dt = time.time() - start

        if dt >= frame_length:
            start = time.time()  # reset start tick

            events = evt_man.processEvents()  # handle events

            game_state.update(events)  # update game state

            # draw objects
            arena.draw()
            game_state.curr_shape.draw()
            terrain.draw()

            # update display
            pyg.display.update()
Exemplo n.º 7
0
def main():
    pg.init()
    ev_manager = EventManager()
    model      = GameEngine(ev_manager)
    controller = Controller(ev_manager, model)
    view       = GraphicalView(ev_manager, model)

    model.run()
Exemplo n.º 8
0
 def __init__(self, screenRes=(640, 480)):
     self.running = True
     self.surfaceManager = SurfaceManager(
     )  #Handles the drawing of a scene, managers that have draw functions are added at the bottom of init using .setObjects()
     self.uiManager = UIManager(
     )  #UI managers keep all the buttons and text together, and position them
     self.eventHandlers = EventHandlers()  #Event Handlers
     self.eventManager = EventManager()  #Manages event handlers
     self.surfaceManager.setObjects()  #Sets objects that need drawn
Exemplo n.º 9
0
    def run_app(self):
        print('gui')
        Process(target=gui.run_app,
                args=(self.cfg, self.GuiRecvMsg, self.CtrlRecvMsg)).start()

        print('ctrl')
        # Process(target = Controller.run_app, args = ( self.cfg, self.GuiRecvMsg, self.CtrlRecvMsg )).start()
        funMap = ServiceEvent(self.cfg, self.GuiRecvMsg)
        handlers = ['tumblr', 'sys']
        EventManager(self.CtrlRecvMsg, handlers, funMap).Start()
        print('exitApp')
Exemplo n.º 10
0
 def initialize(self):
     pygame.init()
     Globals.WIDTH = 1000
     Globals.HEIGHT = 600
     Globals.SCREEN = pygame.display.set_mode(
         (Globals.WIDTH, Globals.HEIGHT))
     SettingsManager.load()
     Globals.set_brightness(SettingsManager.BRIGHTNESS, save=False)
     Globals.set_volume(SettingsManager.VOLUME, save=False)
     pygame.display.set_caption('The Crazy Six - Field Day')
     Globals.STATE = Title()
     Globals.EVENT_MANAGER = EventManager()
Exemplo n.º 11
0
def main():
    # Initialization
    pg.init()
    
    # EventManager listen to events and notice model, controller, view
    ev_manager = EventManager()
    model      = GameEngine(ev_manager)
    controller = Controller(ev_manager, model)
    view       = GraphicalView(ev_manager, model)

    # Main loop
    model.run()
Exemplo n.º 12
0
    def __init__(self, config):
        self.logger = logging.getLogger("SmartHome")
        self.config = config

        httpThreadsNumber = int(config['http_threads_number'])
        self.httpDispatcher = MultiThreadingDispatcher("HttpDispatcher",
                                                       httpThreadsNumber)

        self.httpHandler = HTTPCommandHandler()

        self.httpHandler.setHandler('ping', self.pingHandler)
        self.httpHandler.setHandler('status', self.statusHandler)

        self.videoController = VideoController(config['VideoController'])
        self.videoCommandHandler = VideoCommandHandler(self.videoController)
        self.httpHandler.setHandler('video',
                                    self.videoCommandHandler.handleCommand)

        self.controlManager = ControlManager(config['ControlManager'])
        self.controlCommandHandler = ControlCommandHandler(self.controlManager)
        self.httpHandler.setHandler('control',
                                    self.controlCommandHandler.handleCommand)

        self.sensorManager = SensorManager(config['SensorManager'])
        self.sensorCommandHandler = SensorCommandHandler(self.sensorManager)
        self.httpHandler.setHandler('sensor',
                                    self.sensorCommandHandler.handleCommand)

        self.http_port = int(config['http_port'])
        self.httpServer = DispatchedBackgroundHTTPServer(
            ('', self.http_port), self.httpHandler.getRequestHandlerClass(),
            self.httpDispatcher)
        self.httpServer.allow_reuse_address = True

        self.arduinoController = ArduinoController(config['ArduinoController'])

        self.shellSensorProvider = ShellSensorProvider(
            config['ShellSensorProvider'])
        self.shellControlProvider = ShellControlProvider(
            config['ShellControlProvider'])

        self.eventManager = EventManager(config['EventManager'])
        self.eventCommandHandler = EventCommandHandler(self.eventManager)

        self.shellEventHandlerProvider = ShellEventHandlerProvider(
            config['ShellEventHandlerProvider'])
        self.httpHandler.setHandler('event',
                                    self.eventCommandHandler.handleCommand)
Exemplo n.º 13
0
Arquivo: test.py Projeto: Qipccc/pyPLC
def test():
    # 实例化监听器
    # listner1 = Listener("thinkroom") #订阅者1
    # listner2 = Listener("steve")     #订阅者2
    gh_port = 8849
    ghclient = GhClient("127.0.0.1", gh_port)

    # 实例化事件操作函数
    eventManager = EventManager()
    eventManager.AddEventListener(EVENT_ARTICAL, ghclient.receiveData)

    #绑定事件和监听器响应函数(新文章)
    # eventManager.AddEventListener(EVENT_ARTICAL, listner1.ReadArtical)
    # eventManager.AddEventListener(EVENT_ARTICAL, listner2.ReadArtical)
    # 启动事件管理器,# 启动事件处理线程
    eventManager.Start()
Exemplo n.º 14
0
def queueLoop(_GuiRecvMsg, funCall):
    guiCallBack = GuiCallBack(funCall)
    # _EventListenerMap
    # _ELM = {
    #     'tumblr':[
    #         'tumblr__appendImg',
    #         'tumblr__setImgId',
    #         'tumblr__setImgIdOver',
    #         'tumblr__setImgBg',
    #         'tumblr__setPreview',
    #         'downloaded',
    #         'timeout',
    #         'statusBar',
    #     ]
    # }
    # funMap = {}
    # for k in _ELM:
    #     funMap[k] = {}
    #     for v in _ELM[k]:
    #         funMap[k][v] = getattr(guiCallBack, v)

    handlers = ['tumblr', 'sys']
    EventManager(_GuiRecvMsg, handlers, guiCallBack).Start()
Exemplo n.º 15
0
 def __init__(self):
     self.evt_mgr = EventManager()
Exemplo n.º 16
0
def startup(args: argparse.Namespace, **kwargs: Dict[str, Any]) -> None:
    global announce, dispatcher, group, httpServer, notification, validator
    global registration, remote, request, security, statistics, storage, event
    global rootDirectory
    global aeStatistics
    global supportedReleaseVersions, cseType, defaultSerialization, cseCsi, cseRi, cseRn
    global cseOriginator
    global isHeadless

    rootDirectory = os.getcwd()  # get the root directory
    os.environ[
        "FLASK_ENV"] = "development"  # get rid if the warning message from flask.
    # Hopefully it is clear at this point that this is not a production CSE

    # Handle command line arguments and load the configuration
    if args is None:
        args = argparse.Namespace(
        )  # In case args is None create a new args object and populate it
        args.configfile = None
        args.resetdb = False
        args.loglevel = None
        args.headless = False
        for key, value in kwargs.items():
            args.__setattr__(key, value)
    isHeadless = args.headless

    if not Configuration.init(args):
        return

    # Initialize configurable constants
    supportedReleaseVersions = Configuration.get(
        'cse.supportedReleaseVersions')
    cseType = Configuration.get('cse.type')
    cseCsi = Configuration.get('cse.csi')
    cseRi = Configuration.get('cse.ri')
    cseRn = Configuration.get('cse.rn')
    cseOriginator = Configuration.get('cse.originator')

    defaultSerialization = Configuration.get('cse.defaultSerialization')

    # init Logging
    Logging.init()
    if not args.headless:
        Logging.console('Press ? for help')
    Logging.log('============')
    Logging.log('Starting CSE')
    Logging.log(f'CSE-Type: {cseType.name}')
    Logging.log('Configuration:')
    Logging.log(Configuration.print())

    # Initiatlize the resource storage
    storage = Storage()

    # Initialize the event manager
    event = EventManager()

    # Initialize the statistics system
    statistics = Statistics()

    # Initialize the registration manager
    registration = RegistrationManager()

    # Initialize the resource validator
    validator = Validator()

    # Initialize the resource dispatcher
    dispatcher = Dispatcher()

    # Initialize the request manager
    request = RequestManager()

    # Initialize the security manager
    security = SecurityManager()

    # Initialize the HTTP server
    httpServer = HttpServer()

    # Initialize the notification manager
    notification = NotificationManager()

    # Initialize the group manager
    group = GroupManager()

    # Import a default set of resources, e.g. the CSE, first ACP or resource structure
    # Import extra attribute policies for specializations first
    importer = Importer()
    if not importer.importAttributePolicies() or not importer.importResources(
    ):
        return

    # Initialize the remote CSE manager
    remote = RemoteCSEManager()

    # Initialize the announcement manager
    announce = AnnouncementManager()

    # Start AEs
    startAppsDelayed(
    )  # the Apps are actually started after the CSE finished the startup

    # Start the HTTP server
    event.cseStartup()  # type: ignore
    httpServer.run()  # This does return (!)

    Logging.log('CSE started')
    if isHeadless:
        # when in headless mode give the CSE a moment (2s) to experience fatal errors before printing the start message
        BackgroundWorkerPool.newActor(
            delay=2,
            workerCallback=lambda: Logging.console('CSE started')
            if not shuttingDown else None).start()

    #
    #	Enter an endless loop.
    #	Execute keyboard commands in the keyboardHandler's loop() function.
    #
    commands = {
        '?': _keyHelp,
        'h': _keyHelp,
        '\n': lambda c: print(),  # 1 empty line
        '\x03': _keyShutdownCSE,  # See handler below
        'c': _keyConfiguration,
        'C': _keyClearScreen,
        'D': _keyDeleteResource,
        'i': _keyInspectResource,
        'l': _keyToggleLogging,
        'Q': _keyShutdownCSE,  # See handler below
        'r': _keyCSERegistrations,
        's': _keyStatistics,
        't': _keyResourceTree,
        'T': _keyChildResourceTree,
        'w': _keyWorkers,
    }

    #	Endless runtime loop. This handles key input & commands
    #	The CSE's shutdown happens in one of the key handlers below
    loop(commands, catchKeyboardInterrupt=True, headless=args.headless)
    shutdown()
Exemplo n.º 17
0
def tearDownEnv():
    em = EventManager()
    em.deleteQ(vpnName, "q1")
    em.deleteVpn(vpnName)
Exemplo n.º 18
0
 def test_creation_kwargs(self):
     em = EventManager(test=test_event)
     self.assertEqual(em.test, test_event)
Exemplo n.º 19
0
def run():
    event_manager = EventManager()

    controller = Controller(event_manager)

    app = Flask(__name__,
                static_folder="web/dist",
                static_url_path="/static",
                template_folder="web/dist")

    @app.route('/')
    def static_page():
        return render_template('index.html')

    @app.route('/update/<string:user_id>')
    def update(user_id):
        def gen():
            with app.app_context():
                q = event_manager.subscribe(user_id)
                print("subscribe")

                controller.update_new_client(user_id)

                try:
                    while True:
                        event = q.get()
                        yield event.encode()
                finally:
                    event_manager.unsubscribe(user_id)
                    print("unsubscribe")

        return Response(gen(), mimetype="text/event-stream")

    @app.route('/load_node/<string:user_id>/<string:node_id>')
    def load_node(user_id, node_id):
        return jsonify(controller.load_node(user_id, node_id))

    @app.route('/add_node/<string:user_id>/<string:parent_id>')
    @app.route('/add_node/<string:user_id>/<string:parent_id>/<int:sorting>')
    def add_node(user_id, parent_id, sorting=-1):
        node_id = controller.add_node(user_id, parent_id, sorting)
        return jsonify({'id': node_id})

    @app.route('/update_content/<string:node_id>', methods=['POST'])
    def update_content(node_id):
        controller.update_node(node_id, json.loads(request.form.get('data')))

        return ""

    @app.route('/update_file/<string:node_id>', methods=['POST'])
    def update_file(node_id):
        if 'file' in request.files:
            file = request.files['file']

            if file.filename != '':
                hash_md5 = hashlib.md5()
                for chunk in iter(lambda: file.stream.read(4096), b""):
                    hash_md5.update(chunk)
                file.stream.seek(0)

                filename = secure_filename(
                    node_id + "_" + hash_md5.hexdigest() +
                    file.filename[file.filename.rfind('.'):])

                file.save(os.path.join("data/uploads/", filename))

                controller.delete_file(node_id)
                controller.update_node(
                    node_id, {"file": filename + "/" + file.mimetype})

        return ""

    @app.route('/file/<string:path>')
    def file(path):
        return send_from_directory('data/uploads', path)

    @app.route('/delete_node/<string:node_id>')
    def delete_node(node_id):
        controller.delete_node(node_id)

        return ""

    @app.route('/delete_file/<string:node_id>')
    def delete_file(node_id):
        controller.delete_file(node_id)

        return ""

    @app.route(
        '/move_node/<string:node_id>/<string:old_parent>/<string:new_parent>')
    @app.route(
        '/move_node/<string:node_id>/<string:old_parent>/<string:new_parent>/<int:sorting>'
    )
    def move_node(node_id, old_parent, new_parent, sorting=-1):
        controller.move_node(node_id, old_parent, new_parent, sorting)

        return ""

    return app
Exemplo n.º 20
0
def startup(args: argparse.Namespace, **kwargs: Dict[str, Any]) -> None:
    global announce, dispatcher, group, httpServer, notification, validator
    global registration, remote, security, statistics, storage, event
    global rootDirectory
    global aeStatistics

    rootDirectory = os.getcwd()  # get the root directory
    os.environ[
        "FLASK_ENV"] = "development"  # get rid if the warning message from flask.
    # Hopefully it is clear at this point that this is not a production CSE

    # Handle command line arguments and load the configuration
    if args is None:
        args = argparse.Namespace(
        )  # In case args is None create a new args object and populate it
        args.configfile = None
        args.resetdb = False
        args.loglevel = None
        for key, value in kwargs.items():
            args.__setattr__(key, value)

    if not Configuration.init(args):
        return

    # init Logging
    Logging.init()
    Logging.log('============')
    Logging.log('Starting CSE')
    Logging.log('CSE-Type: %s' % C.cseTypes[Configuration.get('cse.type')])
    Logging.log(Configuration.print())

    # Initiatlize the resource storage
    storage = Storage()

    # Initialize the event manager
    event = EventManager()

    # Initialize the statistics system
    statistics = Statistics()

    # Initialize the registration manager
    registration = RegistrationManager()

    # Initialize the resource validator
    validator = Validator()

    # Initialize the resource dispatcher
    dispatcher = Dispatcher()

    # Initialize the security manager
    security = SecurityManager()

    # Initialize the HTTP server
    httpServer = HttpServer()

    # Initialize the notification manager
    notification = NotificationManager()

    # Initialize the announcement manager
    announce = AnnouncementManager()

    # Initialize the group manager
    group = GroupManager()

    # Import a default set of resources, e.g. the CSE, first ACP or resource structure
    importer = Importer()
    if not importer.importResources():
        return

    # Initialize the remote CSE manager
    remote = RemoteCSEManager()
    remote.start()

    # Start AEs
    startAppsDelayed(
    )  # the Apps are actually started after the CSE finished the startup

    # Start the HTTP server
    event.cseStartup()  # type: ignore
    Logging.log('CSE started')
    httpServer.run()  # This does NOT return
Exemplo n.º 21
0
def queueLoop(_GuiQueue, funCall):
    guiCallBack = GuiCallBack(funCall)
    EventManager(_GuiQueue, guiCallBack).Start()
Exemplo n.º 22
0
def startServiceP(_GuiQueue, _ServiceQueue, cfg):
    '''开启一个服务进程'''
    funMap = ServiceEvent(_GuiQueue, cfg)
    EventManager(_ServiceQueue, funMap).Start()
def need_a_ride(event_id=None, ride_request_id=None):
    # pdb.set_trace()
    try:
        event = Event(_id=ObjectId(event_id), db=db)
        manager = EventManager(event=event, db=db)
        # reservation = Reservation(event=event, db=db)
        # reservation = manager.reservation_map[event_id]
        if ride_request_id is None:
            name = request.form['name']
            email = request.form['email']
            num_seats = int(request.form['num_seats'])

            # create a request
            requester = Person(name=name, email=email, db=db)
            rideshare_request = RideshareRequest(requester=requester,
                                                 number_seats=num_seats,
                                                 event=event,
                                                 db=db)
            # request_id = reservation.register_rideshare_request(rideshare_request)
            # serialize_manager()
            return redirect('/event/{}/request_ride/{}'.format(
                event_id, str(rideshare_request._id)))

        else:
            # rideshare_request = reservation.rideshare_requests[ride_request_id]
            rideshare_request = RideshareRequest(_id=ObjectId(ride_request_id),
                                                 db=db)

            match = None
            for rideshare in manager.get_rideshares():
                if rideshare_request.requester in rideshare.riders:
                    match = rideshare.ride_sharer
                    break

            html = ''
            if match is not None:
                html += "You've been matched with {}".format(match.name)

            else:

                open_rideshares = manager.get_open_rideshares(
                    rideshare_request.number_seats)

                if len(open_rideshares) == 0:
                    html = 'Sorry, there are no available rideshares at this time. '
                    html += 'Check back soon to see when rides become available'
                else:
                    html = 'There {} {} ride{} available'.format(
                        'are' if len(open_rideshares) != 1 else 'is',
                        len(open_rideshares),
                        's' if len(open_rideshares) != 1 else '')
                    html += '<br><br>'
                    html += 'Select any rides you would be happy taking'
                    html += '<form action="requested" method="post">'
                    for rideshare in open_rideshares:
                        ride_sharer = rideshare.ride_sharer
                        html += '<input type="checkbox" '
                        html += 'name="id" value="{}" '.format(
                            str(rideshare._id))
                        html += '/>'
                        html += ' {} ({} seat{})'.format(
                            ride_sharer.name, rideshare.seats_available(),
                            's' if rideshare.seats_available() != 1 else '')
                        html += ' <br>'
                    html += '<input type="submit" value="Submit">'
                    html += '</form>'

            return html
    except Exception as e:
        print('>>> error!')
        import traceback
        print(traceback.format_exc())
        #print(manager.reservation_map)
        raise e
Exemplo n.º 24
0
        print 'BACKSPACE RELEASE'

    def handle_return(self):
        print 'RETURN'

    def handle_return_keyup(self):
        print 'RETURN RELEASE'

    def handle_escape(self):
        print 'ESCAPE'

    def handle_escape_keyup(self):
        print 'ESCAPE RELEASE'

    def render(self):
        Globals.SCREEN.fill((0, 0, 0))


if __name__ == '__main__':
    SettingsManager.load()
    Globals.EVENT_MANAGER = EventManager()
    Globals.STATE = TestInput()
    pygame.init()
    Globals.WIDTH = 150
    Globals.HEIGHT = 150
    Globals.SCREEN = pygame.display.set_mode((Globals.WIDTH, Globals.HEIGHT))
    while Globals.RUNNING:
        Globals.STATE.render()
        pygame.display.flip()
        Globals.EVENT_MANAGER.check_events()
def have_a_ride(event_id=None, rideshare_id=None):
    try:
        event = Event(_id=ObjectId(event_id), db=db)
        manager = EventManager(event=event, db=db)
        # reservation = Reservation(event=event, db=db)
        # reservation = manager.reservation_map[event_id]
        if rideshare_id is None:
            name = request.form['name']
            email = request.form['email']
            # location = request.form['location']
            num_seats = int(request.form['num_seats'])

            p = Person(name=name, email=email, db=db)
            rideshare = Rideshare(ride_sharer=p,
                                  number_seats=num_seats,
                                  event=event,
                                  db=db)
            # reservation.rideshares.add(rideshare)
            # rideshare_id = reservation.register_rideshare(rideshare)
            # serialize_manager()

            return redirect('/event/{}/rideshare/{}'.format(
                event_id, str(rideshare._id)))
        else:
            print(manager.get_rideshares())
            # rideshare = reservation.rideshares[rideshare_id]
            rideshare = Rideshare(_id=ObjectId(rideshare_id), db=db)

            rideshare_request_matches = \
                manager.get_rideshare_request_matches(rideshare)

            html = "Thanks for offering a ride"
            html += " -- you have {} of {} spots available".format(
                rideshare.seats_available(), rideshare.number_seats)
            html += "<br><br>"
            html += "<h1>Reserved</h1>"
            if len(rideshare.riders) == 0:
                html += "None Yet!"
            else:
                html += '<ul>'
                for rider in rideshare.riders:
                    html += "<li>{}</li>".format(rider.name)
                html += '</ul>'
            html += "<br><br>"
            html += "<h1>Open</h1>"

            if len(rideshare_request_matches) == 0:
                html += "No one needs a ride yet - we'll email you if you can help"
            else:
                html += 'Select up to {} requests to reserve spots'.format(
                    rideshare.seats_available())
                html += '<form action="reserved" method="post">'
                for rideshare_request in rideshare_request_matches:
                    requester = rideshare_request.requester
                    html += '<input type="checkbox" '
                    html += 'name="id" value="{}" '.format(
                        str(rideshare_request._id))
                    html += '/>'
                    html += ' {}'.format(requester.name)
                    html += ' <br>'
                html += '<input type="submit" value="Submit">'
                html += '</form>'

            return html
    except Exception as e:
        print('>>> error!')
        import traceback
        print(traceback.format_exc())
        #print(manager.reservation_map)
        raise e
Exemplo n.º 26
0
from TextContainer import TextContainer
from FunctionBox import FunctionBox
import pygame
import pygame.freetype

pygame.init()

screen_width = 1280
screen_height = 720
main_surface = pygame.display.set_mode((screen_width, screen_height))

text_container_height = 80
padding = 20
max_cont = (screen_height // (text_container_height + padding)) - 2

event_manager = EventManager()

graph = Graph(event_manager, (0, 0), (screen_width, screen_height))
sidebar = Sidebar((300, screen_height), pygame.Color('#3a577b'),
                  pygame.Color('#4d4d4d'))
toggle_button = ToggleButton(event_manager, (95, 25), [screen_width - 220, 30],
                             'degrees', 'radians')


def create_new_text_container():
    if len(FunctionBox.all_function_boxes) - 1 != max_cont:
        place = len(
            FunctionBox.all_function_boxes) * (text_container_height + padding)
        FunctionBox(event_manager, (0, place), (300, text_container_height),
                    30)
Exemplo n.º 27
0
def queueLoop(_GuiRecvMsg, funCall):
    guiCallBack = GuiCallBack(funCall)
    handlers = ['tumblr', 'sys']
    EventManager(_GuiRecvMsg, handlers, guiCallBack).Start()
Exemplo n.º 28
0
def startServiceP(cfg, _GuiRecvMsg, _CtrlRecvMsg):
    funMap = ServiceEvent(cfg, _GuiRecvMsg)
    handlers = ['tumblr', 'sys']
    EventManager(_CtrlRecvMsg, handlers, funMap).Start()
Exemplo n.º 29
0
 def test_creation(self):
     EventManager()