Example #1
0
class Device:
    def __init__(self):
        self.model = loader.loadModel('Ipod.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/Cubierta")
        self.base.reparentTo(render)
        #self.base.setHpr(0, 0, 0)
        #base.camera.setPos(0, -5, 0)

        self.events = EventDispatcher(self, "Ipod Shuffle")
        alight = AmbientLight('alight')
        alight.setColor(VBase4(1, 1, 1, 1))
        alnp = render.attachNewNode(alight)
        render.setLight(alnp)
        self.apps = {}
        self.apps["Reproductor de Audio"] = MusicApp(self)
        self.launch("Reproductor de Audio")

    def run(self):
        print "I'm in a race and I'm winning"
        run()

    def get_model(self):
        return self.model

    def get_base(self):
        return self.base

    def launch(self, app_name):
        if app_name in self.apps:
            self.events.clear()
            self.apps[app_name].activate(self.events)
        else:
            print "unknown command: " + app_name
Example #2
0
class Device:
    def __init__(self):
        self.model = loader.loadModel('Ipod.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/Cubierta")
        self.base.reparentTo(render)
        #self.base.setHpr(0, 0, 0)
        #base.camera.setPos(0, -5, 0)

        self.events = EventDispatcher(self, "Ipod Shuffle")
        alight = AmbientLight('alight')
        alight.setColor(VBase4(1, 1, 1, 1))
        alnp = render.attachNewNode(alight)
        render.setLight(alnp)
        self.apps = {}
        self.apps["Reproductor de Audio"] = MusicApp(self)
        self.launch("Reproductor de Audio")

    def run(self):
        print "I'm in a race and I'm winning"
        run()

    def get_model(self):
        return self.model

    def get_base(self):
        return self.base

    def launch(self, app_name):
        if app_name in self.apps:
            self.events.clear()
            self.apps[app_name].activate(self.events) 
        else:
            print "unknown command: " + app_name
Example #3
0
    def __init__(self):
        self.model = loader.loadModel('finepixr.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/Base_cam")
        self.base.reparentTo(render)
        self.base.setHpr(0, -90, 0)

        base.disableMouse()
        base.camera.setPos(0, -20, 0)        
        mat = Mat4(camera.getMat())
        mat.invertInPlace()
        base.mouseInterfaceNode.setMat(mat)
        base.enableMouse()

        self.screen = self.base.find("**/pantalla")
        self.screen.reparentTo(self.base)
        
        self.apps = {}
        self.events = EventDispatcher(self, "Fujifilm Finepix 470")
        self.apps["Album Fotografico"] = PhotoApp(self)
        self.apps["Fotografia"]= CameraApp(self)
        self.screen.setTexture(loader.loadTexture(OptionManager.get_texture_filename()), 1)

        self.launch("Album Fotografico")
Example #4
0
    def __init__(self, raw_in, outstream):
        """
        raw_data is the raw content of a midi file as a string.
        """

        # internal values, don't mess with 'em directly
        self.raw_in = raw_in
        self.dispatch = EventDispatcher(outstream)

        # Used to keep track of stuff
        self._running_status = None
Example #5
0
class Device:
    def __init__(self):
        self.model = loader.loadModel('finepixr.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/Base_cam")
        self.base.reparentTo(render)
        self.base.setHpr(0, -90, 0)

        base.disableMouse()
        base.camera.setPos(0, -20, 0)        
        mat = Mat4(camera.getMat())
        mat.invertInPlace()
        base.mouseInterfaceNode.setMat(mat)
        base.enableMouse()

        self.screen = self.base.find("**/pantalla")
        self.screen.reparentTo(self.base)
        
        self.apps = {}
        self.events = EventDispatcher(self, "Fujifilm Finepix 470")
        self.apps["Album Fotografico"] = PhotoApp(self)
        self.apps["Fotografia"]= CameraApp(self)
        self.screen.setTexture(loader.loadTexture(OptionManager.get_texture_filename()), 1)

        self.launch("Album Fotografico")

    def run(self):
        print "I'm in a race and I'm winning"
        print datetime.datetime.now()
        run()

    def get_model(self):
        return self.model

    def get_base(self):
        return self.base

    def get_screen(self):
        return self.screen

    def repaint(self):
        self.screen.getTexture().reload()

    def launch(self, app_name):
        if app_name in self.apps:
            self.events.clear()
            self.apps[app_name].activate(self.events)
            self.repaint()
        else:
            print "unknown command: " + app_name
Example #6
0
    def __init__(self):
        self.base = ShowBase()
        self.model = self.base.loader.loadModel('device.egg')
        self.model.reparentTo(self.base.render)
        
        
        self.base.disableMouse()
        self.base.camera.setPos(0, -10, 0)
        self.model.setHpr(0,90,0)

        mat = Mat4(self.base.camera.getMat())
        mat.invertInPlace()
        self.base.mouseInterfaceNode.setMat(mat)
        self.base.enableMouse()

        self.screen = self.model.find("**/pantalla")
        
        self.list_app = ListApp(self)
        self.music_app = MusicApp(self)
        self.dial_app = DialApp(self)
        
        self.apps = {}
        self.events = EventDispatcher(self, "Sony Ericsson W200")
        
        self.apps["init"] = InitApp(self)
        self.apps["Dial"] = self.display_dial_screen
        self.apps["menu"] = MainMenu(self)
        self.apps["Reproductor"] = self.play
        
        self.apps["Reproductor de Audio"] = self.display_list
        self.apps["Camara"] = CameraApp(self)
        self.apps["Album Fotografico"] = PhotoApp(self)
        self.apps["Llamadas"] = self.display_list
        self.apps["Contactos"] = self.display_list
        self.apps["Mensajes"] = self.display_list
        self.apps["Juegos"] = self.display_list
        self.apps["Utileria"] = self.display_list
        
        self.apps["Reproducir Todas"] = self.play
        self.apps["Lista de Albums"] = self.list_albums
        self.apps["Lista de Artistas"] = self.list_artists
        
        self.apps["Lista de Contactos"] = self.list_contacts
        self.apps["Dial Contact"] = self.dial_contact
        
        self.apps["Llamadas Perdidas"] = self.list_lost_calls
        self.apps["Llamadas Contestadas"] = self.list_answered_calls
        self.apps["Llamadas Marcadas"] = self.list_done_calls
        
        self.launch("init")
Example #7
0
class Device:
    def __init__(self):
        self.model = loader.loadModel('device.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/base")
        
        self.base.setHpr(0, 90, 0)
        
        self.screen = self.base.find("**/pantalla")
        print self.screen.getPos()
        print self.screen.getHpr()        
        self.apps = {}
        self.events = EventDispatcher(self, "Sony Ericsson W200")
        
        self.apps["menu"] = MainMenu(self)
        self.apps["Album Fotografico"] = PhotoApp(self)
        #self.apps["Camara"] = CameraApp(self)
        self.apps["Reproductor de Audio"] = MusicApp(self)

        self.launch("menu")
        
    def run(self):
        #print "I'm in a race and I'm winning"
        run()

    def get_model(self):
        return self.model

    def get_base(self):
        return self.base
        
    def get_screen(self):
        return self.screen
        
    def repaint(self):
        self.screen.getTexture().reload()

    def launch(self, app_name):
        if app_name in self.apps:
            self.events.clear()
            self.screen.setTexture(loader.loadTexture(
                                   OptionManager.get_texture_filename()), 1)
            self.apps[app_name].activate(self.events)
            self.repaint()
        else:
            print "unknown command: " + app_name
Example #8
0
class Device:
    def __init__(self):
        self.model = loader.loadModel('device.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/base")

        self.base.setHpr(0, 90, 0)

        self.screen = self.base.find("**/pantalla")
        print self.screen.getPos()
        print self.screen.getHpr()
        self.apps = {}
        self.events = EventDispatcher(self, "Sony Ericsson W200")

        self.apps["menu"] = MainMenu(self)
        self.apps["Album Fotografico"] = PhotoApp(self)
        #self.apps["Camara"] = CameraApp(self)
        self.apps["Reproductor de Audio"] = MusicApp(self)

        self.launch("menu")

    def run(self):
        #print "I'm in a race and I'm winning"
        run()

    def get_model(self):
        return self.model

    def get_base(self):
        return self.base

    def get_screen(self):
        return self.screen

    def repaint(self):
        self.screen.getTexture().reload()

    def launch(self, app_name):
        if app_name in self.apps:
            self.events.clear()
            self.screen.setTexture(
                loader.loadTexture(OptionManager.get_texture_filename()), 1)
            self.apps[app_name].activate(self.events)
            self.repaint()
        else:
            print "unknown command: " + app_name
Example #9
0
    def __init__(self):
        self.model = loader.loadModel('Ipod.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/Cubierta")
        self.base.reparentTo(render)
        #self.base.setHpr(0, 0, 0)
        #base.camera.setPos(0, -5, 0)

        self.events = EventDispatcher(self, "Ipod Shuffle")
        alight = AmbientLight('alight')
        alight.setColor(VBase4(1, 1, 1, 1))
        alnp = render.attachNewNode(alight)
        render.setLight(alnp)
        self.apps = {}
        self.apps["Reproductor de Audio"] = MusicApp(self)
        self.launch("Reproductor de Audio")
Example #10
0
class IRCBot:
    def __init__(self, configname):
        self.config = ConfigLoader(configname)
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.irc = IRCInterface(self.socket)
        self.plugins = {}
        self.dispatcher = EventDispatcher(self.irc)

    def rise(self):
        self.loadAllPlugins()
        self.connect()

    def loadPlugin(self, pluginName):
        plugin = importlib.import_module("plugins." + pluginName)

        for name in dir(plugin):
            local = getattr(plugin, name)
            if hasattr(local, "_ircEvent"):
                self.dispatcher.hookEvent(getattr(local, "_ircEvent"), local)

    def loadAllPlugins(self):
        for m in self.config.get("plugins"):
            self.loadPlugin(m)

    def connect(self):
        self.socket.connect( (self.config.get("server"), int(self.config.get("port"))) )
        self.handshake()
        self.loop()

    def handshake(self):
        self.irc.nick(self.config.get("nick"))
        self.irc.user(self.config.get("nick"), "...", "...", "...")
        for channel in self.config.get("channels"):
            self.irc.join(channel)

    def loop(self):
        buffer = ""
        while True:
            data = self.irc.read()

            for cmd in data:
                if cmd["command"] == "PING":
                    self.irc.pong(cmd["params"][0])

                self.dispatcher.dispatch(cmd)
Example #11
0
    def __init__(self):
        self.model = loader.loadModel('device.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/base")

        self.base.setHpr(0, 90, 0)

        self.screen = self.base.find("**/pantalla")
        print self.screen.getPos()
        print self.screen.getHpr()
        self.apps = {}
        self.events = EventDispatcher(self, "Sony Ericsson W200")

        self.apps["menu"] = MainMenu(self)
        self.apps["Album Fotografico"] = PhotoApp(self)
        #self.apps["Camara"] = CameraApp(self)
        self.apps["Reproductor de Audio"] = MusicApp(self)

        self.launch("menu")
Example #12
0
    def __init__(self, raw_in, outstream):
        """
        raw_data is the raw content of a midi file as a string.
        """

        # internal values, don't mess with 'em directly
        self.raw_in = raw_in
        self.dispatch = EventDispatcher(outstream)

        # Used to keep track of stuff
        self._running_status = None
Example #13
0
    def __init__(self):
        self.model = loader.loadModel('Ipod.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/Cubierta")
        self.base.reparentTo(render)
        #self.base.setHpr(0, 0, 0)
        #base.camera.setPos(0, -5, 0)

        self.events = EventDispatcher(self, "Ipod Shuffle")
        alight = AmbientLight('alight')
        alight.setColor(VBase4(1, 1, 1, 1))
        alnp = render.attachNewNode(alight)
        render.setLight(alnp)
        self.apps = {}
        self.apps["Reproductor de Audio"] = MusicApp(self)
        self.launch("Reproductor de Audio")
Example #14
0
    def __init__(self):
        self.model = loader.loadModel('device.egg')
        self.model.reparentTo(render)

        self.base = self.model.find("**/base")
        
        self.base.setHpr(0, 90, 0)
        
        self.screen = self.base.find("**/pantalla")
        print self.screen.getPos()
        print self.screen.getHpr()        
        self.apps = {}
        self.events = EventDispatcher(self, "Sony Ericsson W200")
        
        self.apps["menu"] = MainMenu(self)
        self.apps["Album Fotografico"] = PhotoApp(self)
        #self.apps["Camara"] = CameraApp(self)
        self.apps["Reproductor de Audio"] = MusicApp(self)

        self.launch("menu")
Example #15
0
class MidiFileParser:

    """
    
    The MidiFileParser is the lowest level parser that see the data as 
    midi data. It generates events that gets triggered on the outstream.
    
    """

    def __init__(self, raw_in, outstream):

        """
        raw_data is the raw content of a midi file as a string.
        """

        # internal values, don't mess with 'em directly
        self.raw_in = raw_in
        self.dispatch = EventDispatcher(outstream)

        # Used to keep track of stuff
        self._running_status = None




    def parseMThdChunk(self):
        
        "Parses the header chunk"
        
        raw_in = self.raw_in

        header_chunk_type = raw_in.nextSlice(4)
        header_chunk_zise = raw_in.readBew(4)

        # check if it is a proper midi file
        if header_chunk_type != 'MThd':
            raise TypeError, "It is not a valid midi file!"

        # Header values are at fixed locations, so no reason to be clever
        self.format = raw_in.readBew(2)
        self.nTracks = raw_in.readBew(2)
        self.division = raw_in.readBew(2)
        
        # Theoretically a header larger than 6 bytes can exist
        # but no one has seen one in the wild
        # But correctly ignore unknown data if it is though
        if header_chunk_zise > 6:
            raw_in.moveCursor(header_chunk_zise-6)

        # call the header event handler on the stream
        self.dispatch.header(self.format, self.nTracks, self.division)



    def parseMTrkChunk(self):
        
        "Parses a track chunk. This is the most important part of the parser."
        
        # set time to 0 at start of a track
        self.dispatch.reset_time()
        
        dispatch = self.dispatch
        raw_in = self.raw_in
        
        # Trigger event at the start of a track
        dispatch.start_of_track(self._current_track)
        # position cursor after track header
        raw_in.moveCursor(4)
        # unsigned long is 4 bytes
        tracklength = raw_in.readBew(4)
        track_endposition = raw_in.getCursor() + tracklength # absolute position!

        while raw_in.getCursor() < track_endposition:
        
            # find relative time of the event
            time = raw_in.readVarLen()
            dispatch.update_time(time)
            
            # be aware of running status!!!!
            peak_ahead = raw_in.readBew(move_cursor=0)
            if (peak_ahead & 0x80): 
                # the status byte has the high bit set, so it
                # was not running data but proper status byte
                status = self._running_status = raw_in.readBew()
            else:
                # use that darn running status
                status = self._running_status
                # could it be illegal data ?? Do we need to test for that?
                # I need more example midi files to be shure.
                
                # Also, while I am almost certain that no realtime 
                # messages will pop up in a midi file, I might need to 
                # change my mind later.

            # we need to look at nibbles here
            hi_nible, lo_nible = status & 0xF0, status & 0x0F
            
            # match up with events

            # Is it a meta_event ??
            # these only exists in midi files, not in transmitted midi data
            # In transmitted data META_EVENT (0xFF) is a system reset
            if status == META_EVENT:
                meta_type = raw_in.readBew()
                meta_length = raw_in.readVarLen()
                meta_data = raw_in.nextSlice(meta_length)
                dispatch.meta_event(meta_type, meta_data)


            # Is it a sysex_event ??
            elif status == SYSTEM_EXCLUSIVE:
                # ignore sysex events
                sysex_length = raw_in.readVarLen()
                # don't read sysex terminator
                sysex_data = raw_in.nextSlice(sysex_length-1)
                # only read last data byte if it is a sysex terminator
                # It should allways be there, but better safe than sorry
                if raw_in.readBew(move_cursor=0) == END_OFF_EXCLUSIVE:
                    eo_sysex = raw_in.readBew()
                dispatch.sysex_event(sysex_data)
                # the sysex code has not been properly tested, and might be fishy!


            # is it a system common event?
            elif hi_nible == 0xF0: # Hi bits are set then
                data_sizes = {
                    MTC:1,
                    SONG_POSITION_POINTER:2,
                    SONG_SELECT:1,
                }
                data_size = data_sizes.get(hi_nible, 0)
                common_data = raw_in.nextSlice(data_size)
                common_type = lo_nible
                dispatch.system_common(common_type, common_data)
            

            # Oh! Then it must be a midi event (channel voice message)
            else:
                data_sizes = {
                    PATCH_CHANGE:1,
                    CHANNEL_PRESSURE:1,
                    NOTE_OFF:2,
                    NOTE_ON:2,
                    AFTERTOUCH:2,
                    CONTINUOUS_CONTROLLER:2,
                    PITCH_BEND:2,
                }
                data_size = data_sizes.get(hi_nible, 0)
                channel_data = raw_in.nextSlice(data_size)
                event_type, channel = hi_nible, lo_nible
                dispatch.channel_messages(event_type, channel, channel_data)


    def parseMTrkChunks(self):
        "Parses all track chunks."
        for t in range(self.nTracks):
            self._current_track = t
            self.parseMTrkChunk() # this is where it's at!
        self.dispatch.eof()
Example #16
0
 def __init__(self, configname):
     self.config = ConfigLoader(configname)
     self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.irc = IRCInterface(self.socket)
     self.plugins = {}
     self.dispatcher = EventDispatcher(self.irc)
Example #17
0
 def __init__(self):
     self.event_dispatcher = EventDispatcher()
     self.initializePlugins()
Example #18
0
    def __init__(self):

        self.devconf = ConfigLoader('./res/models/sony_ericsson_w200.json')

        #with open('./res/models/sony_ericsson_w200.json') as f:
        #    self.devconf = json.load(f)
        
        self.base = ShowBase()
        self.loader = self.base.loader
        self.model = self.loader.loadModel(self.devconf.model_path)
        self.model.reparentTo(self.base.render)
        
        
        self.base.disableMouse()
        self.base.camera.setPos(
            self.devconf.initial_position['x'],
            self.devconf.initial_position['y'],
            self.devconf.initial_position['z'])

        self.model.setHpr(
            self.devconf.model_transformation['x'],
            self.devconf.model_transformation['y'],
            self.devconf.model_transformation['z'])

        mat = Mat4(self.base.camera.getMat())
        mat.invertInPlace()
        self.base.mouseInterfaceNode.setMat(mat)
        self.base.enableMouse()

        self.screen = self.model.find(self.devconf.model_texture_path)
        
        self.list_app = ListApp(self, self.devconf)
        #self.music_app = MusicApp(self)
        self.dial_app = DialApp(self, self.devconf)
        
        self.apps = {}
        self.events = EventDispatcher(self, self.devconf.device_name)
        
        self.apps["init"] = InitApp(self, self.devconf)
        
        self.apps["Dial"] = self.display_dial_screen
        self.apps["menu"] = MainMenu(self, self.devconf)
        #self.apps["Reproductor"] = self.play
        
        #self.apps["Reproductor de Audio"] = self.display_list
        #self.apps["Camara"] = CameraApp(self)
        #self.apps["Album Fotografico"] = PhotoApp(self)
        self.apps["Llamadas"] = self.display_list
        self.apps["Contactos"] = self.display_list
        self.apps["Mensajes"] = self.display_list
        self.apps["Juegos"] = self.display_list
        self.apps["Utileria"] = self.display_list
        
        #self.apps["Reproducir Todas"] = self.play
        #self.apps["Lista de Albums"] = self.list_albums
        #self.apps["Lista de Artistas"] = self.list_artists
        
        #self.apps["Lista de Contactos"] = self.list_contacts
        #self.apps["Dial Contact"] = self.dial_contact
        
        #self.apps["Llamadas Perdidas"] = self.list_lost_calls
        #self.apps["Llamadas Contestadas"] = self.list_answered_calls
        #self.apps["Llamadas Marcadas"] = self.list_done_calls
        
        self.launch("init")
Example #19
0
class Device():
    def __init__(self):
        self.base = ShowBase()
        self.model = self.base.loader.loadModel('device.egg')
        self.model.reparentTo(self.base.render)
        
        
        self.base.disableMouse()
        self.base.camera.setPos(0, -10, 0)
        self.model.setHpr(0,90,0)

        mat = Mat4(self.base.camera.getMat())
        mat.invertInPlace()
        self.base.mouseInterfaceNode.setMat(mat)
        self.base.enableMouse()

        self.screen = self.model.find("**/pantalla")
        
        self.list_app = ListApp(self)
        self.music_app = MusicApp(self)
        self.dial_app = DialApp(self)
        
        self.apps = {}
        self.events = EventDispatcher(self, "Sony Ericsson W200")
        
        self.apps["init"] = InitApp(self)
        self.apps["Dial"] = self.display_dial_screen
        self.apps["menu"] = MainMenu(self)
        self.apps["Reproductor"] = self.play
        
        self.apps["Reproductor de Audio"] = self.display_list
        self.apps["Camara"] = CameraApp(self)
        self.apps["Album Fotografico"] = PhotoApp(self)
        self.apps["Llamadas"] = self.display_list
        self.apps["Contactos"] = self.display_list
        self.apps["Mensajes"] = self.display_list
        self.apps["Juegos"] = self.display_list
        self.apps["Utileria"] = self.display_list
        
        self.apps["Reproducir Todas"] = self.play
        self.apps["Lista de Albums"] = self.list_albums
        self.apps["Lista de Artistas"] = self.list_artists
        
        self.apps["Lista de Contactos"] = self.list_contacts
        self.apps["Dial Contact"] = self.dial_contact
        
        self.apps["Llamadas Perdidas"] = self.list_lost_calls
        self.apps["Llamadas Contestadas"] = self.list_answered_calls
        self.apps["Llamadas Marcadas"] = self.list_done_calls
        
        self.launch("init")
    
    def list_lost_calls(self, arg = None):
        manager = GestorRegistros()
        self.list_app.set_options(manager.get_logs_by_state("PERDIDA"))
        return self.list_app
        
    def list_answered_calls(self, arg = None):
        manager = GestorRegistros()
        self.list_app.set_options(manager.get_logs_by_state("RECIBIDA"))
        return self.list_app
        
    def list_done_calls(self, arg = None):
        manager = GestorRegistros()
        self.list_app.set_options(manager.get_logs_by_state("REALIZADA"))
        return self.list_app
    
    def dial_contact(self, arg = None):
        cntct = self.list_app.get_selected_option()[2]
        self.dial_app.write_number(cntct[1])
        return self.dial_app
    
    def list_contacts(self, arg = None):
        manager = GestorContactos()
        self.list_app.set_options(manager.get_contactos())
        return self.list_app
    
    def display_dial_screen(self, arg = None):
        self.dial_app.write_number(self.apps["init"].get_number())
        return self.dial_app
    
    
    def display_list(self, option):
        temp_list = OptionManager.get_option_subtree(option)
        self.list_app.set_options(temp_list)
        return self.list_app
        
    def list_albums(self, arg = None):
        manager = GestorMusica()
        temp_list = manager.get_albums()
        self.list_app.set_options(temp_list)
        return self.list_app
        
    def list_artists(self, arg = None):
        manager = GestorMusica()
        temp_list = manager.get_artists()
        self.list_app.set_options(temp_list)
        return self.list_app
        
    def play(self, arg = None):
        args = self.list_app.get_selected_option()
        print "args:" + str(args)
        if args:
            print args
            manager = GestorMusica()
            temp_list = None
            if args[2] == "all":
                temp_list = manager.get_tracks()
            if args[2] == "artist":
                temp_list = manager.get_tracks_by_artist(args[0])
            if args[2] == "album":
                temp_list = manager.get_tracks_by_album(args[0])
            
            if temp_list:
                self.music_app.set_track_list(temp_list)
                print "Music loading succesfull"
                return self.music_app
        return None
        
    def run(self):
        self.base.run()

    def get_model(self):
        return self.model

    def get_base(self):
        return self.base
        
    def get_screen(self):
        return self.screen
        
    def repaint(self):
        self.screen.getTexture().reload()

    def launch(self, app_name):
        if app_name in self.apps:
            self.events.clear()
            self.screen.setTexture(loader.loadTexture(
                                   OptionManager.get_texture_filename()), 1)
            
            if "instancemethod" in str(type(self.apps[app_name])):
                app = self.apps[app_name](app_name)
                if app:
                    app.renderer.set_title(app_name)
                    app.activate(self.events)
            else:
                print "Launching " + app_name
                self.apps[app_name].activate(self.events)
            self.repaint()
        else:
            print "unknown command: " + app_name