peng3d/keybind.py
def add(self,keybind,kbname,handler,mod=True):
        """
        Adds a keybind to the internal registry.
        
        Keybind names should be of the format ``namespace:category.subcategory.name``\ e.g. ``peng3d:actor.player.controls.forward`` for the forward key combo for the player actor.
        
        :param str keybind: Keybind string, as described above
        :param str kbname: Name of the keybind, may be used to later change the keybinding without re-registering
        :param function handler: Function or any other callable called with the positional arguments ``(symbol,modifiers,release)`` if the keybind is pressed or released
        :param int mod: If the keybind should respect modifiers
        """
        keybind = keybind.lower()
        if mod:
            if keybind not in self.keybinds:
                self.keybinds[keybind]=[]
            self.keybinds[keybind].append(kbname)
        else:
            if keybind not in self.keybinds_nm:
                self.keybinds_nm[keybind]=[]
            self.keybinds_nm[keybind].append(kbname)
        self.kbname[kbname]=handler
        self.peng.sendEvent("peng3d:keybind.add",{"peng":self.peng,"keybind":keybind,"kbname":kbname,"handler":handler,"mod":mod})
def add(self,keybind,kbname,handler,mod=True):
        """
        Adds a keybind to the internal registry.
        
        Keybind names should be of the format ``namespace:category.subcategory.name``\ e.g. ``peng3d:actor.player.controls.forward`` for the forward key combo for the player actor.
        
        :param str keybind: Keybind string, as described above
        :param str kbname: Name of the keybind, may be used to later change the keybinding without re-registering
        :param function handler: Function or any other callable called with the positional arguments ``(symbol,modifiers,release)`` if the keybind is pressed or released
        :param int mod: If the keybind should respect modifiers
        """
        keybind = keybind.lower()
        if mod:
            if keybind not in self.keybinds:
                self.keybinds[keybind]=[]
            self.keybinds[keybind].append(kbname)
        else:
            if keybind not in self.keybinds_nm:
                self.keybinds_nm[keybind]=[]
            self.keybinds_nm[keybind].append(kbname)
        self.kbname[kbname]=handler
        self.peng.sendEvent("peng3d:keybind.add",{"peng":self.peng,"keybind":keybind,"kbname":kbname,"handler":handler,"mod":mod})
Adds a keybind to the internal registry.
        
        Keybind names should be of the format ``namespace:category.subcategory.name``\ e.g. ``peng3d:actor.player.controls.forward`` for the forward key combo for the player actor.
        
        :param str keybind: Keybind string, as described above
        :param str kbname: Name of the keybind, may be used to later change the keybinding without re-registering
        :param function handler: Function or any other callable called with the positional arguments ``(symbol,modifiers,release)`` if the keybind is pressed or released
        :param int mod: If the keybind should respect modifiers