breakline -> linebreak

This commit is contained in:
Gabriel Falcão 2010-04-19 14:59:11 -03:00
parent f69d24abee
commit b131da3dab
3 changed files with 11 additions and 11 deletions

View File

@ -41,7 +41,7 @@ couleur can overwrite output, so that you can make things like printing progress
import time
import couleur
shell = couleur.Shell(breakline=True, bold=True)
shell = couleur.Shell(linebreak=True, bold=True)
for num in range(101):
if num == 0:
@ -86,7 +86,7 @@ Example chaining modifiers:
import couleur
shell = couleur.Shell(breakline=True)
shell = couleur.Shell(linebreak=True)
shell.bold_italic_underline_yellow_on_black_and_italic_black_on_white("WOO| HOO")
## free software

View File

@ -86,10 +86,10 @@ _sep1 = '_on_'
_sep2 = '_and_'
class Shell(object):
def __init__(self, indent=2, breakline=False, bold=False):
def __init__(self, indent=2, linebreak=False, bold=False):
self._indentation_factor = indent
self._indent = 0
self._breakline = breakline
self._linebreak = linebreak
self._bold = bold
self._in_format = False
@ -118,7 +118,7 @@ class Shell(object):
if self._indent:
parts.insert(0, ' ' * self._indent)
if self._breakline:
if self._linebreak:
parts.append("\n")
string = "".join(parts)
@ -151,7 +151,7 @@ class Shell(object):
for part, output in zip(parts, printers):
output(part.replace(unique, "|"))
if self._breakline:
if self._linebreak:
sys.stdout.write("\n")
self._in_format = False

View File

@ -86,7 +86,7 @@ def test_mixed_output_with_backgrounds():
@with_setup(prepare_stdout)
def test_indent():
"indentation"
sh = Shell(indent=4, breakline=True)
sh = Shell(indent=4, linebreak=True)
sh.normal_on_blue("Hello")
sh.indent()
sh.normal_on_red("World")
@ -95,7 +95,7 @@ def test_indent():
@with_setup(prepare_stdout)
def test_dedent():
"de-indentation"
sh = Shell(indent=4, breakline=True)
sh = Shell(indent=4, linebreak=True)
sh.indent()
sh.normal_on_blue("Hello")
sh.dedent()
@ -129,8 +129,8 @@ def test_update_shell():
@with_setup(prepare_stdout)
def test_update_shell_mixed_with_linebreak():
"updating the shell with mixed output and breakline enabled"
sh = Shell(breakline=True)
"updating the shell with mixed output and linebreak enabled"
sh = Shell(linebreak=True)
sh.yellow("Yellow")
sh.yellow_and_normal_and_red("Yellow| and |Red", True)
sh.green("Green")
@ -139,7 +139,7 @@ def test_update_shell_mixed_with_linebreak():
@with_setup(prepare_stdout)
def test_update_shell_mixed_with_indentation():
"updating the shell with mixed output and indentation"
sh = Shell(breakline=True)
sh = Shell(linebreak=True)
sh.yellow("Yellow")
sh.indent()
sh.yellow_and_normal_and_red("Yellow| and |Red", True)