'Set properties and text given a text field.'

def setText(self, text):

    self.text = text
    try:
        result = {}
        end = len(text)
        index = 0
        strs = []
        while (index < end):
            length = ord(text[index])
            index += 1
            strs.append(text[index:(index + length)])
            index += length
        for s in strs:
            try:
                (key, value) = s.split('=', 1)
                if (value == 'true'):
                    value = True
                elif ((value == 'false') or (not value)):
                    value = False
            except:
                key = s
                value = False
            if (key and (result.get(key) is None)):
                result[key] = value
        self.properties = result
    except:
        traceback.print_exc()
        self.properties = None
