mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
better window size behavior under alacritty & terminator
This commit is contained in:
parent
90df316835
commit
b727442f84
@ -161,7 +161,7 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
|
|||||||
BufferBox,
|
BufferBox,
|
||||||
name='Log Messages',
|
name='Log Messages',
|
||||||
editable=False,
|
editable=False,
|
||||||
max_height = 16,
|
max_height = 10,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.nextrely += 1
|
self.nextrely += 1
|
||||||
|
@ -17,8 +17,8 @@ from shutil import get_terminal_size
|
|||||||
from curses import BUTTON2_CLICKED,BUTTON3_CLICKED
|
from curses import BUTTON2_CLICKED,BUTTON3_CLICKED
|
||||||
|
|
||||||
# minimum size for UIs
|
# minimum size for UIs
|
||||||
MIN_COLS = 180
|
MIN_COLS = 130
|
||||||
MIN_LINES = 55
|
MIN_LINES = 40
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
def set_terminal_size(columns: int, lines: int, launch_command: str=None):
|
def set_terminal_size(columns: int, lines: int, launch_command: str=None):
|
||||||
@ -61,6 +61,12 @@ def _set_terminal_size_unix(width: int, height: int):
|
|||||||
import fcntl
|
import fcntl
|
||||||
import termios
|
import termios
|
||||||
|
|
||||||
|
# These terminals accept the size command and report that the
|
||||||
|
# size changed, but they lie!!!
|
||||||
|
for bad_terminal in ['TERMINATOR_UUID', 'ALACRITTY_WINDOW_ID']:
|
||||||
|
if os.environ.get(bad_terminal):
|
||||||
|
return
|
||||||
|
|
||||||
winsize = struct.pack("HHHH", height, width, 0, 0)
|
winsize = struct.pack("HHHH", height, width, 0, 0)
|
||||||
fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSWINSZ, winsize)
|
fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSWINSZ, winsize)
|
||||||
sys.stdout.write("\x1b[8;{height};{width}t".format(height=height, width=width))
|
sys.stdout.write("\x1b[8;{height};{width}t".format(height=height, width=width))
|
||||||
@ -75,6 +81,12 @@ def set_min_terminal_size(min_cols: int, min_lines: int, launch_command: str=Non
|
|||||||
lines = max(term_lines, min_lines)
|
lines = max(term_lines, min_lines)
|
||||||
set_terminal_size(cols, lines, launch_command)
|
set_terminal_size(cols, lines, launch_command)
|
||||||
|
|
||||||
|
# did it work?
|
||||||
|
term_cols, term_lines = get_terminal_size()
|
||||||
|
if term_cols < cols or term_lines < lines:
|
||||||
|
print(f'This window is too small for optimal display. For best results, please enlarge it.')
|
||||||
|
input('After resizing, press any key to continue...')
|
||||||
|
|
||||||
class IntSlider(npyscreen.Slider):
|
class IntSlider(npyscreen.Slider):
|
||||||
def translate_value(self):
|
def translate_value(self):
|
||||||
stri = "%2d / %2d" % (self.value, self.out_of)
|
stri = "%2d / %2d" % (self.value, self.out_of)
|
||||||
|
Loading…
Reference in New Issue
Block a user