Skip to content

Commit

Permalink
removed animation after exit
Browse files Browse the repository at this point in the history
  • Loading branch information
bprinty committed Jan 15, 2017
1 parent 130aee0 commit a93bcf1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions animation/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,20 @@ def __init__(self, animation='elipses', text='waiting', speed=0.2):
self.animation = animation
self.text = text
self.speed = speed
self.reverser = ''.join(map(lambda x: '\b' if x != '\n' else '\033[A', self._data[0]))
return

def _animate(self):
global _waits
_waits.append(self)
self._count = 0
reverser = ''.join(map(lambda x: '\b' if x != '\n' else '\033[A', self._data[0]))

sys.stdout.write(''.join(['\n' + self.text]))
while True:
if self._count < 0:
break
if self._count != 0:
sys.stdout.write(reverser)
sys.stdout.write(self.reverser)
sys.stdout.write(self._data[self._count % len(self._data)])
sys.stdout.flush()
time.sleep(self.speed)
Expand All @@ -96,6 +97,8 @@ def stop(self):
"""
time.sleep(self.speed)
self._count = -9999
sys.stdout.write(self.reverser + '\r\033[K\033[A')
sys.stdout.flush()
return


Expand Down

0 comments on commit a93bcf1

Please sign in to comment.