installer respects INVOKEAI_ROOT for default root location

This commit is contained in:
Lincoln Stein 2023-07-29 16:16:44 -04:00
parent 9a1cfadd8b
commit 781322a647
2 changed files with 21 additions and 1 deletions

View File

@ -168,7 +168,10 @@ class Installer:
messages.welcome()
self.dest = Path(root).expanduser().resolve() if yes_to_all else messages.dest_path(root)
invokeai_root = os.environ.get('INVOKEAI_ROOT')
default_path = invokeai_root or Path(root).expanduser().resolve()
self.dest = default_path if yes_to_all else messages.dest_path(root)
# create the venv for the app
self.venv = self.app_venv()

View File

@ -58,6 +58,8 @@ logger = InvokeAILogger.getLogger()
# from https://stackoverflow.com/questions/92438/stripping-non-printable-characters-from-a-string-in-python
NOPRINT_TRANS_TABLE = {i: None for i in range(0, sys.maxunicode + 1) if not chr(i).isprintable()}
# maximum number of installed models we can display before overflowing vertically
MAX_OTHER_MODELS = 72
def make_printable(s: str) -> str:
"""Replace non-printable characters in a string"""
@ -271,6 +273,11 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
)
)
truncation = False
if len(model_labels) > MAX_OTHER_MODELS:
model_labels = model_labels[0:MAX_OTHER_MODELS]
truncation = True
widgets.update(
models_selected=self.add_widget_intelligent(
MultiSelectColumns,
@ -289,6 +296,16 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
models=model_list,
)
if truncation:
widgets.update(
warning_message = self.add_widget_intelligent(
npyscreen.FixedText,
value=f"Too many models to display (max={MAX_OTHER_MODELS}). Some are not displayed.",
editable=False,
color="CAUTION",
)
)
self.nextrely += 1
widgets.update(
download_ids=self.add_widget_intelligent(