Esempio n. 1
0
    def __init__(self, name, label, width, height, show_fps, logging,
                 alignment, default_node_width, default_node_height, bg_color,
                 start_timers, structure_document, structure, hotkeys,
                 initializer, events):
        super(Window, self).__init__(name, label, width, height, show_fps,
                                     logging, alignment, default_node_width,
                                     default_node_height, bg_color,
                                     start_timers, structure_document,
                                     structure, hotkeys, initializer, events)

        glutInitWindowSize(self.width, self.height)

        # the window starts at the upper left corner of the screen
        # TODO: hook up alignment with this!
        glutInitWindowPosition(0, 0)

        self.window = glutCreateWindow(
            self.label)  # check if window ID is actually needed for something

        # glutFullScreen() # TODO: hook up this with conf!

        glutReshapeFunc(self.resize)
        glutVisibilityFunc(self.visibility)

        self.event_manager = EventManager(self.root_layout, self.hotkeys,
                                          self.events)

        setup_2D_projection(self.width, self.height)
Esempio n. 2
0
    def __init__(self,
                 organization,
                 base_url,
                 start_date,
                 end_date,
                 date_format,
                 request_date_format=None):
        self.organization = organization
        # date_format is the string that specifies the date style of the target website
        if request_date_format == None:
            request_date_format = date_format

        self.date_format = date_format
        self.time_utils = TimeUtils(date_format)
        self.base_url = base_url
        self.identifier = re.sub(r'\W', '', base_url)
        self.event_manager = EventManager()

        request_format_utils = TimeUtils('%m-%d-%Y')
        # When this is running for multiple days, validating if the date is in the past causes issues
        self.start_date = request_format_utils.convert_date_format(
            start_date, request_date_format, validate_past=False)
        self.end_date = request_format_utils.convert_date_format(
            end_date, request_date_format, validate_past=False)
        self.start_timestamp = request_format_utils.min_timestamp_for_day(
            start_date)
        self.end_timestamp = request_format_utils.max_timestamp_for_day(
            end_date)
Esempio n. 3
0
class Context(object):
    __metaclass__ = abc.ABCMeta
 
    state = 1 #class attribute to be used as the singleton's attribute
    eventManager=EventManager()
    camera=None
    state=None
    idle=stat.Idle()
    active=stat.Active()
    processor=process.InputProcessor()
    usersConteiner=cont.UsersConteiner()

    @abc.abstractmethod
    def __init__(self):
        pass #this prevents instantiation!
 
    @classmethod
    def printSelf(cls):
        print(cls.state) #prints out the value of the singleton's state
    @classmethod
    def otro(cls):
        cls.state+=1
    @classmethod
    def set_camera(cls, camera:camUtil.CameraInterface):
        cls.camera=camera
        cls.state=cls.idle
        cls.state.freeControl()
    
    @classmethod
    def stop(cls):
        cls.idle.suspend()
        cls.active.suspend()
Esempio n. 4
0
    def __init__(self, journalfile=None):
        self.eventManager = EventManager()
        self.journaller = Journaler(journalfile)
        self.sessions = {}

        # We load all sessions from the journal and add to our list
        for session in self.journaller.sessions():
            self.sessions[session.key] = session
Esempio n. 5
0
def main():
    ev_manager = EventManager()

    main_frame = MainFrame(ev_manager)
    spinner = CPUSpinnerController(ev_manager)
    keybd = KeyboardController(ev_manager)
    ai = Agent(ev_manager)
    app = App(ev_manager)

    spinner.run()
Esempio n. 6
0
File: game.py Progetto: zrma/puyopy
    def __init__(self):
        """

        :rtype:
        """
        Timer.init()
        Renderer.init()
        self.__event = EventManager()
        self.__game_objects = {}
        self.__field = LogicField()

        self.__current_pu_yo: PuYo = None
Esempio n. 7
0
    def __init__(self) -> None:
        self.event_manager = EventManager()
        super(Game, self).__init__(self.event_manager)
        self.inialize_pygame()

        self.clock: pygame.Clock = Clock()
        self.screen: pygame.Surface = pygame.display.set_mode(
            constants.SCREEN_SIZE)

        self.keyboard = Keyboard(self.event_manager)

        self.state = GameState.LOAD_SCREEN
        self.controller = LaunchController(self.event_manager, self.screen)
Esempio n. 8
0
def main():
    # Initialize pygame
    pygame.init()

    # Initialize event manager
    event_manager = EventManager()

    # Initialize display, input, and game data
    display_manager = Display(event_manager)
    input_manager = InputController(event_manager)
    game_model = GameModel(event_manager)
    clock = ClockController(event_manager)

    # Run game
    clock.run()
Esempio n. 9
0
    def __init__( self ):
        # Set the app to running
        self.running = True

        # Create the event manager
        self.events = EventManager( )
        self.events.registerListener( AppListener() )

        # Set the default app mode
        self.mode = 'menu'

        self.updateableObjects = {
            'game': [],
            'menu': []
        }
Esempio n. 10
0
    def __init__(self,
                 structure,
                 keys,
                 events=None,
                 constraints=None,
                 ui_initializer=None,
                 element_height=20):
        super(Application, self).__init__(structure, keys, events, constraints,
                                          ui_initializer, element_height)

        self.event_manager = EventManager(self.root_layout, keys, events)

        for event in ('mouse_x', 'mouse_y'):
            self.event_manager.key_events[BLENDER_KEYS[event]] = Event()
            self.event_manager.key_events[
                BLENDER_KEYS[event]].press = check_state_events

        self.window_manager = WindowManager()
        self.root_layout.common.window_manager = self.window_manager
        self.root_layout.common.invert_y = True

        global app
        app = self
Esempio n. 11
0
sys.path.insert(0, '../google-calendar-api')
from main import getService, createEvent, deleteEvent, editEvent

# instantiate Slack client
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
# starterbot's user ID in Slack: value is assigned after the bot starts up
starterbot_id = None
#AUTH_TOKEN = "xoxp-405504331811-405638712146-405402172724-6911eeb1abd04a212f2e0ab6661889f5"
AUTH_TOKEN = "xoxb-405504331811-404929513808-vyzBLNNvgwh0TOqVyYggUxZl"

# constants
RTM_READ_DELAY = 1  # 1 second delay between reading from RTM
EXAMPLE_COMMAND = "do"
MENTION_REGEX = "^<@(|[WU].+?)>(.*)"

em = EventManager(slack_client, AUTH_TOKEN)

# google calendar
google_service = getService('token.json', 'credentials.json')


def parse_bot_commands(slack_events):
    """
        Parses a list of events coming from the Slack RTM API to find bot commands.
        If a bot command is found, this function returns a tuple of command and channel.
        If its not found, then this function returns None, None.
    """
    for event in slack_events:
        if event["type"] == "message" and not "subtype" in event:
            user_id, message = parse_direct_mention(event["text"])
            sender = event["user"]
Esempio n. 12
0
 def __init__(self):
     super().__init__()
     self.event_manager = EventManager()