Skip to content

Commit

Permalink
✨ replace blessed with rich/textual (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Oct 12, 2023
1 parent a0b3921 commit e99dcb7
Show file tree
Hide file tree
Showing 32 changed files with 1,013 additions and 1,550 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ advantage of.
- [x] Goto
- [x] Gosub
- [x] Exception handling
- [x] Terminal library ([Blessed])
- [x] Process-isolated `Terminal` to circumvent atomic `TERM`
- [ ] UI components
- [x] Block editor
- [x] Line editor (block editor with a single line)
- [ ] Horizontal lightbar
- [ ] Vertical lightbar
- [ ] Matrix (vertical/horizontal lightbar)
- [ ] Panel (scrollable boundary)
- [x] Terminal library ([rich])
- [x] Adapt for SSH session usage
- [ ] UI components ([textual])
- [x] Adapt for SSH session usage
- [ ] Block editor
- [ ] Line editor (block editor with a single line)

</details>

Expand Down
6 changes: 3 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ identify==2.5.22
# via pre-commit
idna==3.4
# via requests
importlib-metadata==6.1.0
importlib-metadata==6.8.0
# via
# keyring
# twine
Expand Down Expand Up @@ -92,7 +92,7 @@ pre-commit==3.2.1
# via -r dev.in
pycparser==2.21
# via cffi
pygments==2.15.0
pygments==2.16.1
# via readme-renderer
pyproject-hooks==1.0.0
# via build
Expand Down Expand Up @@ -144,7 +144,7 @@ wheel==0.40.0
# via
# pip-tools
# python-semantic-release
zipp==3.15.0
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
Expand Down
3 changes: 2 additions & 1 deletion requirements/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ Click
aiofiles
asyncssh
bcrypt
blessed
gino
redis
rich
textual
toml
uvicorn[standard]
uvloop
Expand Down
43 changes: 35 additions & 8 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ asyncssh==2.13.1
# via -r requirements.in
bcrypt==4.0.1
# via -r requirements.in
blessed==1.20.0
# via -r requirements.in
blinker==1.6.2
# via flask
cffi==1.15.1
Expand Down Expand Up @@ -52,10 +50,19 @@ httptools==0.5.0
# via uvicorn
idna==3.4
# via anyio
importlib-metadata==6.8.0
# via textual
itsdangerous==2.1.2
# via flask
jinja2==3.1.2
# via flask
linkify-it-py==2.0.2
# via markdown-it-py
markdown-it-py[linkify,plugins]==3.0.0
# via
# mdit-py-plugins
# rich
# textual
markupsafe==2.1.2
# via
# jinja2
Expand All @@ -64,31 +71,51 @@ marshmallow==3.19.0
# via
# flask-marshmallow
# webargs
mdit-py-plugins==0.4.0
# via markdown-it-py
mdurl==0.1.2
# via markdown-it-py
packaging==23.0
# via
# apispec
# marshmallow
# webargs
pycparser==2.21
# via cffi
pygments==2.16.1
# via rich
python-dotenv==1.0.0
# via uvicorn
pyyaml==6.0.1
# via uvicorn
redis==4.5.4
# via -r requirements.in
six==1.16.0
rich==13.6.0
# via
# blessed
# flask-marshmallow
# -r requirements.in
# textual
six==1.16.0
# via flask-marshmallow
sniffio==1.3.0
# via anyio
sqlalchemy==1.3.24
# via gino
textual==0.38.1
# via -r requirements.in
toml==0.10.2
# via -r requirements.in
tree-sitter==0.20.2
# via
# textual
# tree-sitter-languages
tree-sitter-languages==1.7.0
# via textual
typing-extensions==4.5.0
# via asyncssh
# via
# asyncssh
# textual
uc-micro-py==1.0.2
# via linkify-it-py
uvicorn[standard]==0.21.1
# via -r requirements.in
uvloop==0.17.0
Expand All @@ -97,8 +124,6 @@ uvloop==0.17.0
# uvicorn
watchfiles==0.19.0
# via uvicorn
wcwidth==0.2.6
# via blessed
webargs==8.2.0
# via apiflask
websockets==10.4
Expand All @@ -107,3 +132,5 @@ werkzeug==2.3.3
# via flask
wrapt==1.15.0
# via -r requirements.in
zipp==3.17.0
# via importlib-metadata
17 changes: 14 additions & 3 deletions userland/artwork/login.ans
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@

^(;,,;)^

 ..:::..
____ :::''''': ________
 ____\ \  ::::|���:::  >>_  .:::,
,::. _.:: > \_ `:::| |:' seventy nine  /  <\____/_ :::::
`::'.::::'/  /\___/____``| |___ ______ ______\_____  / ``'
  .:::'_// ____/_ _��VV_ \> \`:::.
::::.\\ > /  '  _'/  /\`::::
::::::.\______X\ ____| ,.__ _.,___V__.,_/  X_______/.:::::
::::::........\_____\ |___: ..�....... /____/... ....:::::
`:::::::::::::..  ,::. ....::::::::::: .:.., .::'  `^:::^' ,.
,. `::::::::::::'  `::' `:::::::::::::' ::::: .:::,`'
`'  `^^++^^`  ,..:::,`:::::::::::'  ``'  ,. :::::
`'  ::::: `^:::::^' `'  ``'  hX!
``'
9 changes: 9 additions & 0 deletions userland/artwork/oneliners.ans
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
:%###########################%:| |:%#########################################%:
 ______ ______ _____ | | ___ ______ _____ _________ _____
___/|__/ \_< ___/___| |._\ _)__/\_< ___/___\___\< __/___
\_. | ._ / _/ /| || | ._ / _/ / _// \__ /
 \ \| | |/ /| V / | || | |/ /| V /| \ _/ V /
 \_______l___<____\|________\ | ||____|___<____\|________\|___\___\|________\
| |_____________________________________________
:%########################hX!%:|_______________________________________________

Expand Down
4 changes: 2 additions & 2 deletions userland/models/oneliner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime

# 3rd party
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String
from sqlalchemy import Column, DateTime, ForeignKey, Integer, Unicode

# api
from xthulu.models import User
Expand All @@ -27,7 +27,7 @@ class Oneliner(db.Model):
)
"""User who left the oneliner"""

message = Column(String(78))
message = Column(Unicode(78))
"""The oneliner message"""

timestamp = Column(DateTime(), default=datetime.utcnow)
Expand Down
79 changes: 0 additions & 79 deletions userland/scripts/editor_demo.py

This file was deleted.

21 changes: 9 additions & 12 deletions userland/scripts/lock_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,31 @@
from asyncio import sleep

# api
from xthulu.ssh.console.input import wait_for_key
from xthulu.ssh.context import SSHContext


async def main(cx: SSHContext):
cx.echo(
cx.term.normal,
"\r\n\r\n",
cx.term.bright_white_on_yellow_underline(" Shared locks demo "),
"\r\n\r\n",
)
cx.echo("\n\n[bright_white on yellow underline] Shared locks demo [/]\n\n")

with cx.lock("testing") as l:
if l:
if cx.encoding == "utf-8":
cx.echo("🔒 ")
lock = "🔒 " if cx.encoding == "utf-8" else ""

cx.echo("Lock acquired; press any key to release\r\n")
await cx.term.inkey()
await wait_for_key(
cx, f"{lock}Lock acquired; press any key to release"
)

if cx.encoding == "utf-8":
cx.echo("🔥 ")

cx.echo("Lock released!\r\n")
cx.echo("Lock released!\n")
await sleep(1)

return

if cx.encoding == "utf-8":
cx.echo("❌ ")

cx.echo("Failed to acquire lock\r\n")
cx.echo("Failed to acquire lock\n")
await sleep(2)
Loading

0 comments on commit e99dcb7

Please sign in to comment.