You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
603 B
22 lines
603 B
8 years ago
|
import itertools
|
||
|
import math
|
||
|
def create_bars(volume):
|
||
|
num_bars=float(volume)/9000.0
|
||
|
return ('/'*math.floor(num_bars))+partial_bar(num_bars-math.floor(num_bars))+(' '*(10-math.ceil(num_bars)))
|
||
|
|
||
|
def partial_bar(bar_size):
|
||
|
if bar_size == 0.0:
|
||
|
return ''
|
||
|
elif bar_size < 0.3:
|
||
|
return ' '
|
||
|
elif bar_size < 0.6:
|
||
|
return '.'
|
||
|
elif bar_size < 0.9:
|
||
|
return '-'
|
||
|
return '/'
|
||
|
|
||
|
def action_bars(bars, control_pipe_name):
|
||
|
return ''.join(['<action=`bash -c "echo ='+str(i+1)+' > '+control_pipe_name+'"`>'+c+'</action>' for i,c in zip(range(len(bars)), bars)])
|
||
|
|
||
|
|