13
13
import txaio
14
14
import copy
15
15
import socket
16
- import PyQt5 .QtCore
17
- import PyQt5 .QtWebEngineWidgets
18
- from PyQt5 .QtWidgets import QApplication
19
16
import multiprocessing
20
17
21
18
@@ -153,7 +150,7 @@ def onOpen(self):
153
150
# in favor of "async def onMessage...", and "yield from" with "await".
154
151
# Attempting to use the older Python 3.4 syntax was not successful, so this
155
152
# no-notebook version of VPython requires Python 3.5.3 or later.
156
- #@asyncio.coroutine
153
+ # @asyncio.coroutine
157
154
# def onMessage(self, data, isBinary): # data includes canvas update, events, pick, compound
158
155
# data includes canvas update, events, pick, compound
159
156
async def onMessage (self , data , isBinary ):
@@ -236,8 +233,8 @@ def onClose(self, wasClean, code, reason):
236
233
else :
237
234
__server = HTTPServer (('' , __HTTP_PORT ), serveHTTP )
238
235
# 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 ))
241
238
242
239
except :
243
240
pass
@@ -246,13 +243,13 @@ def onClose(self, wasClean, code, reason):
246
243
def start_Qapp (port ):
247
244
# creates a python browser with PyQt5
248
245
# 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 ))
252
249
253
250
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' :
256
253
__m = multiprocessing .Process (target = start_Qapp , args = (__HTTP_PORT ,))
257
254
__m .start ()
258
255
0 commit comments