Skip to content

Commit

Permalink
fix is_yes gui enter button
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Sep 3, 2024
1 parent 3c2cac3 commit a9b9468
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export TAG := `grep version pyproject.toml | pz --search '"(\d+\.\d+\.\d+(?:rc\d+))?"'`
export TAG := `grep version pyproject.toml | pz --search '"(\d+\.\d+\.\d+(?:rc\d+)?)?"'`

release:
git tag $(TAG)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ Check out several useful methods to handle user dialogues. Here we bound the int

```python
with run(Env) as m:
print(f"Your important number is {m}")
print(f"Your important number is {m.env.important_number}")
boolean = m.is_yes("Is that alright?")
```

![Small window with the text 'Your important number'](asset/hello-with-statement.webp "With statement to redirect the output")
![The same in terminal'](asset/hello-with-statement-tui.webp "With statement in TUI fallback")
![The same in terminal'](asset/hello-with-statement-tui.avif "With statement in TUI fallback")

# Contents
- [Mininterface – GUI, TUI, CLI and config](#mininterface-gui-tui-cli-and-config)
Expand Down Expand Up @@ -95,7 +95,7 @@ The config variables needed by your program are kept in cozy dataclasses. Write

Install with a single command from [PyPi](https://pypi.org/project/mininterface/).

```python3
```bash
pip install mininterface
```

Expand Down
Binary file added asset/hello-with-statement-tui.avif
Binary file not shown.
Binary file removed asset/hello-with-statement-tui.webp
Binary file not shown.
6 changes: 4 additions & 2 deletions mininterface/GuiInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ def buttons(self, text: str, buttons: list[tuple[str, Any]], focused: int = 1):
label = Label(self.frame, text=text)
label.pack(pady=10)

for text, value in buttons:
for i, (text, value) in enumerate(buttons):
button = Button(self.frame, text=text, command=lambda v=value: self._ok(v))
button.bind("<Return>", lambda _: button.invoke())
if i == focused-1:
b = button
button.bind("<Return>", lambda _: b.invoke())
button.pack(side=LEFT, padx=10)
self.frame.winfo_children()[focused].focus_set()
return self.mainloop()
Expand Down
3 changes: 0 additions & 3 deletions mininterface/TextualInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
from .Redirectable import Redirectable
from .TextInterface import TextInterface

# TODO with statement hello world example image is wrong (Textual already redirects the output as GuiInterface does)


@dataclass
class DummyWrapper:
""" Value wrapped, since I do not know how to get it from textual app.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "mininterface"
version = "0.4.4rc3"
version = "0.5.0"
description = "A minimal access to GUI, TUI, CLI and config"
authors = ["Edvard Rejthar <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down

0 comments on commit a9b9468

Please sign in to comment.