projects
/
rainbowstream.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix pull request 2
[rainbowstream.git]
/
rainbowstream
/
draw.py
diff --git
a/rainbowstream/draw.py
b/rainbowstream/draw.py
index c2119ff779e03cf0ca77631991ddccf81398f0f2..27cc8746865e784f97d0bace7289831c9f734423 100644
(file)
--- a/
rainbowstream/draw.py
+++ b/
rainbowstream/draw.py
@@
-15,19
+15,28
@@
from .colors import *
from .config import *
from .db import *
from .config import *
from .db import *
-
db = RainbowDB()
db = RainbowDB()
+g = {}
+
def init_cycle():
"""
Init the cycle
"""
colors_shuffle = [globals()[i.encode('utf8')]
def init_cycle():
"""
Init the cycle
"""
colors_shuffle = [globals()[i.encode('utf8')]
- if not i.startswith('
RGB
_')
- else
RGB(int(i[4
:]))
+ if not i.startswith('
term
_')
+ else
term_color(int(i[5
:]))
for i in c['CYCLE_COLOR']]
return itertools.cycle(colors_shuffle)
for i in c['CYCLE_COLOR']]
return itertools.cycle(colors_shuffle)
-cyc = init_cycle()
+g['cyc'] = init_cycle()
+
+
+def notify_cycle():
+ """
+ Notify from rainbow
+ """
+ g['cyc'] = init_cycle()
+
def order_rainbow(s):
"""
def order_rainbow(s):
"""
@@
-64,7
+73,7
@@
def cycle_color(s):
"""
Cycle the colors_shuffle
"""
"""
Cycle the colors_shuffle
"""
- return next(
cyc
)(s)
+ return next(
g['cyc']
)(s)
def ascii_art(text):
def ascii_art(text):
@@
-73,7
+82,7
@@
def ascii_art(text):
"""
fi = figlet_format(text, font='doom')
print('\n'.join(
"""
fi = figlet_format(text, font='doom')
print('\n'.join(
- [next(
cyc
)(i) for i in fi.split('\n')]
+ [next(
g['cyc']
)(i) for i in fi.split('\n')]
))
))
@@
-92,14
+101,14
@@
def check_theme():
os.environ.get('USERPROFILE',
'')) + os.sep + '.rainbow_config.json'
else:
os.environ.get('USERPROFILE',
'')) + os.sep + '.rainbow_config.json'
else:
- config =
'rainbowstream
/colorset/'+c['theme']+'.json'
+ config =
os.path.dirname(__file__) + '
/colorset/'+c['theme']+'.json'
# Load new config
data = load_config(config)
if data:
for d in data:
c[d] = data[d]
# Re-init color cycle
# Load new config
data = load_config(config)
if data:
for d in data:
c[d] = data[d]
# Re-init color cycle
-
cyc
= init_cycle()
+
g['cyc']
= init_cycle()
def color_func(func_name):
def color_func(func_name):
@@
-107,8
+116,8
@@
def color_func(func_name):
Call color function base on name
"""
pure = func_name.encode('utf8')
Call color function base on name
"""
pure = func_name.encode('utf8')
- if pure.startswith('
RGB_') and pure[4
:].isdigit():
- return
RGB(int(pure[4
:]))
+ if pure.startswith('
term_') and pure[5
:].isdigit():
+ return
term_color(int(pure[5
:]))
return globals()[pure]
return globals()[pure]