Skip to content

Commit

Permalink
3.3
Browse files Browse the repository at this point in the history
Window titles and stuff like that
  • Loading branch information
Enderbyte09 authored Oct 27, 2023
1 parent 09e96c6 commit e5f7cd8
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 44 deletions.
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,13 @@ cursesplus is getting a widgets based system. The old utilities have been moved

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

- Add TUI base module
### 3.3

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

- Move colours to constants module
- Add Window title

- cursesplus.cp is now imported under cursesplus.classic

- There is now a default ctrl_C detector.

### 3.2

- Add rectangle drawing for windows

- Remove ctrl c handler

- Move colours set to utils. For backwards compatibility, it is automatically imported to root level

- Utils.coord is now imported on root level
- Default text is "WINDOW"

# Documentation

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "cursesplus"
version = "3.2"
version = "3.3"
authors = [{name="Enderbyte Programs",email="enderbyte09@gmail.com"},]
description = "An extension program to curses that offers option menus, message boxes, file dialogs and more"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions src/__cptest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
if __name__ == "__main__":
win = cursesplus.show_ui()
subwin = win.create_child_window(cursesplus.Coord(5,5),cursesplus.Coord(10,5))
subwin.drawWindowBoundary = True
subwin.update()
win.tui_window.drawWindowBoundary = True
#subwin.update()
#cursesplus.utils.draw_bold_rectangle(subwin.screen,cursesplus.Coord(5,5),cursesplus.Coord(10,10))
win.update()
win.screen.getch()
Expand Down
22 changes: 5 additions & 17 deletions src/cursesplus.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: cursesplus
Version: 3.2
Version: 3.3
Summary: An extension program to curses that offers option menus, message boxes, file dialogs and more
Author-email: Enderbyte Programs <enderbyte09@gmail.com>
Project-URL: Homepage, https://github.com/Enderbyte-Programs/Curses-Plus
Expand Down Expand Up @@ -33,25 +33,13 @@ cursesplus is getting a widgets based system. The old utilities have been moved

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

- Add TUI base module
### 3.3

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

- Move colours to constants module
- Add Window title

- cursesplus.cp is now imported under cursesplus.classic

- There is now a default ctrl_C detector.

### 3.2

- Add rectangle drawing for windows

- Remove ctrl c handler

- Move colours set to utils. For backwards compatibility, it is automatically imported to root level

- Utils.coord is now imported on root level
- Default text is "WINDOW"

# Documentation

Expand Down
2 changes: 1 addition & 1 deletion src/cursesplus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
NOTICE! CP UTILITIES ARE COMPLETELY INCOMPATIBLE WITH TUIBASE. TO USE THEM, CALL your BaseWindows.screen for the stdscr argument.
"""

__version__ = "3.1"
__version__ = "3.3"
__author__ = "Enderbyte Programs"
__package__ = "cursesplus"

Expand Down
4 changes: 3 additions & 1 deletion src/cursesplus/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
DOUBLE_BL_CORNER = "╚"
DOUBLE_BR_CORNER = "╝"
DOUBLE_HORIZ = "═"
DOUBLE_VERT = "║"
DOUBLE_VERT = "║"
DOUBLE_HORIZ_TRUNC_RIGHT = "╞"
DOUBLE_HORIZ_TRUNC_LEFT = "╡"
15 changes: 9 additions & 6 deletions src/cursesplus/tuibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self,screen):
self.size_x -= 1
self.tui_window = Window(self,self.screen,self.size_x,self.size_y,0,0)
self.tui_window.drawWindowBoundary = False
self.tui_window.title = "Application"

#self.tui_window.update()
def create_child_window(self,offset:utils.Coord,size:utils.Coord):
Expand All @@ -39,23 +40,25 @@ def update(self):

class Window:
drawWindowBoundary = True
def __init__(self,parent:BaseWindow,screen,size_x: int,size_y:int,offset_x:int,offset_y:int):
def __init__(self,parent:BaseWindow,screen,size_x: int,size_y:int,offset_x:int,offset_y:int,window_title="Window"):
self.screen: curses._CursesWindow = screen
self.parent: BaseWindow = parent

self.size_x = size_x
self.size_y = size_y
self.title = window_title
self.id = get_new_winid()
self.size_coords = utils.Coord(size_x,size_y)
self.offset_x =offset_x
self.offset_y = offset_y
self.offset_coords = utils.Coord(offset_x,offset_y)
self.parent.children.append(self)
#signal.signal(signal.SIGINT,__base_signal_handler)#Register base shutdown
def update(self):
if self.drawWindowBoundary:
utils.draw_bold_rectangle(self.screen,self.offset_coords,self.size_coords+self.offset_coords)
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)
self.screen.refresh()
def write_raw_text(self,location:utils.Coord,string:str,colour=0):
if colour != 0:
self.screen.addstr(location.y,location.x,string,colour)
else:
self.screen.addstr(location.y,location.x,string)

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

0 comments on commit e5f7cd8

Please sign in to comment.