nercone-modern 1.9.0__py3-none-any.whl → 1.10.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.
nercone_modern/progressbar.py
CHANGED
|
@@ -16,17 +16,20 @@ class ModernProgressBar:
|
|
|
16
16
|
_last_rendered = False
|
|
17
17
|
_lock = threading.RLock()
|
|
18
18
|
|
|
19
|
-
def __init__(self, total: int, process_name: str, spinner_mode: bool = False, primary_color: str = "blue", secondary_color: str = "white", box_color: str = "white", box_left: str = "[", box_right: str = "]",
|
|
19
|
+
def __init__(self, total: int, process_name: str, spinner_mode: bool = False, primary_bar: str = "-", secondary_bar: str = "-", centor_bar: str = "-", primary_color: str = "blue", secondary_color: str = "white", box_color: str = "white", box_left: str = "[", box_right: str = "]", show_vertical_bar: bool = True, vertical_bar_color: str = "blue"):
|
|
20
20
|
self.total = total
|
|
21
21
|
self.process_name = process_name.strip()
|
|
22
22
|
self.spinner_mode = spinner_mode
|
|
23
|
+
self.primary_bar = primary_bar
|
|
24
|
+
self.secondary_bar = secondary_bar
|
|
25
|
+
self.centor_bar = centor_bar
|
|
23
26
|
self.primary_color = primary_color
|
|
24
27
|
self.secondary_color = secondary_color
|
|
25
28
|
self.box_color = box_color
|
|
26
29
|
self.box_left = box_left
|
|
27
30
|
self.box_right = box_right
|
|
28
|
-
self.
|
|
29
|
-
self.
|
|
31
|
+
self.show_vertical_bar = show_vertical_bar
|
|
32
|
+
self.vertical_bar_color = vertical_bar_color
|
|
30
33
|
self.current = 0
|
|
31
34
|
self.index = len(ModernProgressBar._active_bars)
|
|
32
35
|
ModernProgressBar._active_bars.append(self)
|
|
@@ -146,8 +149,8 @@ class ModernProgressBar:
|
|
|
146
149
|
if self.spinner_mode:
|
|
147
150
|
status = f"{self.box_left}{' ' * total_width}/{' ' * total_width}{self.box_right} "
|
|
148
151
|
else:
|
|
149
|
-
status = f"{self.box_left}{self.current:>{total_width}}/{self.total}{self.box_right} "
|
|
150
|
-
line = f"{ModernColor.color(self.
|
|
152
|
+
status = f"{self.box_left}{self.current:>{total_width}}/{self.total:>{total_width}}{self.box_right} "
|
|
153
|
+
line = f"{ModernColor.color(self.vertical_bar_color)}{'| ' if self.show_vertical_bar else ''}{ModernColor.color('reset')}{ModernColor.color(self.box_color)}{self.box_left}{ModernColor.color('reset')}{ModernColor.color('gray')}{bar}{ModernColor.color('reset')}{ModernColor.color(self.box_color)}{self.box_right}{ModernColor.color('reset')} {ModernColor.color(self.primary_color)}{proc_name}{ModernColor.color('reset')} {percentage_alt if self.spinner_mode else percentage} {status}{ModernColor.color(self.primary_color)}|{ModernColor.color('reset')} {self.message}"
|
|
151
154
|
total_move_up = self.log_lines + (len(ModernProgressBar._active_bars) - self.index)
|
|
152
155
|
if total_move_up > 0:
|
|
153
156
|
sys.stdout.write(f"\033[{total_move_up}A")
|
|
@@ -163,16 +166,14 @@ class ModernProgressBar:
|
|
|
163
166
|
def _progress_bar(self, progress: int, advance_spinner: bool = True):
|
|
164
167
|
bar_length = 20
|
|
165
168
|
if not self._should_spin():
|
|
166
|
-
empty_bar = "-"
|
|
167
169
|
if self.current == self.total:
|
|
168
170
|
center_bar = ""
|
|
169
171
|
else:
|
|
170
|
-
center_bar =
|
|
171
|
-
filled_bar = "-"
|
|
172
|
+
center_bar = self.centor_bar
|
|
172
173
|
if self.current <= 0 and not self._spinner_ready:
|
|
173
|
-
return f"{ModernColor.color('gray')}{
|
|
174
|
+
return f"{ModernColor.color('gray')}{self.secondary_bar * (bar_length + 1)}"
|
|
174
175
|
filled_length = int(progress * bar_length) + 1
|
|
175
|
-
return f"{ModernColor.color(self.primary_color)}{
|
|
176
|
+
return f"{ModernColor.color(self.primary_color)}{self.primary_bar * filled_length}{ModernColor.color(self.secondary_color)}{center_bar}{ModernColor.color('gray')}{self.secondary_bar * (bar_length - filled_length)}"
|
|
176
177
|
else:
|
|
177
178
|
if self.current <= 0 and not self._spinner_ready:
|
|
178
179
|
return f"{ModernColor.color('gray')}{'-' * (bar_length + 1)}"
|
|
@@ -2,8 +2,8 @@ nercone_modern/__init__.py,sha256=ArF3T8FdWIhwGcL4MfYcHqMse3n5gjuyzbLNlcqRcxs,44
|
|
|
2
2
|
nercone_modern/__main__.py,sha256=tiCwzvs4N0J9_vFoA7eaQqkSIhVcDxUQ9uLPNeSQVWo,2475
|
|
3
3
|
nercone_modern/color.py,sha256=e2P9WXeGosHLCAasdE7IQW29GPZOVDMLsUCsLj6hBkM,1268
|
|
4
4
|
nercone_modern/logging.py,sha256=61ixjR37-ewS1RUwnNZnkNGQEBazhiSJJv5g-rLq834,10158
|
|
5
|
-
nercone_modern/progressbar.py,sha256=
|
|
5
|
+
nercone_modern/progressbar.py,sha256=KO4HgYrLYl1Dv8IX_xH-cNdrr2Y6uK3JwZzp73sAamM,8973
|
|
6
6
|
nercone_modern/text.py,sha256=eGxGQOJ3b-783ocLibkG62cOcYD4HLG_3diA52tU8jI,1031
|
|
7
|
-
nercone_modern-1.
|
|
8
|
-
nercone_modern-1.
|
|
9
|
-
nercone_modern-1.
|
|
7
|
+
nercone_modern-1.10.0.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
|
|
8
|
+
nercone_modern-1.10.0.dist-info/METADATA,sha256=gqH_2-eNbvxSjzoB9h-47q9DSyc_ptQqX3OuQkPAqKI,6128
|
|
9
|
+
nercone_modern-1.10.0.dist-info/RECORD,,
|