parameters: (self, code=0, repeat=1, down=1, queue=0,
                   map_name="", button_name="", amount=0, axis=0)
docstring: Keyword arguments:
          code -- raw button code (default: 0)
          repeat -- this key press should repeat until released (default: 1)
                    Note that queued pressed cannot repeat.
          down -- if this is 1, it implies a press event, 0 implies a release
                  event. (default: 1)
          queue -- a queued key press means that the button event is
                   executed just once after which the next key press is
                   processed. It can be used for macros. Currently there
                   is no support for time delays between queued presses.
                   (default: 0)
          map_name -- a combination of map_name and button_name refers to a
                      mapping in the user's Keymap.xml or Lircmap.xml.
                      map_name can be one of the following:
                      "KB" => standard keyboard map ( <keyboard> section )
                      "XG" => xbox gamepad map ( <gamepad> section )
                      "R1" => xbox remote map ( <remote> section )
                      "R2" => xbox universal remote map ( <universalremote>
                              section )
                      "LI:devicename" => LIRC remote map where 'devicename' is the
                      actual device's name
          button_name -- a button name defined in the map specified in map_name.
                         For example, if map_name is "KB" referring to the
                         <keyboard> section in Keymap.xml then, valid
                         button_names include "printscreen", "minus", "x", etc.
          amount -- unimplemented for now; in the future it will be used for
                    specifying magnitude of analog key press events
docstring_summary: Keyword arguments:
          code -- raw button code (default: 0)
          repeat -- this key press should repeat until released (default: 1)
                    Note that queued pressed cannot repeat.
          down -- if this is 1, it implies a press event, 0 implies a release
                  event. (default: 1)
          queue -- a queued key press means that the button event is
                   executed just once after which the next key press is
                   processed. It can be used for macros. Currently there
                   is no support for time delays between queued presses.
                   (default: 0)
          map_name -- a combination of map_name and button_name refers to a
                      mapping in the user's Keymap.xml or Lircmap.xml.
                      map_name can be one of the following:
                      "KB" => standard keyboard map ( <keyboard> section )
                      "XG" => xbox gamepad map ( <gamepad> section )
                      "R1" => xbox remote map ( <remote> section )
                      "R2" => xbox universal remote map ( <universalremote>
                              section )
                      "LI:devicename" => LIRC remote map where 'devicename' is the
                      actual device's name
          button_name -- a button name defined in the map specified in map_name.
                         For example, if map_name is "KB" referring to the
                         <keyboard> section in Keymap.xml then, valid
                         button_names include "printscreen", "minus", "x", etc.
          amount -- unimplemented for now; in the future it will be used for
                    specifying magnitude of analog key press events
docstring_tokens: Keyword arguments : code -- raw button code ( default : 0 ) repeat -- this key press should repeat until released ( default : 1 ) Note that queued pressed cannot repeat . down -- if this is 1 it implies a press event 0 implies a release event . ( default : 1 ) queue -- a queued key press means that the button event is executed just once after which the next key press is processed . It can be used for macros . Currently there is no support for time delays between queued presses . ( default : 0 ) map_name -- a combination of map_name and button_name refers to a mapping in the user s Keymap . xml or Lircmap . xml . map_name can be one of the following : KB = > standard keyboard map ( <keyboard > section ) XG = > xbox gamepad map ( <gamepad > section ) R1 = > xbox remote map ( <remote > section ) R2 = > xbox universal remote map ( <universalremote > section ) LI : devicename = > LIRC remote map where devicename is the actual device s name button_name -- a button name defined in the map specified in map_name . For example if map_name is KB referring to the <keyboard > section in Keymap . xml then valid button_names include printscreen minus x etc . amount -- unimplemented for now ; in the future it will be used for specifying magnitude of analog key press events
function: def __init__(self, code=0, repeat=1, down=1, queue=0,
                   map_name="", button_name="", amount=0, axis=0):
          """
          Keyword arguments:
          code -- raw button code (default: 0)
          repeat -- this key press should repeat until released (default: 1)
                    Note that queued pressed cannot repeat.
          down -- if this is 1, it implies a press event, 0 implies a release
                  event. (default: 1)
          queue -- a queued key press means that the button event is
                   executed just once after which the next key press is
                   processed. It can be used for macros. Currently there
                   is no support for time delays between queued presses.
                   (default: 0)
          map_name -- a combination of map_name and button_name refers to a
                      mapping in the user's Keymap.xml or Lircmap.xml.
                      map_name can be one of the following:
                      "KB" => standard keyboard map ( <keyboard> section )
                      "XG" => xbox gamepad map ( <gamepad> section )
                      "R1" => xbox remote map ( <remote> section )
                      "R2" => xbox universal remote map ( <universalremote>
                              section )
                      "LI:devicename" => LIRC remote map where 'devicename' is the
                      actual device's name
          button_name -- a button name defined in the map specified in map_name.
                         For example, if map_name is "KB" referring to the
                         <keyboard> section in Keymap.xml then, valid
                         button_names include "printscreen", "minus", "x", etc.
          amount -- unimplemented for now; in the future it will be used for
                    specifying magnitude of analog key press events
          """
          Packet.__init__(self)
          self.flags = 0
          self.packettype = PT_BUTTON
          if type (code ) == str:
              code = ord(code)
  
          # assign code only if we don't have a map and button name
          if not (map_name and button_name):
              self.code = code
          else:
              self.flags |= BT_USE_NAME
              self.code = 0
          if (amount != None):
              self.flags |= BT_USE_AMOUNT
              self.amount = int(amount)
          else:
              self.amount = 0
  
          if down:
              self.flags |= BT_DOWN
          else:
              self.flags |= BT_UP
          if not repeat:
              self.flags |= BT_NO_REPEAT
          if queue:
              self.flags |= BT_QUEUE
          if axis == 1:
              self.flags |= BT_AXISSINGLE
          elif axis == 2:
              self.flags |= BT_AXIS
  
          self.set_payload ( format_uint16(self.code) )
          self.append_payload( format_uint16(self.flags) )
          self.append_payload( format_uint16(self.amount) )
          self.append_payload( format_string (map_name) )
          self.append_payload( format_string (button_name) )
function_tokens: def __init__ ( self , code = 0 , repeat = 1 , down = 1 , queue = 0 , map_name = "" , button_name = "" , amount = 0 , axis = 0 ) : Packet . __init__ ( self ) self . flags = 0 self . packettype = PT_BUTTON if type ( code ) == str : code = ord ( code ) # assign code only if we don't have a map and button name if not ( map_name and button_name ) : self . code = code else : self . flags |= BT_USE_NAME self . code = 0 if ( amount != None ) : self . flags |= BT_USE_AMOUNT self . amount = int ( amount ) else : self . amount = 0 if down : self . flags |= BT_DOWN else : self . flags |= BT_UP if not repeat : self . flags |= BT_NO_REPEAT if queue : self . flags |= BT_QUEUE if axis == 1 : self . flags |= BT_AXISSINGLE elif axis == 2 : self . flags |= BT_AXIS self . set_payload ( format_uint16 ( self . code ) ) self . append_payload ( format_uint16 ( self . flags ) ) self . append_payload ( format_uint16 ( self . amount ) ) self . append_payload ( format_string ( map_name ) ) self . append_payload ( format_string ( button_name ) )