PyAnimCLI 0.1.0__py3-none-any.whl
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.
- PyAni/__init__.py +2 -0
- PyAni/charani.py +32 -0
- PyAni/progressbar.py +65 -0
- pyanimcli-0.1.0.dist-info/METADATA +21 -0
- pyanimcli-0.1.0.dist-info/RECORD +8 -0
- pyanimcli-0.1.0.dist-info/WHEEL +5 -0
- pyanimcli-0.1.0.dist-info/licenses/LICENSE +0 -0
- pyanimcli-0.1.0.dist-info/top_level.txt +1 -0
PyAni/__init__.py
ADDED
PyAni/charani.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
import threading
|
|
4
|
+
|
|
5
|
+
class CharAni:
|
|
6
|
+
def __init__(self, sequence, looping=True, speed=0.1):
|
|
7
|
+
self.sequence = sequence
|
|
8
|
+
self.looping = looping
|
|
9
|
+
self.speed = speed
|
|
10
|
+
self._running = False
|
|
11
|
+
|
|
12
|
+
def start(self, text=""):
|
|
13
|
+
self._running = True
|
|
14
|
+
|
|
15
|
+
def run():
|
|
16
|
+
i = 0
|
|
17
|
+
while self._running:
|
|
18
|
+
char = self.sequence[i % len(self.sequence)]
|
|
19
|
+
sys.stdout.write(f"\r{text} {char}")
|
|
20
|
+
sys.stdout.flush()
|
|
21
|
+
i += 1
|
|
22
|
+
time.sleep(self.speed)
|
|
23
|
+
if not self.looping and i >= len(self.sequence):
|
|
24
|
+
break
|
|
25
|
+
|
|
26
|
+
self.thread = threading.Thread(target=run)
|
|
27
|
+
self.thread.start()
|
|
28
|
+
|
|
29
|
+
def stop(self):
|
|
30
|
+
self._running = False
|
|
31
|
+
self.thread.join()
|
|
32
|
+
print()
|
PyAni/progressbar.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
import importlib
|
|
4
|
+
|
|
5
|
+
class ProgressBar:
|
|
6
|
+
|
|
7
|
+
# ===============================
|
|
8
|
+
# š¹ ImportLib (real)
|
|
9
|
+
# ===============================
|
|
10
|
+
class ImportLib:
|
|
11
|
+
def __init__(self, speed: float, libs: list[str]):
|
|
12
|
+
self.speed = speed
|
|
13
|
+
self.libs = libs
|
|
14
|
+
self.total = len(libs)
|
|
15
|
+
|
|
16
|
+
def _draw(self, current, size=30):
|
|
17
|
+
percent = current / self.total
|
|
18
|
+
filled = int(size * percent)
|
|
19
|
+
bar = "ā" * filled + "-" * (size - filled)
|
|
20
|
+
sys.stdout.write(
|
|
21
|
+
f"\r[{bar}] {int(percent*100)}% ({current}/{self.total})"
|
|
22
|
+
)
|
|
23
|
+
sys.stdout.flush()
|
|
24
|
+
|
|
25
|
+
def start(self):
|
|
26
|
+
for i, lib in enumerate(self.libs, 1):
|
|
27
|
+
try:
|
|
28
|
+
importlib.import_module(lib)
|
|
29
|
+
time.sleep(self.speed)
|
|
30
|
+
except Exception as e:
|
|
31
|
+
sys.stdout.write(f"\nā {lib}: {e}\n")
|
|
32
|
+
self._draw(i)
|
|
33
|
+
|
|
34
|
+
print("\nā Imports concluĆdos")
|
|
35
|
+
|
|
36
|
+
# ===============================
|
|
37
|
+
# š¹ Normal (fake)
|
|
38
|
+
# ===============================
|
|
39
|
+
class Normal:
|
|
40
|
+
def __init__(self, style="block", speed=0.05):
|
|
41
|
+
self.style = style
|
|
42
|
+
self.speed = speed
|
|
43
|
+
|
|
44
|
+
self.styles = {
|
|
45
|
+
"block": ("ā", "-"),
|
|
46
|
+
"hash": ("#", "-"),
|
|
47
|
+
"line": ("=", " "),
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
def start(self, total=100):
|
|
51
|
+
fill, empty = self.styles.get(
|
|
52
|
+
self.style, self.styles["block"]
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
for i in range(total + 1):
|
|
56
|
+
percent = i / total
|
|
57
|
+
size = 30
|
|
58
|
+
filled = int(size * percent)
|
|
59
|
+
bar = fill * filled + empty * (size - filled)
|
|
60
|
+
|
|
61
|
+
sys.stdout.write(f"\r[{bar}] {int(percent*100)}%")
|
|
62
|
+
sys.stdout.flush()
|
|
63
|
+
time.sleep(self.speed)
|
|
64
|
+
|
|
65
|
+
print("\nā Finalizado")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyAnimCLI
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AnimaƧƵes de terminal em Python (progress bar, spinner, loaders)
|
|
5
|
+
Author-email: João <joao6ag@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: terminal,animation,progressbar,cli
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# PyAnim
|
|
16
|
+
|
|
17
|
+
Lib de animaƧƵes para terminal em Python.
|
|
18
|
+
|
|
19
|
+
## Instalação
|
|
20
|
+
```bash
|
|
21
|
+
pip install PyAnim
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
PyAni/__init__.py,sha256=GESfi42sE0HvazR1hAHwAEcxC0BfIwPpMUE3jyo9hO0,65
|
|
2
|
+
PyAni/charani.py,sha256=ZTpE3MvWXNaTMm08lzijLuqnK3h9e-8OfNG7IPEIto0,842
|
|
3
|
+
PyAni/progressbar.py,sha256=Q3jipWM_R_y80YcZBmoLxbcOxHl7K37qZtDb7VjE4hg,1964
|
|
4
|
+
pyanimcli-0.1.0.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
pyanimcli-0.1.0.dist-info/METADATA,sha256=r0oBP2lCsmq5stnslTnQJakOS-5n7xpKkMO3FIn_qzQ,528
|
|
6
|
+
pyanimcli-0.1.0.dist-info/WHEEL,sha256=PovZm1ExVWmrRefZoXCfejlbKLnQI5SVIf1SWRV4QQI,97
|
|
7
|
+
pyanimcli-0.1.0.dist-info/top_level.txt,sha256=vuBjBNZEgfOGSf0PAxTg2vvnbo0GPNCFUG_50Hhaflk,6
|
|
8
|
+
pyanimcli-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PyAni
|