Giter Club home page Giter Club logo

pycard's Introduction

PyCard

Un-opinionated card game prototyping engine

Generate printable cards for prototyping using csv, html, css.

  • Card data stored in csv file (delimiter can be specified)
  • Html jinja2 templating
  • CSS for styling

Only tested in Python 3.6

works on python 3.6

works on windows

works on osx/mac

works on linux

Quick Start

git clone https://github.com/ghostsquad/pycard.git
cd pycard
pip install -r requirements.txt
python pycard.py -p ./examples -d "|"

OR

docker run -p 8800:80 ghostsquad/pycard pycard -p ./examples -d "|"

Running the Docker container with your own data (comma separated csv)

docker run -p80 -v /path/to/your/card_files:/data ghostsquad/pycard pycard -p /data -d ","

Example output

$ python pycard.py examples
[I 171010 19:30:34 server:283] Serving on http://127.0.0.1:8800
2017-10-10 19:30:34 - Serving on http://127.0.0.1:8800
[I 171010 19:30:34 handlers:60] Start watching changes
2017-10-10 19:30:34 - Start watching changes
[I 171010 19:30:34 handlers:62] Start detecting changes
2017-10-10 19:30:34 - Start detecting changes
2017-10-10 19:30:34 - Created file: examples/index.html
2017-10-10 19:30:34 - Modified directory: examples

Navigate to localhost:8800 to see your cards. This page will automatically refresh anytime changes are made.

You can also run python pycard.py --help for a list of options.

See examples directory to setup your files

Explanation

Files Explained

These files should be in the directory specified by -p or --path option

- Important
index.html file is created/overwritten in the assets path!

Note: You can change the prefix with the -x or --prefix commandline option. Default is _card.

  • _card.csv - [Required] is your data. Column names become variables to be used in _card.html.jinja2

    • num_cards is a special column name. You can use this to indicate how many copies of a particular card will be rendered.

      When this column is missing or has a non-numeric value, it defaults to 1 card. Using 0 is the column will cause the card not to be rendered. This is useful if you have a card idea, but aren't ready yet to print it for prototyping.

    • ignore is a special column name. You can use this to prevent a row from being rendered. I've found this useful to ignore the row with card count sums.

  • _card.css - [Required] is your styling. This will be automatically loaded. As your cards will be printed, be careful to use physical units (mm, pt...) instead of pixels to define dimensions.

  • _card.html.jinja2 - [Required] will be your html template. See Jinja Documentation for details.

    • column headers are variables
    • __card_data is injected as a dictionary (usage: {{ __card_data['foo'] }} is the same as {{ foo }}
    • __time is injected to provide a way of preventing images from being cached. (usage: my_image.png?{{ __time }}
  • _card.header.html - [Optional] Add custom header to the final index.html file.

The page found at localhost:8800 is now printable!

image

Credits

Inspired by https://github.com/vaemendis/hccd

pycard's People

Contributors

ghostsquad avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.