def __init__(self, *args, **kw):
url = kw.pop('url', None)
first = False
if not url:
url = "http://localhost:7070"
path = os.path.join(get_path_prefix(), 'leap', 'authtoken')
waiting = 20
while not os.path.isfile(path):
if waiting == 0:
# If we arrive here, something really messed up happened,
# because touching the token file is one of the first
# things the backend does, and this BrowserWindow
# should be called *right after* launching the backend.
raise NoAuthToken(
'No authentication token found!')
time.sleep(0.1)
waiting -= 1
token = open(path).read().strip()
url += '#' + token
first = True
self.url = url
self.closing = False
super(QWebView, self).__init__(*args, **kw)
self.setWindowTitle('Bitmask')
self.bitmask_browser = NewPageConnector(self) if first else None
self.loadPage(self.url)
self.proxy = AppProxy(self) if first else None
self.frame.addToJavaScriptWindowObject(
"bitmaskApp", self.proxy)
icon = QtGui.QIcon()
icon.addPixmap(
QtGui.QPixmap(":/mask-icon.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
评论列表
文章目录