was not used anymore

status bar can be used as a replacement, it does to flood log files as
extensively as the background thread
This commit is contained in:
Martin Diehl 2019-03-07 20:48:09 +01:00
parent 79a01ef823
commit 12587be595
1 changed files with 0 additions and 71 deletions

View File

@ -169,77 +169,6 @@ def progressBar(iteration, total, prefix='', bar_length=50):
if iteration == total: sys.stderr.write('\n') if iteration == total: sys.stderr.write('\n')
sys.stderr.flush() sys.stderr.flush()
# -----------------------------
class backgroundMessage(threading.Thread):
"""Reporting with animation to indicate progress"""
choices = {'bounce': ['_', 'o', 'O', '°', '', '', '°', 'O', 'o', '_'],
'spin': ['', '', '', ''],
'circle': ['', '', '', ''],
'hexagon': ['', ''],
'square': ['', '', '', ''],
'triangle': ['', '', '', '', '', ''],
'amoeba': ['', '', '', '', '', '', '', ''],
'beat': ['', '', '', '', '', '', '', '', '', '', ''],
'prison': ['', '', '', '', '', '', '', ''],
'breath': ['', '', '', '', '', '', '', '', ''],
'pulse': ['·', '', '', '', ''],
'ant': ['', '', '', '', '', '', '', '', '', '', '', ''],
'juggle': ['', '', '', '', '', '', '', '', ''],
# 'wobbler': ['▁', '◣', '▏', '◤', '▔', '◥', '▕', '◢'],
'grout': ['', '', '', ''],
'partner': ['', '', '', '', '', ''],
'classic': ['-', '\\', '|', '/',],
}
def __init__(self,symbol = None,wait = 0.1):
"""Sets animation symbol"""
super(backgroundMessage, self).__init__()
self._stop = threading.Event()
self.message = ''
self.new_message = ''
self.counter = 0
self.gap = ' '
self.symbols = self.choices[symbol if symbol in self.choices else random.choice(list(self.choices.keys()))]
self.waittime = wait
def __quit__(self):
"""Cleans output"""
length = len(self.symbols[self.counter] + self.gap + self.message)
sys.stderr.write(chr(8)*length + ' '*length + chr(8)*length)
sys.stderr.write('')
sys.stderr.flush()
def stop(self):
self._stop.set()
def stopped(self):
return self._stop.is_set()
def run(self):
while not threading.enumerate()[0]._Thread__stopped:
time.sleep(self.waittime)
self.update_message()
self.__quit__()
def set_message(self, new_message):
self.new_message = new_message
self.print_message()
def print_message(self):
length = len(self.symbols[self.counter] + self.gap + self.message)
sys.stderr.write(chr(8)*length + ' '*length + chr(8)*length + \
self.symbols[self.counter] + self.gap + self.new_message) # delete former and print new message
sys.stderr.flush()
self.message = self.new_message
def update_message(self):
self.counter = (self.counter + 1)%len(self.symbols)
self.print_message()
def animation(self,which = None):
return ''.join(self.choices[which]) if which in self.choices else ''
def leastsqBound(func, x0, args=(), bounds=None, Dfun=None, full_output=0, def leastsqBound(func, x0, args=(), bounds=None, Dfun=None, full_output=0,
col_deriv=0, ftol=1.49012e-8, xtol=1.49012e-8, col_deriv=0, ftol=1.49012e-8, xtol=1.49012e-8,