diff --git a/src/utils/mudform.py b/src/utils/evform.py similarity index 95% rename from src/utils/mudform.py rename to src/utils/evform.py index 50ba080a06..fb7b44e296 100644 --- a/src/utils/mudform.py +++ b/src/utils/evform.py @@ -1,7 +1,6 @@ # coding=utf-8 """ -Evform - a way to create advanced ascii forms - +Mudform - a way to create advanced ascii forms This is intended for creating advanced ascii game forms, such as a large pretty character sheet or info document. @@ -68,11 +67,11 @@ Use as follows: 7: 18, 8: 10, 9: 3}) - # create the MudTables - tableA = mudform.MudTable("HP","MV","MP", + # create the EvTables + tableA = mudform.EvTable("HP","MV","MP", table=[["**"], ["*****"], ["***"]], border="incols") - tableB = mudform.MudTable("Skill", "Value", "Exp", + tableB = mudform.EvTable("Skill", "Value", "Exp", table=[["Shooting", "Herbalism", "Smithing"], [12,14,9],["550/1200", "990/1400", "205/900"]], border="incols") @@ -105,7 +104,7 @@ This produces the following result: ------------------------------------------------ The marked forms have been replaced with Cells of text and with -MudTables. The form can be updated by simply re-applying form.map() +EvTables. The form can be updated by simply re-applying form.map() with the updated data. When working with the template ascii file, you can use form.reload() @@ -121,7 +120,8 @@ form will raise an error. import re import copy -from src.utils.mudtable import Cell, MudTable +from src.utils.ansi import evform +from src.utils.evtable import Cell, EvTable from src.utils.utils import all_from_module, to_str, to_unicode # non-valid form-identifying characters (which can thus be @@ -131,7 +131,7 @@ from src.utils.utils import all_from_module, to_str, to_unicode INVALID_FORMCHARS = r"\s\/\|\\\*\_\-\#\<\>\~\^\:\;\.\," -class MudForm(object): +class EvForm(object): """ This object is instantiated with a text file and parses it for rectangular form fields. It can then be fed a @@ -151,10 +151,10 @@ class MudForm(object): "FORM":templatestring} if this is given, filename is not read. cells - a dictionary mapping of {id:text} - tables - dictionary mapping of {id:MudTable} + tables - dictionary mapping of {id:EvTable} - other kwargs are fed as options to the Cells and MudTablets - (see mudtablet.Cell and mudtablet.MudTablet for more info). + other kwargs are fed as options to the Cells and EvTables + (see evtablet.Cell and evtable.EvTable for more info). """ self.filename = filename @@ -304,7 +304,7 @@ class MudForm(object): if table: table.reformat(width=width, height=height, **options) else: - table = MudTable(width=width, height=height, **options) + table = EvTable(width=width, height=height, **options) mapping[key] = (iyup, leftix, width, height, table) return mapping @@ -331,7 +331,7 @@ class MudForm(object): tables - a dictionary of {identifier:table} kwargs will be forwarded to tables/cells. See - mudtable.Cell and mudtable.MudTable for info. + evtable.Cell and evtable.EvTable for info. """ # clean kwargs (these cannot be overridden) diff --git a/src/utils/mudtable.py b/src/utils/evtable.py similarity index 99% rename from src/utils/mudtable.py rename to src/utils/evtable.py index 5ae264f22e..37e5285f0f 100644 --- a/src/utils/mudtable.py +++ b/src/utils/evtable.py @@ -1,7 +1,7 @@ # coding=utf-8 """ -Mudtable +EvTable This is an advanced ASCII table creator. It was inspired by prettytable but shares no code. @@ -9,7 +9,7 @@ by prettytable but shares no code. Example usage: - table = MudTable("Heading1", "Heading2", table=[[1,2,3],[4,5,6],[7,8,9]], border="cells") + table = EvTable("Heading1", "Heading2", table=[[1,2,3],[4,5,6],[7,8,9]], border="cells") table.add_column("This is long data", "This is even longer data") table.add_row("This is a single row") print table @@ -78,7 +78,7 @@ def make_iter(obj): return not hasattr(obj, '__iter__') and [obj] or obj -# Cell class (see further down for the MudTable itself) +# Cell class (see further down for the EvTable itself) class Cell(object): """ @@ -446,9 +446,9 @@ class Cell(object): return "\n".join(self.formatted) -# Main Mudtable class +# Main Evtable class -class MudTable(object): +class EvTable(object): """ Table class.