From 063f6bb11be986560d2048c42f8fb5f54683490f Mon Sep 17 00:00:00 2001 From: vunhat_minh Date: Thu, 30 Oct 2014 13:38:50 +0900 Subject: [PATCH] bumped version --- docs/conf.py | 4 ++-- docs/index.rst | 8 ++++---- rainbowstream/colorset/config | 2 +- rainbowstream/rainbow.py | 15 +++++++++------ rainbowstream/util.py | 21 +++++++++++++++------ setup.py | 2 +- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 03182df..59e330a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,9 +48,9 @@ copyright = u'2014, Vu Nhat Minh' # built documents. # # The short X.Y version. -version = '1.2.0' +version = '1.2.1' # The full version, including alpha/beta/rc tags. -release = '1.2.0' +release = '1.2.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/index.rst b/docs/index.rst index 9dd732e..297af6f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -325,10 +325,10 @@ You also can view or set a new value of every config key by ``config`` command ( - ``PREFIX``: display formated string of prompt. - + ``#me``: Your username with '@' - + ``#place``: Current list name or public for public stream - + ``#owner``: Owner of the current list - + ``#keyword``: Keyword for a public stream + + ``#me``: Your username with '@', only available in personal stream. + + ``#place``: List name, only available in list stream. + + ``#owner``: Owner of list name, only available in list stream. + + ``#keyword``: Keyword, only available on public stream. - ``SEARCH_TYPE``: search type in 'search' command ('mixed','recent','popular'). diff --git a/rainbowstream/colorset/config b/rainbowstream/colorset/config index 31e6294..bae4eb7 100644 --- a/rainbowstream/colorset/config +++ b/rainbowstream/colorset/config @@ -10,7 +10,7 @@ // Hide promt when receive a tweet "HIDE_PROMPT" : true, // Prefix - "PREFIX" : "", + "PREFIX" : "#owner#place#me#keyword", // 'search': search type ('mixed','recent','popular') "SEARCH_TYPE" : "mixed", // 'search': search max result, number over 100 will fallback to 100 diff --git a/rainbowstream/rainbow.py b/rainbowstream/rainbow.py index fe14401..41b581f 100644 --- a/rainbowstream/rainbow.py +++ b/rainbowstream/rainbow.py @@ -202,8 +202,6 @@ def init(args): credential = t.account.verify_credentials() screen_name = '@' + credential['screen_name'] name = credential['name'] - if not get_config('PREFIX'): - set_config('PREFIX', screen_name) c['original_name'] = g['original_name'] = screen_name[1:] g['listname'] = g['keyword'] = '' g['PREFIX'] = u2str(emojize(format_prefix())) @@ -1248,7 +1246,7 @@ def switch(): g['keyword'] = keyword g['listname'] = '' # Reset prefix - g['PREFIX'] = u2str(emojize(format_prefix(keyword = g['keyword']))) + g['PREFIX'] = u2str(emojize(format_prefix(keyword=g['keyword']))) # Start new thread th = threading.Thread( target=stream, @@ -1279,11 +1277,13 @@ def switch(): owner, slug = get_slug() # Force python 2 not redraw readline buffer listname = '/'.join([owner, slug]) - # Set the listname variable + # Set the listname variable # and reset tracked keyword g['listname'] = listname g['keyword'] = '' - g['PREFIX'] = g['cmd'] = u2str(emojize(format_prefix(listname = g['listname']))) + g['PREFIX'] = g['cmd'] = u2str(emojize(format_prefix( + listname=g['listname'] + ))) printNicely(light_yellow('getting list members ...')) # Get members t = Twitter(auth=authen()) @@ -1420,7 +1420,10 @@ def config(): g['decorated_name'] = lambda x: color_func( c['DECORATED_NAME'])('[' + x + ']: ') elif key == 'PREFIX': - g['PREFIX'] = u2str(emojize(format_prefix(listname = g['listname'], keyword = g['keyword']))) + g['PREFIX'] = u2str(emojize(format_prefix( + listname=g['listname'], + keyword=g['keyword'] + ))) reload_config() printNicely(green('Updated successfully.')) except: diff --git a/rainbowstream/util.py b/rainbowstream/util.py index 8a33711..38c1f42 100644 --- a/rainbowstream/util.py +++ b/rainbowstream/util.py @@ -21,20 +21,29 @@ def detail_twitter_error(twitterException): printNicely(yellow(info)) -def format_prefix(listname = '', keyword = ''): +def format_prefix(listname='', keyword=''): """ Format the custom prefix """ formattedPrefix = c['PREFIX'] owner = '@' + c['original_name'] place = '' + # Public stream if keyword: - place = '/public' - keyword = '#' + keyword - - if listname: + formattedPrefix = ''.join(formattedPrefix.split('#owner')) + formattedPrefix = ''.join(formattedPrefix.split('#place')) + formattedPrefix = ''.join(formattedPrefix.split('#me')) + # List stream + elif listname: + formattedPrefix = ''.join(formattedPrefix.split('#keyword')) + formattedPrefix = ''.join(formattedPrefix.split('#me')) owner, place = listname.split('/') - place = "/" + place + place = '/' + place + # Personal stream + else: + formattedPrefix = ''.join(formattedPrefix.split('#keyword')) + formattedPrefix = ''.join(formattedPrefix.split('#owner')) + formattedPrefix = ''.join(formattedPrefix.split('#place')) formattedPrefix = formattedPrefix.replace("#owner", owner) formattedPrefix = formattedPrefix.replace("#place", place) diff --git a/setup.py b/setup.py index ed0362c..b9c46ae 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os import os.path # Bumped version -version = '1.2.0' +version = '1.2.1' # Require install_requires = [ -- 2.25.1