From 703699eb7aebf070504a7b97bf813f5bd3ca22ac Mon Sep 17 00:00:00 2001 From: HDCharles <39544797+HDCharles@users.noreply.github.com> Date: Sun, 15 Aug 2021 16:15:14 -0400 Subject: [PATCH] Fixing program so it works for png files and some other small updates --- TTStoPnp.py | 32 ++++++++++++++++++---------- __pycache__/TTStoPnp.cpython-37.pyc | Bin 4426 -> 4401 bytes __pycache__/TTStoPnp.cpython-38.pyc | Bin 0 -> 4385 bytes 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 __pycache__/TTStoPnp.cpython-38.pyc diff --git a/TTStoPnp.py b/TTStoPnp.py index 005c6f8..199b648 100644 --- a/TTStoPnp.py +++ b/TTStoPnp.py @@ -1,6 +1,6 @@ #!/usr/bin/python -# make exe with: pyinstaller --onefile --icon=TTStoPnp.ico TTStoPnp.py +# make exe with: pyinstaller --onefile --noupx --icon=TTStoPnp.png TTStoPnp.py from tkinter import filedialog import tkinter as tk @@ -26,17 +26,20 @@ def useCurDir(): def selectDir(): - top.dir = tk.filedialog.askdirectory(initialdir="/", title="Select Directory",) + top.dir = tk.filedialog.askdirectory( + initialdir="/", + title="Select Directory (files not shown)", + ) # setupText() setupSelector() -def setupText(): - text.delete(1.0, tk.END) - text.insert(tk.INSERT, "dir: " + top.dir) - text.pack() +# def setupText(): +# text.delete(1.0, tk.END) +# text.insert(tk.INSERT, "dir: " + top.dir) +# text.pack() - # setupSelector() +# setupSelector() def getImages(): @@ -77,8 +80,12 @@ def nextCardLocation(cardCol, cardRow): cardCol = 0 cardRow = 0 count = 0 + imgData = numpy.asarray(image) - page = numpy.ones((cardHeight * 3 + 2, cardWidth * 3 + 2, 3)) * 255 + imageChannels = imgData.shape[2] + + page = numpy.ones((cardHeight * 3 + 2, cardWidth * 3 + 2, imageChannels)) * 255 + for i in range(rows): for j in range(cols): @@ -87,7 +94,7 @@ def nextCardLocation(cardCol, cardRow): j * cardWidth : (j + 1) * cardWidth, :, ] - if card.sum() > 0: + if card[:, :, :3].sum() > 0: page[ cardRow * (cardHeight + 1) : cardRow * (cardHeight + 1) + cardHeight, @@ -103,7 +110,10 @@ def nextCardLocation(cardCol, cardRow): os.path.join(directory, "sep" + str(count) + "-" + filename) ) count += 1 - page = numpy.ones((cardHeight * 3 + 2, cardWidth * 3 + 2, 3)) * 255 + page = ( + numpy.ones((cardHeight * 3 + 2, cardWidth * 3 + 2, imageChannels)) + * 255 + ) return count @@ -155,7 +165,7 @@ def setupSelector(): text="Help", command=lambda: tk.messagebox.showinfo( "Instructions", - "1) Select your desired directory\n2) Input each image's card dimensions\n3) Leave 0,0 for images you wish to ignore \nNote: images with names that start with 'sep' are ignored", + "1) Select your desired directory\n2) Input each image's card dimensions (usually 7, 10 for TTS)\n3) Leave 0,0 for images you wish to ignore\n4) Separate Images\nNote: images with names that start with 'sep' are ignored", ), ) sep.pack(in_=comButtons, side=tk.LEFT) diff --git a/__pycache__/TTStoPnp.cpython-37.pyc b/__pycache__/TTStoPnp.cpython-37.pyc index 93ffc33a5bd147e5f239cb28ce8cbb402c79810f..f25d09a6a40c11611e59bdb6d9bbe9c9249fd071 100644 GIT binary patch delta 429 zcmX|;&q~8U5XLi2)259{T2U;bs8PgoO;tI?<%Xb5?+?5_cdVKuP5JVh1eeKj~wQJsqU zU`#0c$Q_MP|6gtgU72cb$o5&`1~kCwrroY$cUh{dQOL`-?o9<(03vA1acs(;FoV_5 z2)07Kujk1hghxU2S$u5-S@d4TM&t1TTAOUHTg&xwh3)qop(Q7uSg zR`0{47FO!4_nU=4vR+zK0XA7FCS@6UKu5R2JbPk6a`>g64Rm%%bI(7bEtw>DQs}%$ NGU!AeA%Vlu$sYjcY4iX9 delta 470 zcmYL`Jxjwt7{~J@O`0|)X^Ub8-&#bhIQX^*T1C_fMNuk(h(a}jMy>J~QQ@kft3%^8iV5 z^{l2I;C9)kEBzgY=s1>k5@2Z)U_m1|atb2QA?wf!SO_0teE0T79)2n^ZQV_8yAbzZ_PGf0r^ZPnnCO2^l{S;01d;z(eZPWk& diff --git a/__pycache__/TTStoPnp.cpython-38.pyc b/__pycache__/TTStoPnp.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43bcb7fdf1d1e2f3de34c333568d69dbaf7e809a GIT binary patch literal 4385 zcmb7H&2JmW6`z^?;BrM$AEqtIcARaR)@ES4c3Z%%VFYdDxOS_mLhK-@phVbk))Xmn zm!2KQ7Q4Ju&e28AJrraQ1#;?t(M#_=?6oJKdrOhHzc))#veTj{iJf`#=5yct-tWEr zuv+yQet&4LhkrZG*gvRo^5>xOQ#@&(GbWkjUDo3}oRciNY)7EBptE)?qqDnq&)IRN z{qBxy#+7zTruKHcNQ}!9w&O?sctJW7TFI5AXKbe;Jy}LwmA+g+U6U1AMZG9%auM~C zT$0PEm$AZ1b95Bd+HZq(F?`jV*%7BR(FzuCC8`(YZXbho)5s_yO`mGp6>;LB=H)>eZ4A_%wmL%xw^1oJXKQEno(+5JEB=GwTgBT1SlztTVQ`7;n+9>B zgLFT65;qzm_uFw>!{lTHN4Ir1YPh-32a3#@SHkoFJ;i)ghDwnqsRb(LCMu*VO(>_v zgxHf#nHsm_E*D&U<2j0M=9Tv%$D_x*R|f*U*NC;)h-)#nGB)9N*vG#Z32l!Z$ult# z=`|w@l2zTvmeJR>=(yuj#;7&2v^Oqi)`XAjjE{Zj;DnFs8P{xYfzSXe4NF(w*}dA2 zTf-^|oqqJ&YnQK&T0{4fH0ob{r%^fa$|amGFLm3gCQ}I&14IZWC}fF%jr1A6t_QlzVg~F_1DHwoOYpX2uEo7N!MgjSr+(Ff%=i zg2A*luL=L9;CO`pjj(C}P=%}Sptnh;o&Cu6bREXjeM;>H1vyEJq*2u@RfTuFMmQgjUc5G>{vr!E?C-bCJXVP9}S$Qti9^nF{TW6z1 z?Pk^yF7pfi@x9R!TK2ScbF`dQv!%?dvusJ0Fdx$AB3sVN&@3Abq|b?iQ9iP;<4U$t zwC1H#^o&arF!h1`1y|Rym25Fvz`3v{RyvlvRa)Q2Ig6fSsZ2e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