diff --git a/.gitignore b/.gitignore index c7445a1..270b299 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.txt *.pdf *.pyc -*.zip \ No newline at end of file +*.zip +/.idea/ +/table.tex diff --git a/file_ops.py b/file_ops.py index cf7b013..895e898 100644 --- a/file_ops.py +++ b/file_ops.py @@ -23,7 +23,7 @@ def read_word_list(filename, min_length=2, min_different_letters=2): return words -def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=False, words=[]): +def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=True, words=[]): """ This function receives the generated grid and writes it to the file (or to the screen, if that's what we want). The grid is expected to be a list of lists, as used by the remaining functions. @@ -42,6 +42,7 @@ def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=F texfile.write(r"\usepackage{graphicx}" + "\n") texfile.write("\n") texfile.write(r"\begin{document}" + "\n") + texfile.write(r"\includegraphics[height=1.5cm]{logo}" + "\n") texfile.write(r"\section*{Mots-croisés thématique}" + "\n") # Resize box @@ -73,7 +74,7 @@ def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=F if words: texfile.write(r"\section*{Mots utilisés dans ce mots-croisés}" + "\n") # Write in several columns - texfile.write(r"\begin{multicols}{4}" + "\n") + texfile.write(r"\begin{multicols}{6}" + "\n") texfile.write(r"\noindent" + "\n") # Sort words by size words.sort(key=lambda word: (len(word), word[0])) @@ -127,6 +128,9 @@ def write_grid_to_file(grid, out_file="table.tex", out_pdf="out.pdf", keep_tex=F # Copy the latex source to the temporary directory shutil.copy(out_file, tmpdir) + # Copy logo to the temporary directory + shutil.copy("logo.png", tmpdir) + # Move to the temp directory os.chdir(tmpdir) diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..4a9b5f3 Binary files /dev/null and b/logo.png differ