Velocity/core/welcome.py

30 lines
835 B
Python
Raw Normal View History

2022-03-17 18:46:04 +00:00
import curses
2022-03-17 21:47:19 +00:00
def start_screen(screen):
2022-03-17 18:46:04 +00:00
# Get window height and width
2022-03-17 21:47:19 +00:00
height, width = screen.getmaxyx()
2022-03-17 18:46:04 +00:00
# Startup text
title = "λ Lambda"
subtext = [
"Next generation hackable text editor for nerds",
"",
"Type :h to open the README.md document",
"Type :o <file> to open a file and edit",
"Type :q or <C-c> to quit lambda.py"
]
# Centering calculations
start_x_title = int((width // 2) - (len(title) // 2) - len(title) % 2)
start_y = int((height // 2) - 2)
# Rendering title
2022-03-17 21:47:19 +00:00
screen.addstr(start_y, start_x_title, title, curses.color_pair(7) | curses.A_BOLD)
2022-03-17 18:46:04 +00:00
# Print the subtext
for text in subtext:
start_y += 1
start_x = int((width // 2) - (len(text) // 2) - len(text) % 2)
2022-03-17 21:47:19 +00:00
screen.addstr(start_y, start_x, text)