From ad05b92220b2fcc3be7f76c759eb7443d867553f Mon Sep 17 00:00:00 2001 From: j5155 <54331556+j5155@users.noreply.github.com> Date: Mon, 27 May 2024 18:30:40 -0800 Subject: [PATCH] include icon with pypi and pyinstaller builds --- REVHubInterface.spec | 3 ++- REVHubInterface/__main__.py | 15 ++++++++++++--- .../org.unofficialrevport.REVHubInterface.png | Bin 0 -> 2770 bytes pyproject.toml | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 REVHubInterface/org.unofficialrevport.REVHubInterface.png diff --git a/REVHubInterface.spec b/REVHubInterface.spec index b20998c..01a821d 100644 --- a/REVHubInterface.spec +++ b/REVHubInterface.spec @@ -4,13 +4,14 @@ from PyInstaller.utils.hooks import collect_data_files from setuptools_scm import get_version, _cli _cli.main(["--force-write-version-files"]) -datas = [] +datas = [('./REVHubInterface/org.unofficialrevport.REVHubInterface.png', '.')] datas += collect_data_files('sv_ttk') binaries = [] hiddenimports = [] tmp_ret = collect_all('REVHubInterface') datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] +print(datas) block_cipher = None diff --git a/REVHubInterface/__main__.py b/REVHubInterface/__main__.py index fa2672c..90e2c13 100644 --- a/REVHubInterface/__main__.py +++ b/REVHubInterface/__main__.py @@ -1133,13 +1133,22 @@ def initwindow(): from REVHubInterface._version import __version__ version = __version__ except ModuleNotFoundError: - version = "DEV BUILD" + version = "dev" xroot.title(f'REV Hub Interface - Community Edition - v{version}') + try: + from pathlib import Path + icon = PhotoImage(file=Path(__file__).with_name('org.unofficialrevport.REVHubInterface.png')) + xroot.iconphoto(False, icon) + except TclError: + print("Couldn't find bundled icon, falling back to cwd icon") + try: + icon = PhotoImage(file='org.unofficialrevport.REVHubInterface.png') + xroot.iconphoto(False, icon) + except TclError as e: + print(e) - icon = Image("photo", file="org.unofficialrevport.REVHubInterface.png") - xroot.tk.call('wm','iconphoto',xroot._w,icon) # based on https://stackoverflow.com/a/52843705 app = Application(xroot) xroot.protocol('WM_DELETE_WINDOW', app.joinThreads) diff --git a/REVHubInterface/org.unofficialrevport.REVHubInterface.png b/REVHubInterface/org.unofficialrevport.REVHubInterface.png new file mode 100644 index 0000000000000000000000000000000000000000..9592f2b70feb3587728a69cf5ccddd9f941b7395 GIT binary patch literal 2770 zcmai0X*iS(7k*~4g~o1Z@TR<$Y=bfkV_%|(tYe~KEQLfGCN!oYMA^4c);1(NGq$1d zjTx%IuQSH71h&bq+RW z{Gj8?007YKTZV>Kw{SQBkWIoTHC+Y=h;-_DUrU{_GK`FfcobnEXoMS`J}c>&__<&S zGyN^#b!0W0;wb~ep-*G|;Z{EVPP{C}yaQjx$N2A}UX%HMi?xL6goXF*&QO+U5^}P| z0|*}Piqg(D$xUy!p0VS20UmX+y_DE|MWaH#kdD4WTXSuecP>q<)D9~oP8JK}ePMT@ zNkL(dcl5lE@aD;c^ZV{jdqx_03{qQN`U~$L+3ghRaCB)WE)H845)vq$vx5EmeMuY9 zHP`8l?7RD=$^jm+@{Hup1p+*VPdYL~P)J?QN?Mj8tF^k3?Y);S``9$8&P2#rO!LR= zsTilEGEq8uK<$U%8>i6YmaFHq)F#$8I3I3*zMw0U7yj4E#lZvA#h%}y8ZOh+FTXO} zuLe#PjC{@76dBj@zdty9jorV73)km#?W(#|v{F0jFhov(x0BoQQPf4Jlf6K z%-LRo0Q$Tv|IgmWUjB8GN8(^7g|>EpXl-xj$;im4I+ql)CVle}V*y+@)|C1D`Jn@m zI9ccL{^%fXXq$nw_VFpX<9lzXw}eiASK0e4wp3njzpAldwlHw1*MgyuD+m(P3HyRj zQ&ZDGp`4}W!rsRBEp0;u1#N?af;gf2QOg2n6t;q8_YS6OLbexs?x^;9P}pz!`ArH# zqFb=au+fT#;**30G@642te(B(+vuX~?w&bWNC=4jGQj9^X$)Hbij!ZO7S^+|v9a{@ zTtuf=huwNP>E_Qzj?1ZdPWngg2)Mx2CiD4i&E0kSQQl&%fpX}IPYKTFofTQ_!I09+RxRInS=f9 z^6F}-M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FWDAN@}F87dB2 zIF`67k(!p)hHO_mF+qc|ytfd{iSMe{ESd-E`wM4bt=EJa?TKb3k+rN_zmSyCEY0)# z-v)^yxqF?y*8Sh7FNXXmn%dc@yL&k28p=U4{n&C?Pf%-{;b%*e()39UDm z#Zhd$;QjelBElJqGoOocwKDDBhbvrpf7JZo&+-ckSHJOkK14@X@QIT(OsyeI$vJMY z#}Mlh-`o*0bAXGces{j|3PoaQUwy*GIwe8qDL^+n6WqL%fat4(pTr>`sdQ;9BAqkA z@AK1T-b4=Via9z6OrcO*sx3xAop9?La;6{IdZaGLF+f#!wd-~hN9GRc6dtE!ezXE`9O42>k%)jdALLH=KRum?pOc#>W_^wOBW5@2R*X;fx_ GCI1J0WFad6 literal 0 HcmV?d00001 diff --git a/pyproject.toml b/pyproject.toml index 504a35a..55bdb8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,8 @@ Issues = "https://github.com/unofficial-rev-port/REVHubInterface/issues" dependencies = { file = ["requirements.txt"] } [tool.setuptools] packages = ["REVHubInterface"] +[tool.setuptools.package-data] +REVHubInterface = ["org.unofficialrevport.REVHubInterface.png"] [project.gui-scripts] revhubinterface = "REVHubInterface.__main__:initwindow" [tool.setuptools_scm]