From 687567eb4bf93d6a1ea8ab2bb51b7a8a12a003c7 Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Wed, 16 Jul 2014 12:54:02 +0900 Subject: [PATCH] add option to ascii art and default config load --- README.rst | 2 +- docs/index.rst | 2 +- rainbowstream/colorset/config | 2 ++ rainbowstream/config.py | 10 ++++++++++ rainbowstream/rainbow.py | 4 +--- setup.py | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 3736626..6ec76fe 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,7 @@ Terminal-based Twitter Client. Realtime tweetstream, compose, search , favorite … and much more fun directly from terminal. This package is built on the top of `Python Twitter Tool`_ and `Twitter API`_, -can run on Python 2.7.x and 3.4.x . +can run on Python 2.7.x and 3.x . Showcase diff --git a/docs/index.rst b/docs/index.rst index 1015a51..db45272 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,7 @@ Terminal-based Twitter Client. Realtime tweetstream, compose, search , favorite … and much more fun directly from terminal. This package is built on the top of `Python Twitter Tool`_ and `Twitter API`_, -can run on Python 2.7.x and 3.4.x . +can run on Python 2.7.x and 3.x . Install ------- diff --git a/rainbowstream/colorset/config b/rainbowstream/colorset/config index 21ff30f..4c4c31e 100644 --- a/rainbowstream/colorset/config +++ b/rainbowstream/colorset/config @@ -1,6 +1,8 @@ { // Themes "THEME" : "monokai", + // Ascii Art + "ASCII_ART" : true, // 'search': max search record "SEARCH_MAX_RECORD" : 5, // 'home': default number of home's tweets diff --git a/rainbowstream/config.py b/rainbowstream/config.py index de15655..6aad12c 100644 --- a/rainbowstream/config.py +++ b/rainbowstream/config.py @@ -25,6 +25,16 @@ def load_config(filepath): # Config dictionary c = {} +# Load the initial config +config = os.path.dirname( + __file__) + '/colorset/config' +try: + data = load_config(config) + for d in data: + c[d] = data[d] +except: + pass + # Load user's config rainbow_config = os.environ.get( 'HOME', diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index 5ce703a..f543b35 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -141,7 +141,6 @@ def get_decorated_name(): name = '@' + t.account.verify_credentials()['screen_name'] g['original_name'] = name[1:] g['decorated_name'] = color_func(c['DECORATED_NAME'])('[' + name + ']: ') - g['ascii_art'] = True files = os.listdir(os.path.dirname(__file__) + '/colorset') themes = [f.split('.')[0] for f in files if f.split('.')[-1] == 'json'] @@ -207,7 +206,6 @@ def switch(): if args.ignore: printNicely(red('Ignore: ' + str(args.ignore))) printNicely('') - g['ascii_art'] = True except: printNicely(red('Sorry I can\'t understand.')) @@ -1610,7 +1608,7 @@ def stream(domain, args, name='Rainbow Stream'): c['PUBLIC_DOMAIN']: args.track_keywords, c['SITE_DOMAIN']: name, } - if g['ascii_art']: + if c['ASCII_ART']: ascii_art(art_dict[domain]) # These arguments are optional: diff --git a/setup.py b/setup.py index 1448f17..f90a549 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import os, sys # Bumped version -version = '0.3.7' +version = '0.3.8' # Require install_requires = [ @@ -39,6 +39,8 @@ setup(name='rainbowstream', "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.2", + "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Utilities", -- 2.25.1