Example #1
0
File: id.py Project: FernandezR/kll
    def __init__(self, type, uid, locale):
        '''
        @param type:   String type of the Id
        @param uid:    Unique integer identifier for the Id
        @param locale: Locale layout object used to decode used to decode uid
        '''
        Id.__init__(self)
        Schedule.__init__(self)
        self.type = type
        self.uid = uid
        self.locale = locale
        self.locale_type = self.type_locale[self.type]

        # Set secondary type
        self.second_type = self.secondary_types[self.type]

        # Set kll type
        self.kll_type = self.kll_types[self.type]

        # Determine hex_str padding
        self.padding = 2
        if self.type == 'ConsCode':
            self.padding = 3

        # Validate uid is in locale based on what type of HID field it is
        if self.hex_str() not in self.locale.json()[self.locale_type].keys():
            print("{} Unknown HID({}) UID('{}') in locale '{}'".format(
                WARNING, self.type, self.uid, self.locale.name()))
Example #2
0
File: id.py Project: kluelogic/kll
    def __init__(self, type, uid, locale):
        '''
        @param type:   String type of the Id
        @param uid:    Unique integer identifier for the Id
        @param locale: Locale layout object used to decode used to decode uid
        '''
        Id.__init__(self)
        Schedule.__init__(self)
        self.type = type
        self.uid = uid
        self.locale = locale
        self.locale_type = self.type_locale[self.type]

        # Set secondary type
        self.second_type = self.secondary_types[self.type]

        # Set kll type
        self.kll_type = self.kll_types[self.type]

        # Determine hex_str padding
        self.padding = 2
        if self.type == 'ConsCode':
            self.padding = 3

        # Validate uid is in locale based on what type of HID field it is
        if self.hex_str() not in self.locale.json()[self.locale_type].keys():
            print("{} Unknown HID({}) UID('{}') in locale '{}'".format(
                WARNING,
                self.type,
                self.uid,
                self.locale.name()
            ))
Example #3
0
File: id.py Project: kluelogic/kll
 def __init__(self, name, state=None):
     Id.__init__(self)
     Schedule.__init__(self)
     AnimationModifierList.__init__(self)
     self.name = name
     self.type = 'Animation'
     self.second_type = 'A'
     self.state = state
Example #4
0
File: id.py Project: FernandezR/kll
 def __init__(self, name, state=None):
     Id.__init__(self)
     Schedule.__init__(self)
     AnimationModifierList.__init__(self)
     self.name = name
     self.type = 'Animation'
     self.second_type = 'A'
     self.state = state
Example #5
0
File: id.py Project: kluelogic/kll
    def __init__(self, uid):
        Id.__init__(self)
        Schedule.__init__(self)
        Position.__init__(self)
        self.type = 'ScanCode'
        self.uid = uid

        # This uid is used for any post-processing of the uid
        # The original uid is maintained in case it is needed
        self.updated_uid = None
Example #6
0
File: id.py Project: FernandezR/kll
    def __init__(self, uid):
        Id.__init__(self)
        Schedule.__init__(self)
        Position.__init__(self)
        self.type = 'ScanCode'
        self.uid = uid

        # This uid is used for any post-processing of the uid
        # The original uid is maintained in case it is needed
        self.updated_uid = None
Example #7
0
File: id.py Project: FernandezR/kll
    def __init__(self, ustr):
        '''
        @param ustr: UTF-8 string
        '''
        Id.__init__(self)
        Schedule.__init__(self)

        # Select the type based on the length of the UTF-8 string
        if len(ustr) == 1:
            # Single character
            self.type = 'UTF8State'
        else:
            self.type = 'UTF8Text'
        self.uid = ustr
Example #8
0
File: id.py Project: kluelogic/kll
 def json(self):
     '''
     JSON representation of LayerId
     '''
     output = Id.json(self)
     output.update(Schedule.json(self))
     return output
Example #9
0
File: id.py Project: FernandezR/kll
 def json(self):
     '''
     JSON representation of UTF8Id
     '''
     output = Id.json(self)
     output.update(Schedule.json(self))
     return output
Example #10
0
File: id.py Project: kluelogic/kll
 def json(self):
     '''
     JSON representation of ScanCodeId
     '''
     output = Id.json(self)
     output.update(Schedule.json(self))
     output.update(Position.json(self))
     return output
Example #11
0
File: id.py Project: FernandezR/kll
 def json(self):
     '''
     JSON representation of TriggerId
     '''
     output = Id.json(self)
     output.update(Schedule.json(self))
     output['idcode'] = self.idcode
     return output
Example #12
0
File: id.py Project: kluelogic/kll
 def json(self):
     '''
     JSON representation of TriggerId
     '''
     output = Id.json(self)
     output.update(Schedule.json(self))
     output['idcode'] = self.idcode
     return output
Example #13
0
File: id.py Project: FernandezR/kll
 def json(self):
     '''
     JSON representation of ScanCodeId
     '''
     output = Id.json(self)
     output.update(Schedule.json(self))
     output.update(Position.json(self))
     return output
Example #14
0
File: id.py Project: FernandezR/kll
 def json(self):
     '''
     JSON representation of AnimationId
     '''
     output = Id.json(self)
     output.update(AnimationModifierList.json(self))
     output.update(Schedule.json(self))
     output['name'] = self.name
     output['setting'] = "{}".format(self)
     output['state'] = self.state
     del output['uid']
     return output
Example #15
0
File: id.py Project: kluelogic/kll
 def json(self):
     '''
     JSON representation of AnimationId
     '''
     output = Id.json(self)
     output.update(AnimationModifierList.json(self))
     output.update(Schedule.json(self))
     output['name'] = self.name
     output['setting'] = "{}".format(self)
     output['state'] = self.state
     del output['uid']
     return output
Example #16
0
File: id.py Project: kluelogic/kll
 def __init__(self, idcode, uid):
     Id.__init__(self)
     Schedule.__init__(self)
     self.type = 'GenericTrigger'
     self.uid = uid
     self.idcode = idcode
Example #17
0
File: id.py Project: FernandezR/kll
 def __init__(self, idcode, uid):
     Id.__init__(self)
     Schedule.__init__(self)
     self.type = 'GenericTrigger'
     self.uid = uid
     self.idcode = idcode
Example #18
0
File: id.py Project: FernandezR/kll
 def __init__(self, type, layer):
     Id.__init__(self)
     Schedule.__init__(self)
     self.type = type
     self.uid = layer
Example #19
0
File: id.py Project: kluelogic/kll
 def __init__(self, type, layer):
     Id.__init__(self)
     Schedule.__init__(self)
     self.type = type
     self.uid = layer