mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
rework configure/install TUI to require less space
This commit is contained in:
@ -93,13 +93,7 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
|
||||
self.nextrely -= 1
|
||||
self.add_widget_intelligent(
|
||||
npyscreen.FixedText,
|
||||
value="Use ctrl-N and ctrl-P to move to the <N>ext and <P>revious fields,",
|
||||
editable=False,
|
||||
color="CAUTION",
|
||||
)
|
||||
self.add_widget_intelligent(
|
||||
npyscreen.FixedText,
|
||||
value="Use cursor arrows to make a selection, and space to toggle checkboxes.",
|
||||
value="Use ctrl-N and ctrl-P to move to the <N>ext and <P>revious fields. Cursor keys navigate, and <space> selects.",
|
||||
editable=False,
|
||||
color="CAUTION",
|
||||
)
|
||||
@ -161,33 +155,40 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
|
||||
BufferBox,
|
||||
name='Log Messages',
|
||||
editable=False,
|
||||
max_height = 10,
|
||||
max_height = 8,
|
||||
)
|
||||
|
||||
self.nextrely += 1
|
||||
done_label = "APPLY CHANGES"
|
||||
back_label = "BACK"
|
||||
cancel_label = "CANCEL"
|
||||
current_position = self.nextrely
|
||||
if self.multipage:
|
||||
self.back_button = self.add_widget_intelligent(
|
||||
npyscreen.ButtonPress,
|
||||
name=back_label,
|
||||
rely=-3,
|
||||
when_pressed_function=self.on_back,
|
||||
)
|
||||
else:
|
||||
self.nextrely = current_position
|
||||
self.cancel_button = self.add_widget_intelligent(
|
||||
npyscreen.ButtonPress,
|
||||
name=cancel_label,
|
||||
when_pressed_function=self.on_cancel
|
||||
)
|
||||
self.nextrely = current_position
|
||||
self.ok_button = self.add_widget_intelligent(
|
||||
npyscreen.ButtonPress,
|
||||
name=done_label,
|
||||
relx=(window_width - len(done_label)) // 2,
|
||||
rely=-3,
|
||||
when_pressed_function=self.on_execute
|
||||
when_pressed_function=self.on_execute
|
||||
)
|
||||
|
||||
label = "APPLY CHANGES & EXIT"
|
||||
self.nextrely = current_position
|
||||
self.done = self.add_widget_intelligent(
|
||||
npyscreen.ButtonPress,
|
||||
name=label,
|
||||
rely=-3,
|
||||
relx=window_width-len(label)-15,
|
||||
when_pressed_function=self.on_done,
|
||||
)
|
||||
@ -553,7 +554,7 @@ class AddModelApplication(npyscreen.NPSAppManaged):
|
||||
def onStart(self):
|
||||
npyscreen.setTheme(npyscreen.Themes.DefaultTheme)
|
||||
self.main_form = self.addForm(
|
||||
"MAIN", addModelsForm, name="Install Stable Diffusion Models", cycle_widgets=True,
|
||||
"MAIN", addModelsForm, name="Install Stable Diffusion Models", cycle_widgets=False,
|
||||
)
|
||||
|
||||
class StderrToMessage():
|
||||
|
@ -17,8 +17,8 @@ from shutil import get_terminal_size
|
||||
from curses import BUTTON2_CLICKED,BUTTON3_CLICKED
|
||||
|
||||
# minimum size for UIs
|
||||
MIN_COLS = 136
|
||||
MIN_LINES = 45
|
||||
MIN_COLS = 130
|
||||
MIN_LINES = 38
|
||||
|
||||
# -------------------------------------
|
||||
def set_terminal_size(columns: int, lines: int):
|
||||
@ -38,13 +38,13 @@ def set_terminal_size(columns: int, lines: int):
|
||||
ts = get_terminal_size()
|
||||
pause = False
|
||||
if ts.columns < columns:
|
||||
print('\033[1mThis window is too narrow for the user interface. Please make it wider.\033[0m')
|
||||
print('\033[1mThis window is too narrow for the user interface.\033[0m')
|
||||
pause = True
|
||||
if ts.lines < lines:
|
||||
print('\033[1mThis window is too short for the user interface. Please make it taller.\033[0m')
|
||||
print('\033[1mThis window is too short for the user interface.\033[0m')
|
||||
pause = True
|
||||
if pause:
|
||||
input('Press any key to continue..')
|
||||
input('Maximize the window then press any key to continue..')
|
||||
|
||||
def _set_terminal_size_powershell(width: int, height: int):
|
||||
script=f'''
|
||||
|
Reference in New Issue
Block a user