Skip to content

Commit

Permalink
remove not working frames
Browse files Browse the repository at this point in the history
  • Loading branch information
walidsa3d committed Dec 4, 2015
1 parent 22a815e commit 9ba6c13
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 24 deletions.
10 changes: 10 additions & 0 deletions HISTORY
@@ -1,4 +1,14 @@
Changelog
=========

%%version%% (unreleased)
------------------------

- Update readme. [walid]

0.1.0 (2015-11-29)
------------------

- First working copy. [walid]


4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -23,9 +23,9 @@ $ python setup.py install

>> Spinner().spin()
>> Spinner(color='red').spin()
>> Spinner().spin(color='red')
>> Spinner(color='red', shape='clock').spin()
>> Spinner().spin(color='yellow', shape='clock')
🕐

```
Expand Down
2 changes: 1 addition & 1 deletion pirouette/__init__.py
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
__version__ = '0.1.0'
__version__ = '0.2.0'

from . import core
45 changes: 26 additions & 19 deletions pirouette/core.py
Expand Up @@ -9,44 +9,51 @@
import os
import itertools
from termcolor import colored
import sys

frames = {
'tetris': ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
'swords': ['-', '/', '\\'],
'arrows': ['>', '>>', '>>>', ''],
'circles': ['.', 'o', 'O', '°', 'O', 'o', '.'],
'stick': ['-', '/', '\\'],
#'pointer': ['>', '>>', '>>>'],
'circle': ['.', 'o', 'O', '°', 'O', 'o', '.'],
'hourglass': ['⏳', '⌛'],
'moons': ['◐', '◓', '◑', '◒'],
'moon': ['◐', '◓', '◑', '◒'],
'stack': ['▁', '▃', '▄', '▅', '▆', '▇', '█', '▇', '▆', '▅', '▄', '▃', '▁'],
'clock': ['🕛', '🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚'],
'box': ['■', '□', '▪', '▫'],
'arrows': ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],
'dots': ['.', '..', '...', '....'],
'bullets': ['◎ ◎ ◎', '◉ ◎ ◎', '◉ ◉ ◎', '◉ ◉ ◉']
'arrow': ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],
#'dot': ['.', '..', '...', '....'],
'bullet': ['◎ ◎ ◎', '◉ ◎ ◎', '◉ ◉ ◎', '◉ ◉ ◉']
}


class Spinner:

def __init__(self, duration=5, color='cyan', shape='tetris'):
self.shape = shape
self.color = color
self.duration = duration
def __init__(self):
pass

def cursor_on(self):
'''turn the cursor on'''
os.system('setterm -cursor on')

def cursor_off(self):
'''turn the cursor off'''
os.system('setterm -cursor off')

def spin(self):
shape = frames[self.shape]
def spin(self, duration=5, color='cyan', shape='tetris'):
shape = frames[shape]
frame_gen = itertools.cycle(shape)
self.cursor_off()
for _ in xrange(self.duration*10):
frame = colored(next(frame_gen), self.color)
sys.stdout.write(frame)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write('\b')
try:
for _ in xrange(duration*10):
frame = next(frame_gen)
frame = colored(frame, color)
l = len(frame)
sys.stdout.write(frame)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write('\b'*l)
except KeyboardInterrupt:
self.cursor_on()
sys.exit(0)
self.cursor_on()
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 0.2.0
commit = False
tag = False

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -10,7 +10,7 @@

setup(
name="pirouette",
version="0.1.0",
version="0.2.0",
description="loading animation for cli apps",
long_description=read_md('README.md'),
author="Walid Saad",
Expand All @@ -21,6 +21,7 @@
test_suite="tests",
license="MIT",
zip_safe=False,
install_requires=['termcolor'],
classifiers=[
# 'Development Status :: 1 - Planning',
# 'Development Status :: 2 - Pre-Alpha',
Expand Down

0 comments on commit 9ba6c13

Please sign in to comment.