preparation for startup option editor

This commit is contained in:
Lincoln Stein 2023-02-17 14:34:48 -05:00
parent c55bbd1a85
commit 587faa3e52
2 changed files with 13 additions and 7 deletions

View File

@ -6,10 +6,7 @@
''' '''
This is the npyscreen frontend to the model installation application. This is the npyscreen frontend to the model installation application.
The work is actually done in a backend file named model_install_backend.py, The work is actually done in backend code in model_install_backend.py.
and is kicked off in the beforeEditing() method in a form with
the class name "outputForm". This decision allows the output from the
installation process to be captured and displayed in an attractive form.
''' '''
import argparse import argparse
@ -247,9 +244,8 @@ class addModelsForm(npyscreen.FormMultiPageAction):
self.parentApp.convert_to_diffusers = self.convert_models.value[0] == 1 self.parentApp.convert_to_diffusers = self.convert_models.value[0] == 1
# big chunk of dead code # big chunk of dead code
# was intended to be a status area in which output of installation steps (including tqdm) was logged in real time # was intended to be a status area in which output of installation steps (including tqdm) was logged in real time.
# Problem is that this requires a fork() and pipe, and not sure this will work properly on windows. # Not used at the current time but retained for possible future implementation.
# So not using, but keep this here in case it is useful later
# class Log(object): # class Log(object):
# def __init__(self, writable): # def __init__(self, writable):
# self.writable = writable # self.writable = writable

View File

@ -5,6 +5,16 @@ import math
import npyscreen import npyscreen
import curses import curses
class IntSlider(npyscreen.Slider):
def translate_value(self):
stri = "%2d / %2d" % (self.value, self.out_of)
l = (len(str(self.out_of))) * 2 + 4
stri = stri.rjust(l)
return stri
class IntTitleSlider(npyscreen.TitleText):
_entry_type = IntSlider
class FloatSlider(npyscreen.Slider): class FloatSlider(npyscreen.Slider):
# this is supposed to adjust display precision, but doesn't # this is supposed to adjust display precision, but doesn't
def translate_value(self): def translate_value(self):