From 33945de1eb597b0ffcd99d9d9f6d4d3a0d5e6404 Mon Sep 17 00:00:00 2001 From: Gasper Zejn Date: Fri, 20 Apr 2018 17:22:29 +0200 Subject: [PATCH] Obey both color-blind and hide-emoji flags. --- pipenv/progress.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pipenv/progress.py b/pipenv/progress.py index 14bb721f..1a0593b1 100644 --- a/pipenv/progress.py +++ b/pipenv/progress.py @@ -13,17 +13,31 @@ import os import sys import time import crayons -from .environments import PIPENV_COLORBLIND +from .environments import (PIPENV_COLORBLIND, PIPENV_HIDE_EMOJIS) STREAM = sys.stderr MILL_TEMPLATE = '%s %s %i/%i\r' DOTS_CHAR = '.' -if os.name != 'nt' and not PIPENV_COLORBLIND: - BAR_FILLED_CHAR = str(crayons.green('▉', bold=True)) - BAR_EMPTY_CHAR = str(crayons.black('▉')) +if os.name != 'nt': + if PIPENV_HIDE_EMOJIS: + if PIPENV_COLORBLIND: + BAR_FILLED_CHAR = '=' + BAR_EMPTY_CHAR = '-' + else: + BAR_FILLED_CHAR = str(crayons.green('=', bold=True)) + BAR_EMPTY_CHAR = str(crayons.black('-')) + else: + if PIPENV_COLORBLIND: + BAR_FILLED_CHAR = str(crayons.white('▉', bold=True)) + BAR_EMPTY_CHAR = str(crayons.black('▉')) + else: + BAR_FILLED_CHAR = str(crayons.green('▉', bold=True)) + BAR_EMPTY_CHAR = str(crayons.black('▉')) + else: BAR_FILLED_CHAR = '=' BAR_EMPTY_CHAR = '-' + if (sys.version_info[0] >= 3) and (os.name != 'nt'): BAR_TEMPLATE = u' %s%s%s %i/%i — {0}\r'.format(crayons.black('%s')) else: