iti/HandMesh
0
1# -*- coding: utf-8 -*-2 3# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>4#5# Permission to use, copy, modify, and distribute this software for any6# purpose with or without fee is hereby granted, provided that the above7# copyright notice and this permission notice appear in all copies.8#9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.16 17from __future__ import unicode_literals18from . import Infinite, Progress19 20 21class Counter(Infinite):22 def update(self):23 self.write(str(self.index))24 25 26class Countdown(Progress):27 def update(self):28 self.write(str(self.remaining))29 30 31class Stack(Progress):32 phases = (' ', '▁', '▂', '▃', '▄', '▅', '▆', '▇', '█')33 34 def update(self):35 nphases = len(self.phases)36 i = min(nphases - 1, int(self.progress * nphases))37 self.write(self.phases[i])38 39 40class Pie(Stack):41 phases = ('○', '◔', '◑', '◕', '●')42 