fix bug
authorVu Nhat Minh <vunhat_minh@dwango.co.jp>
Thu, 3 Jul 2014 05:58:27 +0000 (14:58 +0900)
committerVu Nhat Minh <vunhat_minh@dwango.co.jp>
Thu, 3 Jul 2014 05:58:27 +0000 (14:58 +0900)
rainbowstream/config.py
rainbowstream/draw.py

index 828a51710a6cbfccd740274e88f9969ba7b0fee4..697361d5369adfe51bba161fa88599a9d8f23914 100644 (file)
@@ -25,10 +25,8 @@ def load_config(filepath):
             while match:
                 content = content[:match.start()] + content[match.end():]
                 match = comment_re.search(content)
-        db.theme_store('user')
         return json.loads(content)
     except IOError:
-        db.theme_store('default')
         return None
 
 # Load default colorset
@@ -38,6 +36,7 @@ data = load_config(default_config)
 if data:
     for d in data:
         c[d] = data[d]
+db.theme_store('default')
 # Load user's colorset
 rainbow_config = os.environ.get(
     'HOME',
@@ -48,3 +47,4 @@ data = load_config(rainbow_config)
 if data:
     for d in data:
         c[d] = data[d]
+    db.theme_update('user')
index ab50d01b3dfb0069e75260f93fa9a479f23fe8dc..ff931ce373c8bd2e710c49b0a8c3f5783f8d1fc2 100644 (file)
@@ -305,6 +305,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('')