Skip to content

Commit 56cc701

Browse files
committed
Remove imports and make PEP8 changes
1 parent 3112de1 commit 56cc701

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

vpython/no_notebook.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
import txaio
1414
import copy
1515
import socket
16-
import PyQt5.QtCore
17-
import PyQt5.QtWebEngineWidgets
18-
from PyQt5.QtWidgets import QApplication
1916
import 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

242239
except:
243240
pass
@@ -246,13 +243,13 @@ def onClose(self, wasClean, code, reason):
246243
def 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

vpython/qtbrowser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
import PyQt5.QtWebEngineWidgets
44
from PyQt5.QtWidgets import QApplication
55

6-
print(sys.argv)
76

8-
if(len(sys.argv)>1):
7+
if len(sys.argv) > 1:
98

109
if sys.argv[1]:
1110

@@ -18,7 +17,9 @@
1817
sys.exit(app.exec_())
1918

2019
else:
21-
print("Please give a URL as the first command-line argument when running the program.")
20+
print("Please give a URL as the first command-line argument "
21+
"when running the program.")
2222

2323
else:
24-
print("Please give a URL as the first command-line argument when running the program.")
24+
print("Please give a URL as the first command-line argument "
25+
"when running the program.")

0 commit comments

Comments
 (0)