Skip to content

Commit

Permalink
Worked on animations and bugs
Browse files Browse the repository at this point in the history
1) Added new animations and worked out the old ones;
2) Fixed a bug when the percentage is changed immediately before adding a Process entry;
3) Fixed a bug that occurs when the last string in the console is removed, which occupies more than 1 line.
  • Loading branch information
Nakama3942 committed Jun 17, 2023
1 parent 89aa0c0 commit 51df9d6
Show file tree
Hide file tree
Showing 4 changed files with 391 additions and 89 deletions.
16 changes: 8 additions & 8 deletions mighty_logger/powerful_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(
self._environment = log_environment
self._progress_rise = 0
self._progress_start: datetime | None = None
self._progress_time: str = " "
self._progress_time: str = " "
self._progress_interrupt = False
self.global_background = global_background
self._color_scheme_init()
Expand Down Expand Up @@ -1032,7 +1032,7 @@ def start_indefinite_process(

self._progress_start = datetime.now()
progress_stop = datetime.now()
self._progress_time = str(progress_stop - self._progress_start).split(".")[0]
self._progress_time = str(progress_stop - self._progress_start).split(".")[0] + " "
func = getattr(self, "_initiation", None)
args = {}
if status_message != StatusMessageType("..."):
Expand Down Expand Up @@ -1121,7 +1121,7 @@ def start_definite_process(

self._progress_start = datetime.now()
progress_stop = datetime.now()
self._progress_time = str(progress_stop - self._progress_start).split(".")[0]
self._progress_time = str(progress_stop - self._progress_start).split(".")[0] + " "
func = getattr(self, "_initiation", None)
args = {}
if status_message != StatusMessageType("..."):
Expand Down Expand Up @@ -1225,10 +1225,11 @@ def note_process(
:param local_background: Display entry with background?
:param local_settings: Dictionary of local entering settings
"""
sleep(0.001)
last = self._buffer.pop()

progress_stop = datetime.now()
self._progress_time = str(progress_stop - self._progress_start).split(".")[0]
self._progress_time = str(progress_stop - self._progress_start).split(".")[0] + " "
func = getattr(self, entry_type, None)
args = {}
if status_message != StatusMessageType("..."):
Expand Down Expand Up @@ -1265,10 +1266,11 @@ def stop_process(
:param local_settings: Dictionary of local entering settings
"""
self._progress_interrupt = True
sleep(0.11)
self._buffer.remove()

progress_stop = datetime.now()
self._progress_time = str(progress_stop - self._progress_start).split(".")[0]
self._progress_time = str(progress_stop - self._progress_start).split(".")[0] + " "
func = getattr(self, "_success", None) if self._progress_rise == 100 else getattr(self, "_fail", None)
args = {}
if status_message != StatusMessageType("..."):
Expand All @@ -1283,7 +1285,7 @@ def stop_process(

self._progress_rise = 0
self._progress_start = None
self._progress_time = " "
self._progress_time = " "
self._progress_interrupt = False

def _initiation(
Expand Down Expand Up @@ -1417,7 +1419,6 @@ def _success(
self._ColorScheme['SUCCESS_BACKGROUND'][local_background],
], self._progress_time, self._icon_set.success, status_message.current_status_message, "&SUCCESS", message_text, self._environment, local_settings
)
sleep(0.11)
if self._environment == LogEnvironments.CONSOLE:
self._buffer.update_console()

Expand Down Expand Up @@ -1452,6 +1453,5 @@ def _fail(
self._ColorScheme['FAIL_BACKGROUND'][local_background],
], self._progress_time, self._icon_set.fail, status_message.current_status_message, "&FAIL", message_text, self._environment, local_settings
)
sleep(0.11)
if self._environment == LogEnvironments.CONSOLE:
self._buffer.update_console()
Loading

0 comments on commit 51df9d6

Please sign in to comment.