diff --git a/TODO.md b/TODO.md index 1876240..d9a0eb1 100644 --- a/TODO.md +++ b/TODO.md @@ -1,13 +1,15 @@ ## TODO -- silent mode by default when doing PDF -- add nice spacing and typography for easy reading +- make - pdf options - - problem numbers [true] - - number of columns [auto] - include column labels - print -- addition -- subtraction -- mult? div? + - make it prettier + - different font, using nice fonts if they're available on someone's system + - better spacing + - [use different sized fonts for different parts](https://unix.stackexchange.com/a/500365) +- arithmetic + - addition + - subtraction + - mult? div? - hex? diff --git a/app/main.py b/app/main.py index 6b167b5..2d80f71 100755 --- a/app/main.py +++ b/app/main.py @@ -13,8 +13,8 @@ from app.pdf import make_pdf @click.option("--silent", default=False, is_flag=True) @click.option("--include-answers", default=True, is_flag=True) @click.option("--output-filepath") -@click.option("--num-columns", default=4) -@click.option("--font-size", default=12) +@click.option("--num-columns", default=1) +@click.option("--font-size", default=26) def main( bits: int, num_problems: int, @@ -22,17 +22,14 @@ def main( silent: bool = False, include_answers: bool = True, output_filepath: str = None, - num_columns: int = 4, - font_size: int = 12, + num_columns: int = 1, + font_size: int = 26, ) -> None: validate_args(pdf, silent, output_filepath) answers, problems = make_problems_and_answers(bits, num_problems) - if bits > 12: - num_columns = 3 - if pdf: silent = True make_pdf( @@ -65,8 +62,13 @@ def validate_args(pdf, silent, output_filepath): def make_problems_and_answers(bits, num_problems): problems = generate_problems(bits, num_problems) answers = generate_answers(problems) - problems_string = "\n\n".join(problems) + problems_string = "\n\n".join( + [f"{index:2}) {p} =" for index, p in enumerate(problems, start=1)] + ) answers_string = "\n\n".join( - [f"{problem} | {answer} " for problem, answer in zip(problems, answers)] + [ + f"{index:2}) {problem} = {answer}" + for index, (problem, answer) in enumerate(zip(problems, answers), start=1) + ] ) return answers_string, problems_string diff --git a/app/pdf.py b/app/pdf.py index 9dfaf16..83ddf60 100644 --- a/app/pdf.py +++ b/app/pdf.py @@ -46,9 +46,9 @@ def make_pdf_file(output_path): subprocess.call(command, shell=True) -def make_postscript_file(txt_file: str, num_columns: int, font_size: int): +def make_postscript_file(txt_file, num_columns: int, font_size: int): command = ( - f"enscript --columns={num_columns} --no-header --output={POSTSCRIPT_FILEPATH} " - f"-FCourier{font_size} {txt_file.name}" + f"enscript --columns={num_columns} --no-header --font=Courier{font_size} " + f"--output={POSTSCRIPT_FILEPATH} {txt_file.name}" ) subprocess.call(command, shell=True) diff --git a/problems-answers.pdf b/problems-answers.pdf new file mode 100644 index 0000000..7882cfe Binary files /dev/null and b/problems-answers.pdf differ diff --git a/problems.pdf b/problems.pdf new file mode 100644 index 0000000..0338e4d Binary files /dev/null and b/problems.pdf differ diff --git a/setup.py b/setup.py index 2f125e4..49dd4d4 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="binary_quiz", author="Zev Averbach", author_email="zev@averba.ch", - version="0.1.6", + version="0.1.8", license="MIT", long_description_content_type="text/markdown", description=(