@@ -26,6 +26,7 @@ def __init__(self,screen):
2626 self .size_x -= 1
2727 self .tui_window = Window (self ,self .screen ,self .size_x ,self .size_y ,0 ,0 )
2828 self .tui_window .drawWindowBoundary = False
29+ self .tui_window .title = "Application"
2930
3031 #self.tui_window.update()
3132 def create_child_window (self ,offset :utils .Coord ,size :utils .Coord ):
@@ -39,23 +40,25 @@ def update(self):
3940
4041class Window :
4142 drawWindowBoundary = True
42- def __init__ (self ,parent :BaseWindow ,screen ,size_x : int ,size_y :int ,offset_x :int ,offset_y :int ):
43+ def __init__ (self ,parent :BaseWindow ,screen ,size_x : int ,size_y :int ,offset_x :int ,offset_y :int , window_title = "Window" ):
4344 self .screen : curses ._CursesWindow = screen
4445 self .parent : BaseWindow = parent
45-
46- self .size_x = size_x
47- self .size_y = size_y
46+ self .title = window_title
4847 self .id = get_new_winid ()
4948 self .size_coords = utils .Coord (size_x ,size_y )
50- self .offset_x = offset_x
51- self .offset_y = offset_y
5249 self .offset_coords = utils .Coord (offset_x ,offset_y )
5350 self .parent .children .append (self )
5451 #signal.signal(signal.SIGINT,__base_signal_handler)#Register base shutdown
5552 def update (self ):
5653 if self .drawWindowBoundary :
5754 utils .draw_bold_rectangle (self .screen ,self .offset_coords ,self .size_coords + self .offset_coords )
55+ self .screen .addstr (self .offset_coords .y ,self .offset_coords .x + 2 ,utils .constants .DOUBLE_HORIZ_TRUNC_LEFT + self .title + utils .constants .DOUBLE_HORIZ_TRUNC_RIGHT )
5856 self .screen .refresh ()
57+ def write_raw_text (self ,location :utils .Coord ,string :str ,colour = 0 ):
58+ if colour != 0 :
59+ self .screen .addstr (location .y ,location .x ,string ,colour )
60+ else :
61+ self .screen .addstr (location .y ,location .x ,string )
5962
6063def show_ui () -> BaseWindow :
6164 """Start the user interface. Returns a BaseWindow you can use for editing"""
0 commit comments