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