Skip to content

Commit

Permalink
TUI
Browse files Browse the repository at this point in the history
  • Loading branch information
svartkanin committed Mar 4, 2024
1 parent f107104 commit 16a2186
Show file tree
Hide file tree
Showing 3 changed files with 471 additions and 4 deletions.
37 changes: 33 additions & 4 deletions archinstall/scripts/guided.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pathlib import Path
from typing import Any, TYPE_CHECKING, Optional

import archinstall
Expand All @@ -7,7 +6,6 @@
from archinstall.lib import locale
from archinstall.lib import disk
from archinstall.lib.global_menu import GlobalMenu
from archinstall.lib.configuration import ConfigurationOutput
from archinstall.lib.installer import Installer
from archinstall.lib.menu import Menu
from archinstall.lib.mirrors import use_mirrors, add_custom_mirrors
Expand All @@ -19,6 +17,35 @@
if TYPE_CHECKING:
_: Any

from archinstall.tui.curses_menu import MenuItem, ArchinstallTui, Menu, MenuItemGroup

try:
tui = ArchinstallTui()

item1 = MenuItem('hello')
item2 = MenuItem('hello2')
item3 = MenuItem('')
item4 = MenuItem('world')
item5 = MenuItem('asdf')
items = [item1, item2, item3, item4, item5]
group = MenuItemGroup(items, multi_selection=True)

menu = Menu(tui, group, header='test header')
tui.run(menu)
finally:
import curses
curses.nocbreak()

try:
tui.screen.keypad(False)
except Exception:
pass

curses.echo()
curses.endwin()

exit(1)


if archinstall.arguments.get('help'):
print("See `man archinstall` for help.")
Expand Down Expand Up @@ -216,10 +243,12 @@ def perform_installation(mountpoint: Path):

installation.genfstab()

info("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation")
info(
"For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation")

if not archinstall.arguments.get('silent'):
prompt = str(_('Would you like to chroot into the newly created installation and perform post-installation configuration?'))
prompt = str(
_('Would you like to chroot into the newly created installation and perform post-installation configuration?'))
choice = Menu(prompt, Menu.yes_no(), default_option=Menu.yes()).run()
if choice.value == Menu.yes():
try:
Expand Down
Empty file added archinstall/tui/__init__.py
Empty file.
Loading

0 comments on commit 16a2186

Please sign in to comment.