11#!/usr/bin/env python
22
33import wx
4+ import wx .adv
45import wx .lib .inspection
56import wx .lib .mixins .inspection
6- import sys , os
7+
8+ import sys
9+ import os
710import esptool
811import threading
912import json
1417from esptool import NotImplementedInROMError
1518from argparse import Namespace
1619
17- __version__ = "2.2 "
20+ __version__ = "3.0 "
1821__flash_help__ = '''
1922<p>This setting is highly dependent on your device!<p>
2023<p>
@@ -50,7 +53,9 @@ def write(self, string):
5053 else :
5154 wx .CallAfter (self .__out .AppendText , string )
5255
56+ # noinspection PyMethodMayBeStatic
5357 def flush (self ):
58+ # noinspection PyStatementEffect
5459 None
5560
5661# ---------------------------------------------------------------------------
@@ -210,7 +215,7 @@ def on_pick_file(event):
210215 reload_button = wx .BitmapButton (panel , id = wx .ID_ANY , bitmap = bmp ,
211216 size = (bmp .GetWidth () + 7 , bmp .GetHeight () + 7 ))
212217 reload_button .Bind (wx .EVT_BUTTON , on_reload )
213- reload_button .SetToolTipString ("Reload serial device list" )
218+ reload_button .SetToolTip ("Reload serial device list" )
214219
215220 file_picker = wx .FilePickerCtrl (panel , style = wx .FLP_USE_TEXTCTRL )
216221 file_picker .Bind (wx .EVT_FILEPICKER_CHANGED , on_pick_file )
@@ -322,7 +327,8 @@ def _select_configured_port(self):
322327 break
323328 count += 1
324329
325- def _get_serial_ports (self ):
330+ @staticmethod
331+ def _get_serial_ports ():
326332 ports = ["" ]
327333 for port , desc , hwid in sorted (list_ports .comports ()):
328334 ports .append (port )
@@ -332,7 +338,7 @@ def _set_icons(self):
332338 self .SetIcon (images .Icon .GetIcon ())
333339
334340 def _build_status_bar (self ):
335- self .statusBar = self .CreateStatusBar (2 , wx .ST_SIZEGRIP )
341+ self .statusBar = self .CreateStatusBar (2 , wx .STB_SIZEGRIP )
336342 self .statusBar .SetStatusWidths ([- 2 , - 1 ])
337343 status_text = "Welcome to NodeMCU PyFlasher %s" % __version__
338344 self .statusBar .SetStatusText (status_text , 0 )
@@ -356,7 +362,8 @@ def _build_menu_bar(self):
356362
357363 self .SetMenuBar (self .menuBar )
358364
359- def _get_config_file_path (self ):
365+ @staticmethod
366+ def _get_config_file_path ():
360367 return wx .StandardPaths .Get ().GetUserConfigDir () + "/nodemcu-pyflasher.json"
361368
362369 # Menu methods
@@ -380,13 +387,12 @@ def log_message(self, message):
380387
381388
382389# ---------------------------------------------------------------------------
383- class MySplashScreen (wx .SplashScreen ):
390+ class MySplashScreen (wx .adv . SplashScreen ):
384391 def __init__ (self ):
385- wx .SplashScreen .__init__ (self , images .Splash .GetBitmap (),
386- wx .SPLASH_CENTRE_ON_SCREEN | wx .SPLASH_TIMEOUT ,
387- 2500 , None , - 1 )
392+ wx .adv .SplashScreen .__init__ (self , images .Splash .GetBitmap (),
393+ wx .adv .SPLASH_CENTRE_ON_SCREEN | wx .adv .SPLASH_TIMEOUT , 2500 , None , - 1 )
388394 self .Bind (wx .EVT_CLOSE , self ._on_close )
389- self .__fc = wx .FutureCall (2000 , self ._show_main )
395+ self .__fc = wx .CallLater (2000 , self ._show_main )
390396
391397 def _on_close (self , evt ):
392398 # Make sure the default handler runs too so this window gets
@@ -412,7 +418,7 @@ def _show_main(self):
412418# ----------------------------------------------------------------------------
413419class App (wx .App , wx .lib .mixins .inspection .InspectionMixin ):
414420 def OnInit (self ):
415- wx .SystemOptions .SetOptionInt ("mac.window-plain-transition" , 1 )
421+ wx .SystemOptions .SetOption ("mac.window-plain-transition" , 1 )
416422 self .SetAppName ("NodeMCU PyFlasher" )
417423
418424 # Create and show the splash screen. It will then create and
@@ -435,6 +441,8 @@ def main():
435441 app .MainLoop ()
436442# ---------------------------------------------------------------------------
437443
444+
438445if __name__ == '__main__' :
439446 __name__ = 'Main'
440447 main ()
448+
0 commit comments