Skip to content

Commit d662ebd

Browse files
committed
Implement TagVal writers
1 parent 8149587 commit d662ebd

File tree

5 files changed

+735
-70
lines changed

5 files changed

+735
-70
lines changed

tcmenu/remote/commands/dialog_mode.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from enum import Enum, auto
1+
from enum import Enum
22

33

44
# noinspection PyArgumentList
@@ -8,19 +8,17 @@ class DialogMode(Enum):
88
"""
99

1010
""" The dialog is to be shown. """
11-
SHOW = auto()
11+
SHOW = "S"
1212

1313
""" The dialog is to be hidden. """
14-
HIDE = auto()
14+
HIDE = "H"
1515

1616
""" Perform the following action on the dialog. """
17-
ACTION = auto()
17+
ACTION = "A"
1818

1919
@staticmethod
2020
def from_string(mode: str) -> "DialogMode":
21-
if mode == "S":
22-
return DialogMode.SHOW
23-
elif mode == "H":
24-
return DialogMode.HIDE
25-
else:
21+
try:
22+
return DialogMode(mode)
23+
except ValueError:
2624
return DialogMode.ACTION

tcmenu/remote/commands/menu_boot_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from dataclasses import dataclass
33
from typing import Any, Optional, TypeVar, Generic
44

5-
from tcmenu.domain.menu_items import MenuItem, AnalogMenuItem
5+
from tcmenu.domain.menu_items import MenuItem
66
from tcmenu.domain.state.menu_state import MenuState
77
from tcmenu.domain.util.menu_item_helper import MenuItemHelper
88
from tcmenu.remote.commands.menu_command import MenuCommand

tcmenu/remote/protocol/configurable_protocol_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def from_channel(self, buffer: io.BytesIO) -> Generic[T]:
9797
parser = TagValTextParser(buffer)
9898
logging.debug(f"Protocol convert in: {parser}")
9999
return self._tag_val_incoming_parsers[cmd_type](parser)
100-
elif protocol.value == CommandProtocol.RAW_BIN_PROTOCOL and cmd_type in self._raw_incoming_parsers:
100+
elif protocol.value == CommandProtocol.RAW_BIN_PROTOCOL.value and cmd_type in self._raw_incoming_parsers:
101101
length = int.from_bytes(buffer.read(4), byteorder="big")
102102
return self._raw_incoming_parsers[cmd_type](buffer, length)
103103
else:

0 commit comments

Comments
 (0)