Skip to content

Commit 189ef24

Browse files
committed
Revert to normal tab processing and commit when validating panel.
1 parent 74e204b commit 189ef24

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

tests/installer/panels/basic_info_panel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from .panel import Panel
66
from ..log import log
7-
from ..widgets import ShortcutButton, MInput
7+
from ..widgets import ShortcutButton
88

99
from textual import on
1010
from textual.containers import Vertical, Horizontal
@@ -17,8 +17,8 @@
1717

1818
class BasicInfoPanel(Panel):
1919
def _build_widgets(self) -> Widget:
20-
self.name_input = MInput(placeholder='Enter machine name', id='name-input')
21-
self.email_input = MInput(placeholder='Enter email', id='email-input')
20+
self.name_input = Input(placeholder='Enter machine name', id='name-input')
21+
self.email_input = Input(placeholder='Enter email', id='email-input')
2222
return Vertical(
2323
Label('Some basic information', classes='header'),
2424
Label('The name should be something descriptive, such as '

tests/installer/panels/batch_scheduler_panel.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ..dialogs import TestJobsDialog
88
from ..log import log
99
from ..state import Attr, State
10-
from ..widgets import MSelect, ShortcutButton, MInput
10+
from ..widgets import MSelect, ShortcutButton
1111

1212
from textual import on
1313
from textual.app import ComposeResult
@@ -246,20 +246,20 @@ def _build_widgets(self) -> Widget:
246246
),
247247
Vertical(
248248
Label('Account/project:', classes='form-label'),
249-
MInput(id='account-input'),
249+
Input(id='account-input'),
250250
classes='bs-col-2 form-row batch-valid'
251251
),
252252
classes='w-100 form-row', id='batch-system-group-1'
253253
),
254254
Horizontal(
255255
Vertical(
256256
Label('Queue:', classes='form-label'),
257-
MInput(id='queue-input'),
257+
Input(id='queue-input'),
258258
classes='bs-col-1 form-row batch-valid'
259259
),
260260
Vertical(
261261
Label('Multi-node queue:', classes='form-label'),
262-
MInput(id='mqueue-input'),
262+
Input(id='mqueue-input'),
263263
classes='bs-col-2 form-row batch-valid'
264264
),
265265
Checkbox('Run [b bright_yellow]t[/b bright_yellow]est job', value=False,
@@ -286,11 +286,20 @@ async def validate(self) -> bool:
286286
assert isinstance(run_test_job, Checkbox)
287287
scheduler = self._get_scheduler()
288288

289+
self.state.update_conf('account', self._get_input('account-input'))
290+
self.state.update_conf('queue_name', self._get_input('queue-input'))
291+
self.state.update_conf('multi_node_queue_name', self._get_input('mqueue-input'))
292+
289293
if run_test_job.value and scheduler != 'none' and scheduler != 'local':
290294
return await self.run_test_jobs()
291295
else:
292296
return True
293297

298+
def _get_input(self, id: str) -> str:
299+
input = self.get_widget_by_id(id)
300+
assert isinstance(input, Input)
301+
return input.value
302+
294303
@property
295304
def label(self) -> str:
296305
return 'Scheduler'

tests/installer/widgets.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,3 @@ def render(self) -> RenderResult:
5252
text = super().render()
5353
text.plain = '......' # type: ignore
5454
return text
55-
56-
57-
class MInput(Input):
58-
# A version of input that also runs the submit action when the tab button is pressed (seems
59-
# silly from a UI perspective to allow moving the focus from this input without the value being
60-
# committed to whatever model is underneath.
61-
62-
BINDINGS = [('tab', 'tab_pressed')]
63-
64-
65-
async def action_tab_pressed(self) -> None:
66-
await self.action_submit()

0 commit comments

Comments
 (0)