1313import txaio
1414import copy
1515import socket
16- import PyQt5 .QtCore
17- import PyQt5 .QtWebEngineWidgets
18- from PyQt5 .QtWidgets import QApplication
1916import multiprocessing
2017
2118
@@ -153,7 +150,7 @@ def onOpen(self):
153150 # in favor of "async def onMessage...", and "yield from" with "await".
154151 # Attempting to use the older Python 3.4 syntax was not successful, so this
155152 # no-notebook version of VPython requires Python 3.5.3 or later.
156- #@asyncio.coroutine
153+ # @asyncio.coroutine
157154 # def onMessage(self, data, isBinary): # data includes canvas update, events, pick, compound
158155 # data includes canvas update, events, pick, compound
159156 async def onMessage (self , data , isBinary ):
@@ -236,8 +233,8 @@ def onClose(self, wasClean, code, reason):
236233 else :
237234 __server = HTTPServer (('' , __HTTP_PORT ), serveHTTP )
238235 # or webbrowser.open_new_tab()
239- if ( _browsertype == 'default' ): # uses default browser
240- _webbrowser .open ('http://localhost:{}' .format (__HTTP_PORT )) #uses default browser
236+ if _browsertype == 'default' : # uses default browser
237+ _webbrowser .open ('http://localhost:{}' .format (__HTTP_PORT ))
241238
242239except :
243240 pass
@@ -246,13 +243,13 @@ def onClose(self, wasClean, code, reason):
246243def start_Qapp (port ):
247244 # creates a python browser with PyQt5
248245 # runs qtbrowser.py in a separate process
249- filepath = os .path .dirname (__file__ )
250- filename = filepath + '/qtbrowser.py'
251- os .system ('python ' + filename + ' http://localhost:{}' .format (port ))
246+ filepath = os .path .dirname (__file__ )
247+ filename = filepath + '/qtbrowser.py'
248+ os .system ('python ' + filename + ' http://localhost:{}' .format (port ))
252249
253250
254- #create a browser in its own process
255- if ( _browsertype == 'pyqt' ): #uses default browser
251+ # create a browser in its own process
252+ if _browsertype == 'pyqt' :
256253 __m = multiprocessing .Process (target = start_Qapp , args = (__HTTP_PORT ,))
257254 __m .start ()
258255
0 commit comments