peng3d/keybind.py
def handle_combo(self,combo,symbol,modifiers,release=False,mod=True):
        """
        Handles a key combination and dispatches associated events.
        
        First, all keybind handlers registered via :py:meth:`add` will be handled,
        then the pyglet event :peng3d:pgevent:`on_key_combo` with params ``(combo,symbol,modifiers,release,mod)`` is sent to the :py:class:`Peng()` instance.
        
        Also sends the events :peng3d:event:`peng3d:keybind.combo`\, :peng3d:event:`peng3d:keybind.combo.press` and :peng3d:event`peng3d:keybind.combo.release`\ .
        
        :params str combo: Key combination pressed
        :params int symbol: Key pressed, passed from the same argument within pyglet
        :params int modifiers: Modifiers held while the key was pressed
        :params bool release: If the combo was released
        :params bool mod: If the combo was sent without mods
        """
        if self.peng.cfg["controls.keybinds.debug"]:
            print("combo: nm=%s %s"%(mod,combo))
        if mod:
            for kbname in self.keybinds.get(combo,[]):
                self.kbname[kbname](symbol,modifiers,release)
        else:
            for kbname in self.keybinds_nm.get(combo,[]):
                self.kbname[kbname](symbol,modifiers,release)
        self.peng.sendPygletEvent("on_key_combo",(combo,symbol,modifiers,release,mod))
        self.peng.sendEvent("peng3d:keybind.combo",{"peng":self.peng,"combo":combo,"symbol":symbol,"modifiers":modifiers,"release":release,"mod":mod})
        if release:
            self.peng.sendEvent("peng3d:keybind.combo.release",{"peng":self.peng,"combo":combo,"symbol":symbol,"modifiers":modifiers,"release":release,"mod":mod})
        else:
            self.peng.sendEvent("peng3d:keybind.combo.press",{"peng":self.peng,"combo":combo,"symbol":symbol,"modifiers":modifiers,"release":release,"mod":mod})
def handle_combo(self,combo,symbol,modifiers,release=False,mod=True):
        """
        Handles a key combination and dispatches associated events.
        
        First, all keybind handlers registered via :py:meth:`add` will be handled,
        then the pyglet event :peng3d:pgevent:`on_key_combo` with params ``(combo,symbol,modifiers,release,mod)`` is sent to the :py:class:`Peng()` instance.
        
        Also sends the events :peng3d:event:`peng3d:keybind.combo`\, :peng3d:event:`peng3d:keybind.combo.press` and :peng3d:event`peng3d:keybind.combo.release`\ .
        
        :params str combo: Key combination pressed
        :params int symbol: Key pressed, passed from the same argument within pyglet
        :params int modifiers: Modifiers held while the key was pressed
        :params bool release: If the combo was released
        :params bool mod: If the combo was sent without mods
        """
        if self.peng.cfg["controls.keybinds.debug"]:
            print("combo: nm=%s %s"%(mod,combo))
        if mod:
            for kbname in self.keybinds.get(combo,[]):
                self.kbname[kbname](symbol,modifiers,release)
        else:
            for kbname in self.keybinds_nm.get(combo,[]):
                self.kbname[kbname](symbol,modifiers,release)
        self.peng.sendPygletEvent("on_key_combo",(combo,symbol,modifiers,release,mod))
        self.peng.sendEvent("peng3d:keybind.combo",{"peng":self.peng,"combo":combo,"symbol":symbol,"modifiers":modifiers,"release":release,"mod":mod})
        if release:
            self.peng.sendEvent("peng3d:keybind.combo.release",{"peng":self.peng,"combo":combo,"symbol":symbol,"modifiers":modifiers,"release":release,"mod":mod})
        else:
            self.peng.sendEvent("peng3d:keybind.combo.press",{"peng":self.peng,"combo":combo,"symbol":symbol,"modifiers":modifiers,"release":release,"mod":mod})
def handle_combo ( self , combo , symbol , modifiers , release = False , mod = True ) : if self . peng . cfg [ "controls.keybinds.debug" ] : print ( "combo: nm=%s %s" % ( mod , combo ) ) if mod : for kbname in self . keybinds . get ( combo , [ ] ) : self . kbname [ kbname ] ( symbol , modifiers , release ) else : for kbname in self . keybinds_nm . get ( combo , [ ] ) : self . kbname [ kbname ] ( symbol , modifiers , release ) self . peng . sendPygletEvent ( "on_key_combo" , ( combo , symbol , modifiers , release , mod ) ) self . peng . sendEvent ( "peng3d:keybind.combo" , { "peng" : self . peng , "combo" : combo , "symbol" : symbol , "modifiers" : modifiers , "release" : release , "mod" : mod } ) if release : self . peng . sendEvent ( "peng3d:keybind.combo.release" , { "peng" : self . peng , "combo" : combo , "symbol" : symbol , "modifiers" : modifiers , "release" : release , "mod" : mod } ) else : self . peng . sendEvent ( "peng3d:keybind.combo.press" , { "peng" : self . peng , "combo" : combo , "symbol" : symbol , "modifiers" : modifiers , "release" : release , "mod" : mod } )
Handles a key combination and dispatches associated events.
        
        First, all keybind handlers registered via :py:meth:`add` will be handled,
        then the pyglet event :peng3d:pgevent:`on_key_combo` with params ``(combo,symbol,modifiers,release,mod)`` is sent to the :py:class:`Peng()` instance.
        
        Also sends the events :peng3d:event:`peng3d:keybind.combo`\, :peng3d:event:`peng3d:keybind.combo.press` and :peng3d:event`peng3d:keybind.combo.release`\ .
        
        :params str combo: Key combination pressed
        :params int symbol: Key pressed, passed from the same argument within pyglet
        :params int modifiers: Modifiers held while the key was pressed
        :params bool release: If the combo was released
        :params bool mod: If the combo was sent without mods
Handles a key combination and dispatches associated events . First all keybind handlers registered via : py : meth : add will be handled then the pyglet event : peng3d : pgevent : on_key_combo with params ( combo symbol modifiers release mod ) is sent to the : py : class : Peng () instance . Also sends the events : peng3d : event : peng3d : keybind . combo \ : peng3d : event : peng3d : keybind . combo . press and : peng3d : event peng3d : keybind . combo . release \ . : params str combo : Key combination pressed : params int symbol : Key pressed passed from the same argument within pyglet : params int modifiers : Modifiers held while the key was pressed : params bool release : If the combo was released : params bool mod : If the combo was sent without mods