Rewrite car templates as list of strings
This lets us trim all the trailing whitespace in the file automatically.
This commit is contained in:
parent
29a8ffa91e
commit
6d4e7c7914
@ -52,40 +52,42 @@ print_train = False ## print train to file (instead of the screen scroll)
|
||||
train = [""]*max_y ## empty train of correct height.
|
||||
cars = []
|
||||
|
||||
engine = r""" ____
|
||||
|____| ------------
|
||||
| | === | ------ |
|
||||
___| |__| |_____| | O | |
|
||||
| | | |__/V\_| |
|
||||
[[ | |
|
||||
| | ------------ | ~town |
|
||||
|__|______________|__________|
|
||||
//// / _\__/__\__/__\ / \
|
||||
//// \__/ \__/ \__/ \__/ """
|
||||
engine = engine.split("\n")
|
||||
engine = [
|
||||
r" ____ ",
|
||||
r" |____| ------------",
|
||||
r" | | === | ------ |",
|
||||
r" ___| |__| |_____| | O | |",
|
||||
r" | | | |__/V\_| |",
|
||||
r" [[ | |",
|
||||
r" | | ------------ | ~town |",
|
||||
r" |__|______________|__________|",
|
||||
r" //// / _\__/__\__/__\ / \ ",
|
||||
r"//// \__/ \__/ \__/ \__/ ",
|
||||
]
|
||||
|
||||
caboose = r""" ||
|
||||
============= ||
|
||||
=========| |==========
|
||||
| ---- ---- |
|
||||
| | | | | |
|
||||
| ---- ---- |
|
||||
| tilde.town railways |
|
||||
==| |==
|
||||
== - / \-/ \-----/ \-/ \ - ==
|
||||
\__/ \__/ \__/ \__/ """
|
||||
caboose = caboose.split("\n")
|
||||
|
||||
default_car = r""" ----------------------------
|
||||
| |
|
||||
| YOUR TRAIN CAR HERE! |
|
||||
| Just create a |
|
||||
| ~/.choochoo file! |
|
||||
| __ __ __ __ |
|
||||
- / \-/ \------/ \-/ \ -
|
||||
\__/ \__/ \__/ \__/"""
|
||||
default_car = default_car.split("\n")
|
||||
caboose = [
|
||||
r" || ",
|
||||
r" ============= || ",
|
||||
r"=========| |========== ",
|
||||
r" | ---- ---- | ",
|
||||
r" | | | | | | ",
|
||||
r" | ---- ---- | ",
|
||||
r" | tilde.town railways | ",
|
||||
r"==| |== ",
|
||||
r"== - / \-/ \-----/ \-/ \ - == ",
|
||||
r" \__/ \__/ \__/ \__/ ",
|
||||
]
|
||||
|
||||
default_car = [
|
||||
r" ---------------------------- ",
|
||||
r"| |",
|
||||
r"| YOUR TRAIN CAR HERE! |",
|
||||
r"| Just create a |",
|
||||
r"| ~/.choochoo file! |",
|
||||
r"| __ __ __ __ |",
|
||||
r" - / \-/ \------/ \-/ \ - ",
|
||||
r" \__/ \__/ \__/ \__/ ",
|
||||
]
|
||||
|
||||
def print_help():
|
||||
print("")
|
||||
@ -240,13 +242,13 @@ def print_all_cars():
|
||||
choochoo_list = choochoo_string.split("\n")
|
||||
if len(choochoo_list) > max_y+1:
|
||||
continue ## the train car was too tall; skip it.
|
||||
|
||||
|
||||
car = validate_car(choochoo_list) ## printing is only a DEBUG feature.
|
||||
if car != 0:
|
||||
print("")
|
||||
print(fname + ":")
|
||||
print("\n".join(car)) ## print the car to stdout
|
||||
|
||||
|
||||
## HOW TO CLOSE THE FILE HANDLE? fname.close(), close(fname), ...?
|
||||
except:
|
||||
pass;
|
||||
|
Loading…
x
Reference in New Issue
Block a user