Added field specifiers

This commit is contained in:
Mark Qvist 2023-10-30 02:26:24 +01:00
parent 56cb637bfa
commit da6fb3d0f3
2 changed files with 10 additions and 8 deletions

View File

@ -1,13 +1,16 @@
APP_NAME = "lxmf" APP_NAME = "lxmf"
# WARNING! These specifications are floating and not # WARNING! These field specifiers are floating and not
# yet final! Consider highly experiemental, and expect # yet final! Consider highly experiemental, and expect
# them to change in the future! You have been warned :) # them to change in the future! You have been warned :)
FIELD_EMBEDDED_LXMS = 0x01 FIELD_EMBEDDED_LXMS = 0x01
FIELD_TELEMETRY = 0x02 FIELD_TELEMETRY = 0x02
FIELD_ICON_APPEARANCE = 0x03 FIELD_TELEMETRY_STREAM = 0x03
FIELD_FILE_ATTACHMENTS = 0x04 FIELD_ICON_APPEARANCE = 0x04
FIELD_IMAGE = 0x05 FIELD_FILE_ATTACHMENTS = 0x05
FIELD_AUDIO = 0x06 FIELD_IMAGE = 0x06
FIELD_THREAD = 0x07 FIELD_AUDIO = 0x07
FIELD_THREAD = 0x08
FIELD_COMMANDS = 0x09
FIELD_RESULTS = 0x0A

View File

@ -111,7 +111,6 @@ class LXMessage:
self.set_title_from_string(title) self.set_title_from_string(title)
self.set_content_from_string(content) self.set_content_from_string(content)
self.set_fields(fields) self.set_fields(fields)
self.payload = None self.payload = None
@ -164,7 +163,7 @@ class LXMessage:
def set_fields(self, fields): def set_fields(self, fields):
if isinstance(fields, dict) or fields == None: if isinstance(fields, dict) or fields == None:
self.fields = fields self.fields = fields or {}
else: else:
raise ValueError("LXMessage property \"fields\" can only be dict or None") raise ValueError("LXMessage property \"fields\" can only be dict or None")