Skip to content

Commit

Permalink
Try using .icns file for GUI icon on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinW80 committed Oct 16, 2019
1 parent 74e8c61 commit b506b45
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Binary file added docs/images/logo-black-white.icns
Binary file not shown.
28 changes: 27 additions & 1 deletion doorstop/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,35 @@ def run(args, cwd, error):
root._w,
tk.PhotoImage(data=resources.b64_doorstopicon_png),
)

elif _platform == "darwin":
# macOS
pass # TODO
from doorstop.gui import resources
import base64
import tempfile

try:
with tempfile.TemporaryFile(
mode='w+b', suffix=".icns"
) as theTempIconFile:
theTempIconFile.write(
base64.b64decode(resources.b64_doorstopicon_icns)
)
theTempIconFile.flush()

# BUG: The GUI launches but the icon is a blank document.
root.iconbitmap(theTempIconFile.name)

# BUG: The GUI launches but the icon is absent.
# img = tk.Image("photo", file="docs/images/logo-black-white.gif")
# root.iconphoto(True, img)

finally:
try:
os.unlink(theTempIconFile.name)
except Exception: # pylint: disable=W0703
pass

elif _platform in ("win32", "win64"):
# Windows
from doorstop.gui import resources
Expand Down
3 changes: 3 additions & 0 deletions doorstop/gui/resources.py

Large diffs are not rendered by default.

0 comments on commit b506b45

Please sign in to comment.