From e0f8089b6864a6f8ffda84689eb0e93735c50c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Sat, 7 Jan 2017 22:48:44 +0100 Subject: [PATCH] Make platform and distribution agnostic by allowing dynamic images path --- About.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/About.py b/About.py index 64bad22..4daebf3 100644 --- a/About.py +++ b/About.py @@ -1,7 +1,7 @@ # coding=utf-8 -import wx +import sys, os, wx import wx.html import wx.lib.wxpTag from Main import __version__ @@ -12,27 +12,21 @@ from Main import __version__ class MyAboutBox(wx.Dialog): text = ''' - - +
- Python - NodeMCU - Espressif, producers of ESP8266 et.al. - wxPython, cross-platform GUI framework + Python + NodeMCU + Espressif, producers of ESP8266 et.al. + wxPython, cross-platform GUI framework

NodeMCU PyFlasher

-

Version %s

+

Version {1}

Fork the project on GitHub and help improve it for all!

-

© 2016-2017 Marcel Stör. Licensed under MIT.

+

© 2016-2017 Marcel Stör. Licensed under MIT.

@@ -50,12 +44,18 @@ class MyAboutBox(wx.Dialog): html = wx.html.HtmlWindow(self, -1, size=(420, -1)) if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo: html.SetStandardFonts() - txt = self.text % __version__ + txt = self.text.format(self.__get_bundle_dir(), __version__) html.SetPage(txt) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25)) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH) + def __get_bundle_dir(self): + # set by PyInstaller, see http://pyinstaller.readthedocs.io/en/v3.2/runtime-information.html + if getattr(sys, 'frozen', False): + return sys._MEIPASS + else: + return os.path.dirname(os.path.abspath(__file__)) # ---------------------------------------------------------------------------