Skip to content
Snippets Groups Projects
Commit d60d6c82 authored by Martin Bergemann's avatar Martin Bergemann :speech_balloon:
Browse files

Add exit handle for save dialogue

parent 36d2231d
No related branches found
No related tags found
1 merge request!17Update playbooks
......@@ -28,6 +28,7 @@ class FileSelector(npyscreen.FileSelector):
else:
self.file_extentions = file_extentions
super().__init__(*args, **kwargs)
self.how_exited_handers[npyscreen.wgwidget.EXITED_ESCAPE] = self.exit_editing
def update_grid(self) -> None:
if self.value:
......@@ -85,7 +86,6 @@ def selectFile(starting_value: str = "", *args, **keywords):
else:
F.value = os.getcwd()
F.update_grid()
F.display()
F.edit()
return F.wCommand.value
......@@ -146,7 +146,9 @@ class BaseForm(npyscreen.FormMultiPageWithMenus, npyscreen.FormWithMenus):
menus = [
" " + self.__class__.MENU_KEY + ":Main Menu ",
"^T:Next Tab ",
"^R:Run Deployment ",
"^R:Run ",
"^S:Save ",
"^L:Load ",
"^E:Exit ",
]
y, x = self.display_menu_advert_at()
......
......@@ -103,7 +103,8 @@ class MainApp(npyscreen.NPSAppManaged):
select_dir=False, must_exist=False, file_extentions=[".toml"]
)
if the_selected_file:
the_selected_file = str(Path(the_selected_file).expanduser().absolute())
the_selected_file = Path(the_selected_file).with_suffix(".toml")
the_selected_file = str(the_selected_file.expanduser().absolute())
self.check_missing_config(stop_at_missing=False)
self._setup_form.inventory_file.value = the_selected_file
self.save_config_to_file(write_toml_file=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment