Exemple #1
0
def format_help(help):
    """Format the help string."""
    help = help.replace('Options:', str(crayons.black('Options:', bold=True)))

    help = help.replace(
        'Usage: pinax',
        str('Usage: {0}'.format(crayons.black('pinax', bold=True))))

    help = help.replace('  start', str(crayons.green('  start', bold=True)))
    help = help.replace('  apps', str(crayons.yellow('  apps', bold=True)))
    help = help.replace('  demos', str(crayons.yellow('  demos', bold=True)))
    help = help.replace('  projects',
                        str(crayons.yellow('  projects', bold=True)))
    help = help.replace('  themes', str(crayons.yellow('  themes', bold=True)))
    help = help.replace('  tools', str(crayons.yellow('  tools', bold=True)))

    additional_help = \
        """Usage Examples:
Create new project based on Pinax 'account' starter project:
$ {0}

Create new project based on development version of 'blog' starter project
$ {6}

View all Pinax starter projects:
$ {1}

View all Pinax demo projects:
$ {2}

View all Pinax apps:
$ {3}

View all Pinax tools:
$ {4}

View all Pinax themes:
$ {5}

Commands:""".format(
            crayons.red('pinax start account my_project'),
            crayons.red('pinax projects'),
            crayons.red('pinax demos'),
            crayons.red('pinax apps'),
            crayons.red('pinax tools'),
            crayons.red('pinax themes'),
            crayons.red('pinax start --dev blog my_project')
        )

    help = help.replace('Commands:', additional_help)

    return help
Exemple #2
0
def main():
    """run time code. Always indent under function"""

    # print 'red string' in red
    print(crayons.red('red string', bold=True))

    # print 'yellow string' in yellow
    print(crayons.yellow('yellow string', bold=True))

    # print 'magenta string' in magenta
    print(crayons.magenta('magenta string', bold=True))

    # print 'white string' in white
    print(crayons.white('white string', bold=True))

    # print 'black string' in black
    print(crayons.black('black string', bold=True))

    # print 'green string' in green
    print(crayons.green('green string', bold=True))

    # print 'cyan string' in cyan
    print(crayons.cyan('cyan string', bold=True))

    # print 'blue string' in blue
    print(crayons.blue('blue string', bold=True))

    # print 'Lina Do name' in Red
    print(crayons.red('Lina Do', bold=True))
Exemple #3
0
 def change_id(self, old_id, new_id):
     self.id_change_map[new_id] = old_id
     if old_id in self.unique_ids:
         if new_id in self.unique_ids:
             del self.unique_objects[self.unique_ids[new_id]]
         self.unique_ids[new_id] = self.unique_ids[old_id]
     obj = self.try_resolve_object(old_id)
     self.log_print(crayons.black("      [%s] %sis now [%s]" % (
         old_id,
         "%s " % obj.get_name() if not obj is None else "",
         new_id), bold=True))
Exemple #4
0
def print_maze():
    system('clear')
    for m in MAZE:
        out = ''.join(m)
        for c in out:
            if c != '#':
                print(crayons.black(c, bold=True), end='')
            else:
                print(crayons.white('#'), end='')
        print()

    sleep(0.015)
Exemple #5
0
def color_diff(diff):
    """Generator function returns lazy sequence of coloured diff lines"""
    for line in diff:
        if line.startswith('---') or line.startswith('+++'):
            yield str(crayons.black(line, bold=True))
        elif line.startswith('+'):
            yield str(crayons.green(line))
        elif line.startswith('-'):
            yield str(crayons.red(line))
        elif line.startswith('@@'):
            yield str(crayons.cyan(line))
        else:
            yield line
def color_chooser(color, name):
    if color == "red":
        print(crayons.red(name, bold=True))
    elif color == "green":
        print(crayons.green(name, bold=True))
    elif color == "yellow":
        print(crayons.yellow(name, bold=True))
    elif color == "blue":
        print(crayons.blue(name, bold=True))
    elif color == "black":
        print(crayons.black(name, bold=True))
    elif color == "magenta":
        print(crayons.magenta(name, bold=True))
    elif color == "cyan":
        print(crayons.cyan(name, bold=True))
    elif color == "white":
        print(crayons.white(name, bold=True))
Exemple #7
0
 def colprint(self, prefix, name, suffix, colour="white", name2=None):
     if self.verbose_errors_only and colour == "green":
         pass
     else:
         s = []
         if self.simulate:
             s.append(str(crayons.black(prefix, bold=True)))
         else:
             s.append(str(crayons.normal(prefix)))
         s.append(colour_path_str(name))
         if colour.lower() == "red":
             s.append(str(crayons.red(suffix)))
         elif colour.lower() == "yellow":
             s.append(str(crayons.yellow(suffix)))
         elif colour.lower() == "green":
             s.append(str(crayons.green(suffix)))
         else:
             s.append(str(crayons.normal(suffix)))
         if name2 is not None:
             s.append(colour_path_str(name2))
         print("".join(s))
Exemple #8
0
"""

from __future__ import absolute_import

import os
import sys
import time
import crayons

STREAM = sys.stderr
MILL_TEMPLATE = '%s %s %i/%i\r'
DOTS_CHAR = '.'
if os.name != 'nt':
    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:
    if os.name == 'nt':
        BAR_TEMPLATE = '  %s%s%s %i/%i - %s\r'
    else:
        BAR_TEMPLATE = '  %s%s%s %i/%i — %s\r'
MILL_CHARS = ['|', '/', '-', '\\']
# How long to wait before recalculating the ETA
ETA_INTERVAL = 1
# How many intervals (excluding the current one) to calculate the simple moving
# average
Exemple #9
0
def black(s, **kwargs):
    if legit_settings.allow_black_foreground:
        return crayons.black(s, **kwargs)
    else:
        return s
Exemple #10
0
    def print_game(self, player, game_map):
        border = u"\u25A0"
        b = player.get_position()
        map_size = game_map.get_size()
        spacer_lines = (self.height - (map_size[0] + 2)) // 2
        spacer_columns = (self.width - ((map_size[1] + 2) * 2)) // 2

        # Before Spacer
        self.__spacer(spacer_lines)

        # Spacer for centering map border top
        for m in range(spacer_columns):
            print(' ', end='')

        # Border On Line
        for l in range(map_size[1] + 2):
            print(crayons.blue(border), end=' ')
        print()

        for j in range(map_size[0]):

            # Spacer for centering map
            for m in range(spacer_columns):
                print(' ', end='')

            # Start border for each line
            print(crayons.blue(border), end=' ')

            # Display Map
            for k in range(map_size[1]):
                if k == b[0] and j == b[1]:
                    print(crayons.red("P"), end=' ')
                else:
                    if game_map[j][k].seen_status():
                        if not game_map[j][k].has_item('jewels'):
                            if game_map[j][k].get_color() == 'red':
                                print(crayons.red(game_map[j][k].get_icon()), end=' ')
                            elif game_map[j][k].get_color() == 'green':
                                print(crayons.green(game_map[j][k]).get_icon(), end=' ')
                            elif game_map[j][k].get_color() == 'yellow':
                                print(crayons.yellow(game_map[j][k]).get_icon(), end=' ')
                            elif game_map[j][k].get_color() == 'blue':
                                print(crayons.blue(game_map[j][k]).get_icon(), end=' ')
                            elif game_map[j][k].get_color() == 'black':
                                print(crayons.black(game_map[j][k]).get_icon(), end=' ')
                            elif game_map[j][k].get_color() == 'magenta':
                                print(crayons.magenta(game_map[j][k]).get_icon(), end=' ')
                            elif game_map[j][k].get_color() == 'cyan':
                                print(crayons.cyan(game_map[j][k]).get_icon(), end=' ')
                            elif game_map[j][k].get_color() == 'white':
                                print(crayons.white(game_map[j][k]).get_icon(), end=' ')
                            else:
                                print(crayons.green(game_map[j][k]).get_icon(), end=' ')
                        else:
                            print(crayons.cyan("J"), end=' ')
                    else:
                        if system() == "Windows":
                            print('X', end=' ')
                        else:
                            print(u"\u25A0", end=' ')

            # End border for each line
            print(crayons.blue(border))

        # Spacer for centering map border bottom
        for m in range(spacer_columns):
            print(' ', end='')

        # Border After End Line of Map
        for l in range(map_size[1] + 2):
            print(crayons.blue(border), end=' ')
        print()
        print()
        print("(Press K) Keybindings!".center(self.width - 1))
        self.__spacer(spacer_lines - 2)
        print(game_map[b[1]][b[0]].print_tile(player.inventory).center(self.width))
        self.print_stats(player)
Exemple #11
0
from __future__ import absolute_import

import os
import sys
import time
import crayons

STREAM = sys.stderr

MILL_TEMPLATE = '%s %s %i/%i\r'

DOTS_CHAR = '.'

if os.name != 'nt':
    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:
    if os.name == 'nt':
        BAR_TEMPLATE = '  %s%s%s %i/%i - %s\r'
    else:
        BAR_TEMPLATE = '  %s%s%s %i/%i — %s\r'

MILL_CHARS = ['|', '/', '-', '\\']

# How long to wait before recalculating the ETA
Exemple #12
0
def editorMain(fn):
    if options["2"] == "off":
        crayons.disable()
    with open(os.getcwd() + "/" + fn, mode="r") as filereadr:
        filecn = filereadr.read()
    linenum = 0
    filecn4 = filecn
    filecn4 = filecn4.split("\n")
    linenum = len(filecn4) + 1
    num = 0
    while True:
        linenum += 1
        os.system('printf "\e[48;5;241m \n"')
        os.system('printf "\e[8;20;46t"')
        clearScreen()
        print(genFEHdr(fn))
        filecn3 = filecn
        filecn3 = filecn3.split("\n")
        filecn2 = "1 "
        j = 0
        while j < len(filecn3):
            if str(filecn3[j]).startswith('^== '):
                filecn3[j] = str(crayons.black(filecn3[j]))
            filecn2 = filecn2 + filecn3[j] + "\n" + crayons.yellow(
                str(j + 2)) + " "
            j += 1
        filecn2 = filecn2.replace('prog', str(crayons.green("prog"))).replace(
            'print',
            str(crayons.blue("print"))).replace('eq', str(crayons.blue(
                "eq"))).replace('stop', str(crayons.yellow("stop"))).replace(
                    'debugOff', str(crayons.cyan("debugOff"))).replace(
                        'debugOn', str(crayons.cyan("debugOn"))).replace(
                            '$', str(crayons.magenta("$"))).replace(
                                '+', str(crayons.cyan("+"))).replace(
                                    '*', str(crayons.cyan("*"))).replace(
                                        '/', str(crayons.cyan("/"))).replace(
                                            '-',
                                            str(crayons.cyan("-"))).replace(
                                                'error',
                                                str(crayons.cyan("error"))
                                            ).replace(
                                                'err',
                                                str(crayons.cyan("error")))
        print("\n" + crayons.yellow(filecn2))
        c = input(crayons.yellow(str(linenum) + " "))  # Not fully implemented
        num += 1
        if num == 5:
            num = 0
            with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                filereadr.write(filecn)
        addf = True
        if c == "****exit":
            os.system('printf "\e[48;5;0m \n"')
            addf = False
            with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                filereadr.write(filecn)
            clearScreen()
            sys.exit()

        if c == "****save":
            addf = False
            with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                filereadr.write(filecn)

        if c == "****run":
            addf = False
            if options["3"] == "on":
                with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                    filereadr.write(filecn)
                ResizeList(sys.argv, 2, fill_with=0)
                sys.argv[1] = fn
                frmain()
                input("++Press enter to return to editor++")

        if c == "****options":
            addf = False
            with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                filereadr.write(filecn)
            clearScreen()
            print(
                crayons.red("░░░░ birchEditor ░ Edit Settings   ░░░░",
                            bold=True))
            print(
                crayons.red("Autosave:  " + options["1"] +
                            "                      1  !"))
            print(
                crayons.red("Color:     " + options["2"] +
                            "                      2 ok"))
            print(
                crayons.red("Run EDCMD: " + options["3"] +
                            "                      3 ok"))
            setting = input(
                crayons.yellow("change setting ['number,on/off']: "))
            setting = setting.split(',')
            options[setting[0]] = setting[1].lower()
            prefSaver()

        if c == "****jump":
            addf = False
            with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                filereadr.write(filecn)
            clearScreen()
            print(
                crayons.red("░░░░ birchEditor ░ Jump to Line    ░░░░",
                            bold=True))
            setting = input(crayons.yellow("line number: "))
            print(
                crayons.cyan("""
Function Not available:
line text processing is in beta""",
                             bold=True))
            time.sleep(2)

        # Cursor Functions
        if c == "^[[A":
            addf = False
            linenum -= 1
        if c == "^[[B":
            addf = False
            linenum += 1
        if c == "^[[D":
            addf = False
            clearScreen()
            print(crayons.yelow("Saved code"))
            with open(os.getcwd() + "/" + fn, mode="w") as filereadr:
                filereadr.write(filecn)
            time.sleep(2)

        if c == "^[[C":
            clearScreen()
            d = input(crayons.yelow("Line Text [raw]: "))
            c = d

        if addf == True:
            filecn = filecn + "\n" + c
Exemple #13
0
print('{} white {}'.format(crayons.red('red'), crayons.blue('blue')))
crayons.disable()
print('{} white {}'.format(crayons.red('red'), crayons.blue('blue')))
crayons.enable()
print('{} white {}'.format(crayons.red('red'), crayons.blue('blue')))
print(crayons.red('red string', bold=True))
print(crayons.yellow('yellow string', bold=True))
print(crayons.magenta('magenta string', bold=True))
print(crayons.white('white string', bold=True))
print(crayons.random('random color'))
print(crayons.random('random and bold', bold=True))
print(crayons.red('red'))
print(crayons.green('green'))
print(crayons.yellow('yellow'))
print(crayons.blue('blue'))
print(crayons.black('black', bold=True))

print(crayons.magenta('magenta'))
print(crayons.cyan('cyan'))
print(crayons.white('white'))
print(crayons.normal('normal'))
print(
    crayons.clean('{} clean {}'.format(crayons.red('red'),
                                       crayons.blue('blue'))))
print(red('red'))  # NOQA
print(green('green'))  # NOQA
print(yellow('yellow'))  # NOQA
print(blue('blue'))  # NOQA
print(black('black', bold=True))  # NOQA
print(magenta('magenta'))  # NOQA
print(cyan('cyan'))  # NOQA
Exemple #14
0
def black(string, **kwargs):
    return crayons.black(string)
Exemple #15
0
"""

from __future__ import absolute_import

import sys
import time

import crayons


STREAM = sys.stderr
MILL_TEMPLATE = "%s %s %i/%i\r"
DOTS_CHAR = "."

BAR_FILLED_CHAR = str(crayons.green("=", bold=True))
BAR_EMPTY_CHAR = str(crayons.black("-"))

BAR_FILLED_CHAR = str(crayons.green("â–‰", bold=True))
BAR_EMPTY_CHAR = str(crayons.black("â–‰"))

BAR_TEMPLATE = u" 📄 %s%s%s %i/%i — {0}\r".format(crayons.green("%s"))

MILL_CHARS = ["|", "/", "-", "\\"]
# How long to wait before recalculating the ETA
ETA_INTERVAL = 1
# How many intervals (excluding the current one) to calculate the simple moving
# average
ETA_SMA_WINDOW = 9


class Bar(object):
Exemple #16
0
import sys
import time
import crayons
from .environments import PIPENV_COLORBLIND, PIPENV_HIDE_EMOJIS

STREAM = sys.stderr
MILL_TEMPLATE = "%s %s %i/%i\r"
DOTS_CHAR = "."
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 = "▉"
            BAR_EMPTY_CHAR = " "
        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:
Exemple #17
0
 def colored_str(self):
     if self.owner == 1:
         return crayons.white(self.repr, bold=True)  # White is black?
     else:
         return crayons.black(self.repr, bold=True)  # Black is white?