Skip to content

Commit e5f7cd8

Browse files
authored
3.3
Window titles and stuff like that
1 parent 09e96c6 commit e5f7cd8

File tree

7 files changed

+25
-44
lines changed

7 files changed

+25
-44
lines changed

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,13 @@ cursesplus is getting a widgets based system. The old utilities have been moved
1919

2020
**DANGER: THIS IS A TRULY BACKWARDS INCOMPATIBLE UPDATE. LOTS OF CODE WILL NEED TO BE REFACTORED!**
2121

22-
- Add TUI base module
22+
### 3.3
2323

24-
- Add widgets module
24+
- Add Window.add_raw_text that uses the addstr method
2525

26-
- Move colours to constants module
26+
- Add Window title
2727

28-
- cursesplus.cp is now imported under cursesplus.classic
29-
30-
- There is now a default ctrl_C detector.
31-
32-
### 3.2
33-
34-
- Add rectangle drawing for windows
35-
36-
- Remove ctrl c handler
37-
38-
- Move colours set to utils. For backwards compatibility, it is automatically imported to root level
39-
40-
- Utils.coord is now imported on root level
28+
- Default text is "WINDOW"
4129

4230
# Documentation
4331

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
33
build-backend = "setuptools.build_meta"
44
[project]
55
name = "cursesplus"
6-
version = "3.2"
6+
version = "3.3"
77
authors = [{name="Enderbyte Programs",email="[email protected]"},]
88
description = "An extension program to curses that offers option menus, message boxes, file dialogs and more"
99
readme = "README.md"

src/__cptest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
if __name__ == "__main__":
77
win = cursesplus.show_ui()
88
subwin = win.create_child_window(cursesplus.Coord(5,5),cursesplus.Coord(10,5))
9-
subwin.drawWindowBoundary = True
10-
subwin.update()
9+
win.tui_window.drawWindowBoundary = True
10+
#subwin.update()
1111
#cursesplus.utils.draw_bold_rectangle(subwin.screen,cursesplus.Coord(5,5),cursesplus.Coord(10,10))
1212
win.update()
1313
win.screen.getch()

src/cursesplus.egg-info/PKG-INFO

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: cursesplus
3-
Version: 3.2
3+
Version: 3.3
44
Summary: An extension program to curses that offers option menus, message boxes, file dialogs and more
55
Author-email: Enderbyte Programs <[email protected]>
66
Project-URL: Homepage, https://github.com/Enderbyte-Programs/Curses-Plus
@@ -33,25 +33,13 @@ cursesplus is getting a widgets based system. The old utilities have been moved
3333

3434
**DANGER: THIS IS A TRULY BACKWARDS INCOMPATIBLE UPDATE. LOTS OF CODE WILL NEED TO BE REFACTORED!**
3535

36-
- Add TUI base module
36+
### 3.3
3737

38-
- Add widgets module
38+
- Add Window.add_raw_text that uses the addstr method
3939

40-
- Move colours to constants module
40+
- Add Window title
4141

42-
- cursesplus.cp is now imported under cursesplus.classic
43-
44-
- There is now a default ctrl_C detector.
45-
46-
### 3.2
47-
48-
- Add rectangle drawing for windows
49-
50-
- Remove ctrl c handler
51-
52-
- Move colours set to utils. For backwards compatibility, it is automatically imported to root level
53-
54-
- Utils.coord is now imported on root level
42+
- Default text is "WINDOW"
5543

5644
# Documentation
5745

src/cursesplus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
NOTICE! CP UTILITIES ARE COMPLETELY INCOMPATIBLE WITH TUIBASE. TO USE THEM, CALL your BaseWindows.screen for the stdscr argument.
2424
"""
2525

26-
__version__ = "3.1"
26+
__version__ = "3.3"
2727
__author__ = "Enderbyte Programs"
2828
__package__ = "cursesplus"
2929

src/cursesplus/constants.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@
1717
DOUBLE_BL_CORNER = "╚"
1818
DOUBLE_BR_CORNER = "╝"
1919
DOUBLE_HORIZ = "═"
20-
DOUBLE_VERT = "║"
20+
DOUBLE_VERT = "║"
21+
DOUBLE_HORIZ_TRUNC_RIGHT = "╞"
22+
DOUBLE_HORIZ_TRUNC_LEFT = "╡"

src/cursesplus/tuibase.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4041
class 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

6063
def show_ui() -> BaseWindow:
6164
"""Start the user interface. Returns a BaseWindow you can use for editing"""

0 commit comments

Comments
 (0)