コード例 #1
0
def show(filename):
    """Show track FILENAME as PNG file.

    FILENAME is a text file following the track file's conventions.
    """
    track = Track.read(filename)
    track.show()
コード例 #2
0
def savemd(filename, filename_md, name, description):
    """Save track FILENAME as MD file."""
    track = Track.read(filename, name)
    p = Path(filename)
    if filename_md == '':
        filename_md = p.with_suffix('.md')
    track.save_md(filename_md, description)
コード例 #3
0
def delrow(filename, row):
    """Delete row ROW from track FILENAME.

    ROW is the number of the row to delete.
    """
    track = Track.read(filename)
    track.del_row(row)
    track.save_txt(filename)
コード例 #4
0
def delcol(filename, col):
    """Delete column COL from track FILENAME.

    COL is the number of the column to delete.
    """
    track = Track.read(filename)
    track.del_col(col)
    track.save_txt(filename)
コード例 #5
0
def savepng(filename, filename_png, show):
    """Save track FILENAME as PNG file."""
    track = Track.read(filename)
    p = Path(filename)
    if filename_png == '':
        filename_png = p.with_suffix('.png')
    track.save_img(filename_png)
    if show:
        track.show()
コード例 #6
0
"""
Example 2: Importation of a track and exportation to PNG and MD
"""
from line_track_designer.track import Track

if __name__ == "__main__":
    # Import the track saved in a text file
    track = Track.read('track_colors/track_colors.txt', 'Colors track')
    # Export the track as png and markdown files
    track.save_md('track_colors/track_colors.md', 'A track with colors')
コード例 #7
0
"""
Example 3: Importation, exportation and show a track
"""
from line_track_designer.track import Track

if __name__ == "__main__":
    # Import the track saved in a text file
    track = Track.read('track_cool_guy/track_cool_guy.txt', 'Cool guy track')
    # Export the track as png and markdown files
    track.save_md('track_cool_guy/track_cool_guy.md',
                  'It looks like a face...')
    # Show the track
    track.show()
コード例 #8
0
def addrow(filename):
    """Add a row to track FILENAME."""
    track = Track.read(filename)
    track.add_row()
    track.save_txt(filename)
コード例 #9
0
def addcol(filename):
    """Add a column to track FILENAME."""
    track = Track.read(filename)
    track.add_col()
    track.save_txt(filename)
コード例 #10
0
def write(filename):
    """Write track FILENAME in the command prompt."""
    track = Track.read(filename)
    click.echo(track)
    logging.info('Track writed')
コード例 #11
0
def printing(filename):
    """Print track FILENAME."""
    if click.confirm('Do you want to print the track?'):
        track = Track.read(filename)
        track.print_track()
コード例 #12
0
def rotate(filename, n):
    """Rotate track FILENAME."""
    track = Track.read(filename)
    track.rotate(n)
    track.save_txt(filename)
コード例 #13
0
"""
Example 4: Edition functions
"""
from line_track_designer.track import Track

if __name__ == "__main__":
    # Import the track saved in a text file
    track = Track.read('track_hard/track_hard.txt', 'Hard track')
    # Export the track as png and markdown files
    track.save_md('track_hard/track_hard.md', 'A very hard track')
    # Delete a row
    track.del_row(1)
    # Rotate the track
    track.rotate()
    # Show the track
    track.show()
コード例 #14
0
def track():
    return Track.read(os.path.join(path, 'track.txt'))
コード例 #15
0
def track_hard():
    return Track.read(os.path.join(path, 'track_hard.txt'))