Skip to content

Commit

Permalink
Small UI refactor and code coverage fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Sep 9, 2023
1 parent f6b8262 commit 23e47a6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
7 changes: 4 additions & 3 deletions conntextual/curses/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ def handle_char(self, char: int) -> None:
if char == curses.KEY_RESIZE:
self._handle_resize()

elif char == curses.KEY_MOUSE:
pass
# Handle this at some point.
# elif char == curses.KEY_MOUSE:
# pass

else:
else: # pragma: nocover
# trigger this with 'q'
self.app.stop.set()

Expand Down
6 changes: 4 additions & 2 deletions conntextual/curses/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ def draw(self, window: CursesWindow) -> None:
# do floats better
line += " " + str(chan)

if enum is not None:
pass
# Handle enum at some point.
del enum
# if enum is not None:
# pass

window.addstr(line)
window.clrtoeol()
Expand Down
6 changes: 2 additions & 4 deletions conntextual/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from runtimepy.net.arbiter import AppInfo
from runtimepy.primitives import Double
from textual.app import App, ComposeResult
from textual.containers import ScrollableContainer
from textual.logging import TextualHandler
from textual.widgets import Footer, Header, TabbedContent
from vcorelib.math import MovingAverage, RateTracker
Expand Down Expand Up @@ -76,9 +75,8 @@ def compose_app(self) -> ComposeResult:
yield Header()
yield Footer()

with TabbedContent(*(x.model.name for x in self.model.environments)):
for env in self.model.environments:
yield ScrollableContainer(env)
with TabbedContent(*(x.label for x in self.model.environments)):
yield from self.model.environments

def dispatch(self) -> None:
"""Update channel values."""
Expand Down
11 changes: 8 additions & 3 deletions conntextual/ui/channel/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,20 @@ def update_channels(self) -> None:
for coord, chan in self.by_index:
table.update_cell_at(coord, env.value(chan.id))

@property
def label(self) -> str:
"""Obtain a label string for this instance."""
return f"{self.model.source} - {self.model.name}"

def compose(self) -> ComposeResult:
"""Create child nodes."""

yield Static(f"{self.model.source} - {self.model.name}")

# put enums here
# put enums here?

yield DataTable[Union[str, int, float]]()

# logs here?

@staticmethod
def create(
name: str, env: ChannelEnvironment, source: ChannelEnvironmentSource
Expand Down

0 comments on commit 23e47a6

Please sign in to comment.