fix sqlalchemy bug
[rainbowstream.git] / rainbowstream / draw.py
index ab50d01b3dfb0069e75260f93fa9a479f23fe8dc..148fc5884456378dfa81f376f6e8bec921510f39 100644 (file)
@@ -14,7 +14,6 @@ from .config import *
 from .db import *
 
 db = RainbowDB()
-cur_theme = None
 
 def check_theme():
     """
@@ -22,17 +21,17 @@ def check_theme():
     """
     exists = db.theme_query()
     themes = [t.theme_name for t in exists]
-    if cur_theme != themes[0]:
-        cur_theme = themes[0]
+    if c['theme'] != themes[0]:
+        c['theme'] = themes[0]
         # Determine path
-        if cur_theme == 'user':
+        if c['theme'] == 'custom':
             config = os.environ.get(
                 'HOME',
                 os.environ.get(
                 'USERPROFILE',
                 '')) + os.sep + '.rainbow_config.json'
         else:
-            config = 'rainbowstream/colorset/'+cur_theme+'.json'
+            config = 'rainbowstream/colorset/'+c['theme']+'.json'
         # Load new config
         data = load_config(config)
         if data:
@@ -305,6 +304,6 @@ def print_trends(trends):
     for topic in trends[:c['TREND_MAX']]:
         name = topic['name']
         url = topic['url']
-        line = cycle_color(name) + ': ' + color_func(TREND['url'])(url)
+        line = cycle_color(name) + ': ' + color_func(c['TREND']['url'])(url)
         printNicely(line)
     printNicely('')