2016-12-28 23:52:35 +01:00
2016-12-29 01:01:12 +01:00
# coding=utf-8
2017-01-07 22:48:44 +01:00
import sys , os , wx
2016-12-28 23:52:35 +01:00
import wx . html
import wx . lib . wxpTag
2017-02-18 22:18:43 +01:00
import webbrowser
2016-12-29 22:54:21 +01:00
from Main import __version__
2016-12-29 01:01:12 +01:00
# ---------------------------------------------------------------------------
2016-12-28 23:52:35 +01:00
2017-02-18 22:18:43 +01:00
class AboutDlg ( wx . Dialog ) :
2016-12-28 23:52:35 +01:00
text = '''
< html >
2017-01-07 22:48:44 +01:00
< body bgcolor = " #DCDCDC " style = " font-family: Arial; background-color: #DCDCDC; " >
2016-12-29 01:01:12 +01:00
< center >
2017-02-18 22:37:20 +01:00
< img src = " {0} /images/python-64.png " width = " 64 " height = " 64 " alt = " Python " >
< img src = " {0} /images/icon-64.png " width = " 64 " height = " 64 " alt = " NodeMCU " >
< img src = " {0} /images/espressif-64.png " width = " 64 " height = " 64 " alt = " Espressif, producers of ESP8266 et.al. " >
< img src = " {0} /images/wxpython-64.png " width = " 64 " height = " 43 " alt = " wxPython, cross-platform GUI framework " >
2016-12-29 01:01:12 +01:00
< h1 > NodeMCU PyFlasher < / h1 >
2017-01-07 22:48:44 +01:00
< p > Version { 1 } < / p >
2016-12-29 01:01:12 +01:00
2016-12-29 22:54:21 +01:00
< 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 >
2016-12-29 01:01:12 +01:00
2017-04-16 21:13:15 +02:00
< p >
As with everything I offer for free , this is donation - ware .
< a href = " https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HFN4ZMET5XS2Q " > < img src = " {0} /images/paypal-256.png " width = " 256 " height = " 88 " alt = " Donate with PayPal " > < / a >
< / p >
2017-02-18 22:18:43 +01:00
< p > & copy ; 2017 Marcel St & ouml ; r . Licensed under MIT . < / p >
2016-12-29 01:01:12 +01:00
< p >
< wxp module = " wx " class = " Button " >
< param name = " label " value = " Close " >
< param name = " id " value = " ID_OK " >
< / wxp >
< / p >
2016-12-28 23:52:35 +01:00
< / center >
< / body >
< / html >
'''
2016-12-29 01:01:12 +01:00
2016-12-29 22:54:21 +01:00
def __init__ ( self , parent ) :
2017-02-18 22:18:43 +01:00
wx . Dialog . __init__ ( self , parent , wx . ID_ANY , " About NodeMCU PyFlasher " )
html = HtmlWindow ( self , wx . ID_ANY , size = ( 420 , - 1 ) )
2016-12-28 23:52:35 +01:00
if " gtk2 " in wx . PlatformInfo or " gtk3 " in wx . PlatformInfo :
html . SetStandardFonts ( )
2017-02-18 22:18:43 +01:00
txt = self . text . format ( self . _get_bundle_dir ( ) , __version__ )
2016-12-28 23:52:35 +01:00
html . SetPage ( txt )
ir = html . GetInternalRepresentation ( )
2016-12-29 01:01:12 +01:00
html . SetSize ( ( ir . GetWidth ( ) + 25 , ir . GetHeight ( ) + 25 ) )
2016-12-28 23:52:35 +01:00
self . SetClientSize ( html . GetSize ( ) )
self . CentreOnParent ( wx . BOTH )
2017-02-18 22:18:43 +01:00
def _get_bundle_dir ( self ) :
2017-01-07 22:48:44 +01:00
# 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__ ) )
2016-12-28 23:52:35 +01:00
2017-02-18 22:18:43 +01:00
class HtmlWindow ( wx . html . HtmlWindow ) :
def OnLinkClicked ( self , link ) :
webbrowser . open ( link . GetHref ( ) )
2016-12-29 01:01:12 +01:00
# ---------------------------------------------------------------------------