mirror of
https://github.com/marcelstoer/nodemcu-pyflasher.git
synced 2025-07-27 21:26:39 +00:00
Fix GH link in about dialog, fixes #4
This commit is contained in:
parent
c27e8763a7
commit
862eb4bcb8
18
About.py
18
About.py
@ -4,12 +4,13 @@
|
|||||||
import sys, os, wx
|
import sys, os, wx
|
||||||
import wx.html
|
import wx.html
|
||||||
import wx.lib.wxpTag
|
import wx.lib.wxpTag
|
||||||
|
import webbrowser
|
||||||
from Main import __version__
|
from Main import __version__
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class MyAboutBox(wx.Dialog):
|
class AboutDlg(wx.Dialog):
|
||||||
text = '''
|
text = '''
|
||||||
<html>
|
<html>
|
||||||
<body bgcolor="#DCDCDC" style="font-family: Arial; background-color: #DCDCDC;">
|
<body bgcolor="#DCDCDC" style="font-family: Arial; background-color: #DCDCDC;">
|
||||||
@ -26,7 +27,7 @@ class MyAboutBox(wx.Dialog):
|
|||||||
<p>Fork the <a style="color: #004CE5;" href="https://github.com/marcelstoer/nodemcu-pyflasher">project on
|
<p>Fork the <a style="color: #004CE5;" href="https://github.com/marcelstoer/nodemcu-pyflasher">project on
|
||||||
GitHub</a> and help improve it for all!</p>
|
GitHub</a> and help improve it for all!</p>
|
||||||
|
|
||||||
<p>© 2016-2017 Marcel Stör. Licensed under MIT.</p>
|
<p>© 2017 Marcel Stör. Licensed under MIT.</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<wxp module="wx" class="Button">
|
<wxp module="wx" class="Button">
|
||||||
@ -40,22 +41,27 @@ class MyAboutBox(wx.Dialog):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Dialog.__init__(self, parent, -1, "About NodeMCU PyFlasher")
|
wx.Dialog.__init__(self, parent, wx.ID_ANY, "About NodeMCU PyFlasher")
|
||||||
html = wx.html.HtmlWindow(self, -1, size=(420, -1))
|
html = HtmlWindow(self, wx.ID_ANY, size=(420, -1))
|
||||||
if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
|
if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo:
|
||||||
html.SetStandardFonts()
|
html.SetStandardFonts()
|
||||||
txt = self.text.format(self.__get_bundle_dir(), __version__)
|
txt = self.text.format(self._get_bundle_dir(), __version__)
|
||||||
html.SetPage(txt)
|
html.SetPage(txt)
|
||||||
ir = html.GetInternalRepresentation()
|
ir = html.GetInternalRepresentation()
|
||||||
html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
|
html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25))
|
||||||
self.SetClientSize(html.GetSize())
|
self.SetClientSize(html.GetSize())
|
||||||
self.CentreOnParent(wx.BOTH)
|
self.CentreOnParent(wx.BOTH)
|
||||||
|
|
||||||
def __get_bundle_dir(self):
|
def _get_bundle_dir(self):
|
||||||
# set by PyInstaller, see http://pyinstaller.readthedocs.io/en/v3.2/runtime-information.html
|
# set by PyInstaller, see http://pyinstaller.readthedocs.io/en/v3.2/runtime-information.html
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
return sys._MEIPASS
|
return sys._MEIPASS
|
||||||
else:
|
else:
|
||||||
return os.path.dirname(os.path.abspath(__file__))
|
return os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
class HtmlWindow(wx.html.HtmlWindow):
|
||||||
|
def OnLinkClicked(self, link):
|
||||||
|
webbrowser.open(link.GetHref())
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
4
Main.py
4
Main.py
@ -272,8 +272,8 @@ class NodeMcuFlasher(wx.Frame):
|
|||||||
self.Close(True)
|
self.Close(True)
|
||||||
|
|
||||||
def _on_help_about(self, event):
|
def _on_help_about(self, event):
|
||||||
from About import MyAboutBox
|
from About import AboutDlg
|
||||||
about = MyAboutBox(self)
|
about = AboutDlg(self)
|
||||||
about.ShowModal()
|
about.ShowModal()
|
||||||
about.Destroy()
|
about.Destroy()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user