Removing test with ANSIString for the moment. It might not be suited for evform due to regex handling.

This commit is contained in:
Griatch 2014-02-01 22:39:42 +01:00
parent 9b1f376117
commit c09d6eef53
3 changed files with 5 additions and 5 deletions

View file

@ -15,6 +15,7 @@ user.
""" """
import re import re
from src.utils import utils from src.utils import utils
from src.utils.utils import to_str
# ANSI definitions # ANSI definitions
@ -355,7 +356,7 @@ class ANSIString(unicode):
string to be handled as already decoded. It is important not to double string to be handled as already decoded. It is important not to double
decode strings, as escapes can only be respected once. decode strings, as escapes can only be respected once.
""" """
string = args[0] string = to_str(args[0], force_string=True)
if not isinstance(string, basestring): if not isinstance(string, basestring):
string = str(string) string = str(string)
parser = kwargs.get('parser', ANSI_PARSER) parser = kwargs.get('parser', ANSI_PARSER)

View file

@ -101,7 +101,7 @@ This produces the following result:
| |**|* | Herbalism |14 |990/1400 | | |**|* | Herbalism |14 |990/1400 |
| |* | | Smithing |9 |205/900 | | |* | | Smithing |9 |205/900 |
| | | | | |
------------------------------------------------ `----------------------------------------------´
The marked forms have been replaced with Cells of text and with The marked forms have been replaced with Cells of text and with
EvTables. The form can be updated by simply re-applying form.map() EvTables. The form can be updated by simply re-applying form.map()
@ -120,7 +120,6 @@ form will raise an error.
import re import re
import copy import copy
from src.utils.ansi import ANSIString
from src.utils.evtable import Cell, EvTable from src.utils.evtable import Cell, EvTable
from src.utils.utils import all_from_module, to_str, to_unicode from src.utils.utils import all_from_module, to_str, to_unicode
@ -371,7 +370,7 @@ class EvForm(object):
self.tablechar = tablechar[0] if len(tablechar) > 1 else tablechar self.tablechar = tablechar[0] if len(tablechar) > 1 else tablechar
# split into a list of list of lines. Form can be indexed with form[iy][ix] # split into a list of list of lines. Form can be indexed with form[iy][ix]
self.raw_form = ANSIString(datadict.get("FORM", "")).split("\n") self.raw_form = to_unicode(datadict.get("FORM", "")).split("\n")
# strip first line # strip first line
self.raw_form = self.raw_form[1:] if self.raw_form else self.raw_form self.raw_form = self.raw_form[1:] if self.raw_form else self.raw_form

View file

@ -7,7 +7,7 @@ FORMCHAR = "x"
TABLECHAR = "c" TABLECHAR = "c"
FORM = """ FORM = """
.------------------------------------------------. {c.------------------------------------------------.
| | | |
| Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx | | Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx |
| xxxxxxxxxxx | | xxxxxxxxxxx |