fluidityui-py 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fluidityui_py-0.1.0/FluidityUILib/FluidityUI.py +54 -0
- fluidityui_py-0.1.0/FluidityUILib/__init__.py +2 -0
- fluidityui_py-0.1.0/PKG-INFO +5 -0
- fluidityui_py-0.1.0/README.md +1 -0
- fluidityui_py-0.1.0/fluidityui_py.egg-info/PKG-INFO +5 -0
- fluidityui_py-0.1.0/fluidityui_py.egg-info/SOURCES.txt +9 -0
- fluidityui_py-0.1.0/fluidityui_py.egg-info/dependency_links.txt +1 -0
- fluidityui_py-0.1.0/fluidityui_py.egg-info/requires.txt +1 -0
- fluidityui_py-0.1.0/fluidityui_py.egg-info/top_level.txt +1 -0
- fluidityui_py-0.1.0/pyproject.toml +7 -0
- fluidityui_py-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import time
|
|
4
|
+
class Tui:
|
|
5
|
+
def __init__(self, dimension_x, dimension_y, appname, fluidity_input, refresh_rate=0.1, seperator="|", fluidity_input_caret=">"):
|
|
6
|
+
os.system("clear")
|
|
7
|
+
self.appname = appname
|
|
8
|
+
self.fluidity_input = fluidity_input
|
|
9
|
+
self.dimension_x = dimension_x
|
|
10
|
+
self.dimension_y = dimension_y
|
|
11
|
+
self.refresh_rate = refresh_rate
|
|
12
|
+
self.seperator = seperator
|
|
13
|
+
self.fluidity_input_string = ""
|
|
14
|
+
self.fluidity_input_caret = fluidity_input_caret
|
|
15
|
+
frame = []
|
|
16
|
+
frame_tmp = []
|
|
17
|
+
#Constuct a blank frame
|
|
18
|
+
for x in range(dimension_x):
|
|
19
|
+
frame_tmp = []
|
|
20
|
+
frame.append(frame_tmp)
|
|
21
|
+
for y in range(dimension_y):
|
|
22
|
+
frame_tmp.append("")
|
|
23
|
+
self.frame = frame
|
|
24
|
+
def reset_frame(self):
|
|
25
|
+
frame = []
|
|
26
|
+
# Constuct a blank frame
|
|
27
|
+
for x in range(self.dimension_x):
|
|
28
|
+
frame_tmp = []
|
|
29
|
+
frame.append(frame_tmp)
|
|
30
|
+
for y in range(self.dimension_y):
|
|
31
|
+
frame_tmp.append("")
|
|
32
|
+
self.frame = frame
|
|
33
|
+
def draw_frame(self):
|
|
34
|
+
os.system("clear")
|
|
35
|
+
screen_x = os.get_terminal_size().columns
|
|
36
|
+
screen_y = os.get_terminal_size().lines
|
|
37
|
+
block_size_x = screen_x // self.dimension_x
|
|
38
|
+
block_size_y = screen_y // self.dimension_y
|
|
39
|
+
print(f"{self.appname:^{screen_x}}")
|
|
40
|
+
for y in range(self.dimension_y):
|
|
41
|
+
coloumn = []
|
|
42
|
+
for x in range(self.dimension_x):
|
|
43
|
+
value_size = len(self.frame[x][y])
|
|
44
|
+
coloumn.append(f"{self.seperator}{self.frame[x][y]:^{block_size_x-2}}{self.seperator}")
|
|
45
|
+
print("".join(coloumn))
|
|
46
|
+
if self.fluidity_input:
|
|
47
|
+
# Get the user input
|
|
48
|
+
self.fluidity_input_string = input(f"{self.fluidity_input_caret} ")
|
|
49
|
+
time.sleep(self.refresh_rate)
|
|
50
|
+
def update_block(self, x, y, value):
|
|
51
|
+
self.frame[x][y] = value
|
|
52
|
+
def exit_app(self):
|
|
53
|
+
os.system("clear")
|
|
54
|
+
sys.exit()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# FluidityUI – UI for those who don't know frontend
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
FluidityUILib/FluidityUI.py
|
|
4
|
+
FluidityUILib/__init__.py
|
|
5
|
+
fluidityui_py.egg-info/PKG-INFO
|
|
6
|
+
fluidityui_py.egg-info/SOURCES.txt
|
|
7
|
+
fluidityui_py.egg-info/dependency_links.txt
|
|
8
|
+
fluidityui_py.egg-info/requires.txt
|
|
9
|
+
fluidityui_py.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
build>=1.5.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FluidityUILib
|