Skip to content

Commit cfba230

Browse files
committed
remove default empty option
select now defaults to Lotto patch bump
1 parent a2ab27f commit cfba230

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "lottery-tui"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = "A terminal user interface for lottery games."
55
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
66
dependencies = ["textual>=8.0.0", "loguru>=0.7.3"]

src/lottery_tui/tui.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import NoReturn
22

3-
from rich.text import Text
43
from textual.app import App, ComposeResult
54
from textual.containers import Container
65
from textual.events import Key
@@ -27,6 +26,8 @@ def compose(self) -> ComposeResult:
2726
('Set For Life', 'setforlife'),
2827
('Thunderball', 'thunderball'),
2928
],
29+
value='lotto',
30+
allow_blank=False,
3031
id='lottery-select',
3132
),
3233
Button('Draw', id='draw-button'),
@@ -46,22 +47,13 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
4647

4748
def _draw_button_handler(self) -> None:
4849
"""Handle the draw button press."""
49-
if self._read_lottery_selection() is None:
50-
self._update_result_label(
51-
Text('Please select a lottery before drawing.', style='bold #ff8c42')
52-
)
53-
return
54-
5550
lottery_obj = request_lottery_obj(self._read_lottery_selection())
5651
result = lottery_obj.draw()
5752
self._update_result_label(str(result))
5853

59-
def _read_lottery_selection(self) -> SelectType | None:
54+
def _read_lottery_selection(self) -> SelectType:
6055
"""Read the selected lottery from the dropdown."""
61-
select_widget = self.query_one('#lottery-select')
62-
if select_widget.is_blank():
63-
return None
64-
return select_widget.value
56+
return self.query_one('#lottery-select').value
6557

6658
def _update_result_label(self, message: str) -> None:
6759
"""Update the result label with a new message."""

0 commit comments

Comments
 (0)