Compare commits
3 Commits
1d887c9fdf
...
610e1a2801
Author | SHA1 | Date | |
---|---|---|---|
610e1a2801 | |||
af46a0200b | |||
c1ab61c61e |
@ -41,12 +41,20 @@ EditScreen Label {
|
|||||||
#message-dialog {
|
#message-dialog {
|
||||||
padding: 0 1;
|
padding: 0 1;
|
||||||
grid-rows: 3fr 1fr;
|
grid-rows: 3fr 1fr;
|
||||||
width: 50%;
|
max-width: 75%;
|
||||||
height: 50%;
|
max-height: 75%;
|
||||||
border: tall gray 100%;
|
border: tall gray 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#button-container {
|
#button-container {
|
||||||
|
align: center middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cancel-button-container {
|
||||||
|
align: left middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#confirm-button-container {
|
||||||
align: right middle;
|
align: right middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
"""
|
"""
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
from textwrap import dedent
|
||||||
|
|
||||||
from google.protobuf import descriptor
|
from google.protobuf import descriptor
|
||||||
from google.protobuf.message import Message
|
from google.protobuf.message import Message
|
||||||
@ -16,7 +17,7 @@ from textual.containers import Container, Grid, Horizontal
|
|||||||
from textual.logging import TextualHandler
|
from textual.logging import TextualHandler
|
||||||
from textual.screen import ModalScreen
|
from textual.screen import ModalScreen
|
||||||
from textual.validation import Number
|
from textual.validation import Number
|
||||||
from textual.widgets import Button, Footer, Header, Input, Label, Pretty, Select, Tree
|
from textual.widgets import Button, Footer, Header, Input, Label, Pretty, Select, TextArea, Tree
|
||||||
from textual.widgets.tree import TreeNode
|
from textual.widgets.tree import TreeNode
|
||||||
|
|
||||||
from gp2040ce_bintools import _version, core_parser, handler
|
from gp2040ce_bintools import _version, core_parser, handler
|
||||||
@ -57,12 +58,12 @@ class EditScreen(ModalScreen):
|
|||||||
# we don't handle whatever these are yet
|
# we don't handle whatever these are yet
|
||||||
self.input_field = Label(repr(self.field_value), id='field-input')
|
self.input_field = Label(repr(self.field_value), id='field-input')
|
||||||
yield Grid(
|
yield Grid(
|
||||||
Container(Label(self.field_descriptor.full_name, id="field-name"), id="field-name-container"),
|
Container(Label(self.field_descriptor.full_name, id='field-name'), id='field-name-container'),
|
||||||
Container(self.input_field, id="input-field-container"),
|
Container(self.input_field, id='input-field-container'),
|
||||||
Container(Pretty('', id='input-errors', classes='hidden'), id="error-container"),
|
Container(Pretty('', id='input-errors', classes='hidden'), id='error-container'),
|
||||||
Horizontal(Button("Confirm", id='confirm-button'),
|
Horizontal(Container(Button("Cancel", id='cancel-button'), id='cancel-button-container'),
|
||||||
Button("Cancel", id='cancel-button'),
|
Container(Button("Confirm", id='confirm-button'), id='confirm-button-container'),
|
||||||
id="button-container"),
|
id='button-container'),
|
||||||
id='edit-dialog',
|
id='edit-dialog',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -114,8 +115,8 @@ class MessageScreen(ModalScreen):
|
|||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
"""Build the pop-up window with the desired message displayed."""
|
"""Build the pop-up window with the desired message displayed."""
|
||||||
yield Grid(
|
yield Grid(
|
||||||
Container(Label(self.text, id="message-text"), id="text-container"),
|
Container(TextArea(self.text, id='message-text', read_only=True), id='text-container'),
|
||||||
Container(Button("OK", id='ok-button'), id="button-container"),
|
Container(Button("OK", id='ok-button'), id='button-container'),
|
||||||
id='message-dialog',
|
id='message-dialog',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -131,6 +132,7 @@ class ConfigEditor(App):
|
|||||||
('a', 'add_node', "Add Node"),
|
('a', 'add_node', "Add Node"),
|
||||||
('s', 'save', "Save Config"),
|
('s', 'save', "Save Config"),
|
||||||
('q', 'quit', "Quit"),
|
('q', 'quit', "Quit"),
|
||||||
|
('?', 'about', "About"),
|
||||||
]
|
]
|
||||||
CSS_PATH = "config_tree.css"
|
CSS_PATH = "config_tree.css"
|
||||||
TITLE = F"GP2040-CE Configuration Editor - {_version.version}"
|
TITLE = F"GP2040-CE Configuration Editor - {_version.version}"
|
||||||
@ -188,6 +190,15 @@ class ConfigEditor(App):
|
|||||||
"""Take the appropriate action for this type of node."""
|
"""Take the appropriate action for this type of node."""
|
||||||
self._modify_node(node_event.node)
|
self._modify_node(node_event.node)
|
||||||
|
|
||||||
|
def action_about(self) -> None:
|
||||||
|
"""Display a help/about popup."""
|
||||||
|
self.push_screen(MessageScreen(dedent("""
|
||||||
|
gp2040ce-binary-tools - Tools for working with GP2040-CE firmware and storage binaries
|
||||||
|
|
||||||
|
Copyright © 2023 Brian S. Stephan <bss@incorporeal.org>
|
||||||
|
Made available WITHOUT ANY WARRANTY under the GNU General Public License, version 3 or later.
|
||||||
|
""")))
|
||||||
|
|
||||||
def action_add_node(self) -> None:
|
def action_add_node(self) -> None:
|
||||||
"""Add a node to the tree item, if allowed by the tree and config section."""
|
"""Add a node to the tree item, if allowed by the tree and config section."""
|
||||||
tree = self.query_one(Tree)
|
tree = self.query_one(Tree)
|
||||||
|
@ -10,11 +10,11 @@ aiosignal==1.3.1
|
|||||||
# via aiohttp
|
# via aiohttp
|
||||||
attrs==23.2.0
|
attrs==23.2.0
|
||||||
# via aiohttp
|
# via aiohttp
|
||||||
bandit==1.7.7
|
bandit==1.7.8
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
build==1.0.3
|
build==1.1.1
|
||||||
# via pip-tools
|
# via pip-tools
|
||||||
cachetools==5.3.2
|
cachetools==5.3.3
|
||||||
# via tox
|
# via tox
|
||||||
chardet==5.2.0
|
chardet==5.2.0
|
||||||
# via tox
|
# via tox
|
||||||
@ -24,10 +24,8 @@ click==8.1.7
|
|||||||
# textual-dev
|
# textual-dev
|
||||||
colorama==0.4.6
|
colorama==0.4.6
|
||||||
# via tox
|
# via tox
|
||||||
coverage[toml]==7.4.1
|
coverage[toml]==7.4.3
|
||||||
# via
|
# via pytest-cov
|
||||||
# coverage
|
|
||||||
# pytest-cov
|
|
||||||
decorator==5.1.1
|
decorator==5.1.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
distlib==0.3.8
|
distlib==0.3.8
|
||||||
@ -67,9 +65,9 @@ frozenlist==1.4.1
|
|||||||
# via
|
# via
|
||||||
# aiohttp
|
# aiohttp
|
||||||
# aiosignal
|
# aiosignal
|
||||||
grpcio==1.60.0
|
grpcio==1.62.1
|
||||||
# via grpcio-tools
|
# via grpcio-tools
|
||||||
grpcio-tools==1.60.0
|
grpcio-tools==1.62.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
idna==3.6
|
idna==3.6
|
||||||
# via yarl
|
# via yarl
|
||||||
@ -77,11 +75,10 @@ iniconfig==2.0.0
|
|||||||
# via pytest
|
# via pytest
|
||||||
isort==5.13.2
|
isort==5.13.2
|
||||||
# via flake8-isort
|
# via flake8-isort
|
||||||
linkify-it-py==2.0.2
|
linkify-it-py==2.0.3
|
||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
markdown-it-py[linkify,plugins]==3.0.0
|
markdown-it-py[linkify,plugins]==3.0.0
|
||||||
# via
|
# via
|
||||||
# markdown-it-py
|
|
||||||
# mdit-py-plugins
|
# mdit-py-plugins
|
||||||
# rich
|
# rich
|
||||||
# textual
|
# textual
|
||||||
@ -91,17 +88,17 @@ mdit-py-plugins==0.4.0
|
|||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
mdurl==0.1.2
|
mdurl==0.1.2
|
||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
msgpack==1.0.7
|
msgpack==1.0.8
|
||||||
# via textual-dev
|
# via textual-dev
|
||||||
multidict==6.0.4
|
multidict==6.0.5
|
||||||
# via
|
# via
|
||||||
# aiohttp
|
# aiohttp
|
||||||
# yarl
|
# yarl
|
||||||
mypy==1.8.0
|
mypy==1.9.0
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
mypy-extensions==1.0.0
|
mypy-extensions==1.0.0
|
||||||
# via mypy
|
# via mypy
|
||||||
packaging==23.2
|
packaging==24.0
|
||||||
# via
|
# via
|
||||||
# build
|
# build
|
||||||
# pyproject-api
|
# pyproject-api
|
||||||
@ -110,7 +107,7 @@ packaging==23.2
|
|||||||
# tox
|
# tox
|
||||||
pbr==6.0.0
|
pbr==6.0.0
|
||||||
# via stevedore
|
# via stevedore
|
||||||
pip-tools==7.3.0
|
pip-tools==7.4.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
platformdirs==4.2.0
|
platformdirs==4.2.0
|
||||||
# via
|
# via
|
||||||
@ -120,7 +117,7 @@ pluggy==1.4.0
|
|||||||
# via
|
# via
|
||||||
# pytest
|
# pytest
|
||||||
# tox
|
# tox
|
||||||
protobuf==4.25.2
|
protobuf==4.25.3
|
||||||
# via grpcio-tools
|
# via grpcio-tools
|
||||||
pycodestyle==2.11.1
|
pycodestyle==2.11.1
|
||||||
# via flake8
|
# via flake8
|
||||||
@ -133,13 +130,15 @@ pygments==2.17.2
|
|||||||
pyproject-api==1.6.1
|
pyproject-api==1.6.1
|
||||||
# via tox
|
# via tox
|
||||||
pyproject-hooks==1.0.0
|
pyproject-hooks==1.0.0
|
||||||
# via build
|
# via
|
||||||
pytest==7.4.4
|
# build
|
||||||
|
# pip-tools
|
||||||
|
pytest==8.1.1
|
||||||
# via
|
# via
|
||||||
# gp2040ce-binary-tools (pyproject.toml)
|
# gp2040ce-binary-tools (pyproject.toml)
|
||||||
# pytest-asyncio
|
# pytest-asyncio
|
||||||
# pytest-cov
|
# pytest-cov
|
||||||
pytest-asyncio==0.23.4
|
pytest-asyncio==0.23.5.post1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
pytest-cov==4.1.0
|
pytest-cov==4.1.0
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
@ -147,7 +146,7 @@ pyusb==1.2.1
|
|||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
pyyaml==6.0.1
|
pyyaml==6.0.1
|
||||||
# via bandit
|
# via bandit
|
||||||
rich==13.7.0
|
rich==13.7.1
|
||||||
# via
|
# via
|
||||||
# bandit
|
# bandit
|
||||||
# textual
|
# textual
|
||||||
@ -155,27 +154,27 @@ setuptools-scm==8.0.4
|
|||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
snowballstemmer==2.2.0
|
snowballstemmer==2.2.0
|
||||||
# via pydocstyle
|
# via pydocstyle
|
||||||
stevedore==5.1.0
|
stevedore==5.2.0
|
||||||
# via bandit
|
# via bandit
|
||||||
textual==0.47.1
|
textual==0.52.1
|
||||||
# via
|
# via
|
||||||
# gp2040ce-binary-tools (pyproject.toml)
|
# gp2040ce-binary-tools (pyproject.toml)
|
||||||
# textual-dev
|
# textual-dev
|
||||||
textual-dev==1.4.0
|
textual-dev==1.5.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
tox==4.12.1
|
tox==4.14.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
typing-extensions==4.9.0
|
typing-extensions==4.10.0
|
||||||
# via
|
# via
|
||||||
# mypy
|
# mypy
|
||||||
# setuptools-scm
|
# setuptools-scm
|
||||||
# textual
|
# textual
|
||||||
# textual-dev
|
# textual-dev
|
||||||
uc-micro-py==1.0.2
|
uc-micro-py==1.0.3
|
||||||
# via linkify-it-py
|
# via linkify-it-py
|
||||||
virtualenv==20.25.0
|
virtualenv==20.25.1
|
||||||
# via tox
|
# via tox
|
||||||
wheel==0.42.0
|
wheel==0.43.0
|
||||||
# via pip-tools
|
# via pip-tools
|
||||||
yarl==1.9.4
|
yarl==1.9.4
|
||||||
# via aiohttp
|
# via aiohttp
|
||||||
|
@ -4,15 +4,14 @@
|
|||||||
#
|
#
|
||||||
# pip-compile --output-file=requirements/requirements.txt pyproject.toml
|
# pip-compile --output-file=requirements/requirements.txt pyproject.toml
|
||||||
#
|
#
|
||||||
grpcio==1.60.0
|
grpcio==1.62.1
|
||||||
# via grpcio-tools
|
# via grpcio-tools
|
||||||
grpcio-tools==1.60.0
|
grpcio-tools==1.62.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
linkify-it-py==2.0.2
|
linkify-it-py==2.0.3
|
||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
markdown-it-py[linkify,plugins]==3.0.0
|
markdown-it-py[linkify,plugins]==3.0.0
|
||||||
# via
|
# via
|
||||||
# markdown-it-py
|
|
||||||
# mdit-py-plugins
|
# mdit-py-plugins
|
||||||
# rich
|
# rich
|
||||||
# textual
|
# textual
|
||||||
@ -20,19 +19,19 @@ mdit-py-plugins==0.4.0
|
|||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
mdurl==0.1.2
|
mdurl==0.1.2
|
||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
protobuf==4.25.2
|
protobuf==4.25.3
|
||||||
# via grpcio-tools
|
# via grpcio-tools
|
||||||
pygments==2.17.2
|
pygments==2.17.2
|
||||||
# via rich
|
# via rich
|
||||||
pyusb==1.2.1
|
pyusb==1.2.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
rich==13.7.0
|
rich==13.7.1
|
||||||
# via textual
|
# via textual
|
||||||
textual==0.47.1
|
textual==0.52.1
|
||||||
# via gp2040ce-binary-tools (pyproject.toml)
|
# via gp2040ce-binary-tools (pyproject.toml)
|
||||||
typing-extensions==4.9.0
|
typing-extensions==4.10.0
|
||||||
# via textual
|
# via textual
|
||||||
uc-micro-py==1.0.2
|
uc-micro-py==1.0.3
|
||||||
# via linkify-it-py
|
# via linkify-it-py
|
||||||
|
|
||||||
# The following packages are considered to be unsafe in a requirements file:
|
# The following packages are considered to be unsafe in a requirements file:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user