summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-10-27 00:48:54 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2016-11-03 14:28:04 +0100
commit3d2d564a966679086156c844d8c58b11751163a3 (patch)
tree15c6b2cbd4541335c94a7808e0acb19d443b2232 /src/leap/bitmask/gui
parent12bbdc84a744aaa2af4130539a2a7188996c7659 (diff)
[style] pep8 fixes
Diffstat (limited to 'src/leap/bitmask/gui')
-rw-r--r--src/leap/bitmask/gui/app.py57
1 files changed, 27 insertions, 30 deletions
diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py
index f812a6b0..d70c238f 100644
--- a/src/leap/bitmask/gui/app.py
+++ b/src/leap/bitmask/gui/app.py
@@ -27,6 +27,9 @@ import signal
import sys
from functools import partial
+from multiprocessing import Process
+
+from leap.bitmask.core.launcher import run_bitmaskd, pid
if platform.system() == 'Windows':
from multiprocessing import freeze_support
@@ -43,11 +46,6 @@ else:
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import QWebView
-from multiprocessing import Process
-
-from leap.bitmask.core.launcher import run_bitmaskd, pid
-
-
BITMASK_URI = 'http://localhost:7070'
@@ -62,30 +60,31 @@ class BrowserWindow(QDialog):
def __init__(self, parent):
super(BrowserWindow, self).__init__(parent)
- if IS_WIN:
- self.view = QWebView(self)
- win_size = QSize(1024, 600)
- self.setMinimumSize(win_size)
- self.view.page().setViewportSize(win_size)
- self.view.page().setPreferredContentsSize(win_size)
+ if IS_WIN:
+ self.view = QWebView(self)
+ win_size = QSize(1024, 600)
+ self.setMinimumSize(win_size)
+ self.view.page().setViewportSize(win_size)
+ self.view.page().setPreferredContentsSize(win_size)
else:
self.view = QWebView(self)
- win_size = QSize(800, 600)
- self.win_size = win_size
- self.resize(win_size)
-
- if DEBUG:
- self.view.settings().setAttribute(
- QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
+ win_size = QSize(800, 600)
+ self.win_size = win_size
+ self.resize(win_size)
+
+ if DEBUG:
+ self.view.settings().setAttribute(
+ QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled,
+ True)
self.inspector = QtWebKit.QWebInspector(self)
- self.inspector.setPage(self.view.page())
- self.inspector.show()
- self.splitter = QtGui.QSplitter()
- self.splitter.addWidget(self.view)
- self.splitter.addWidget(self.inspector)
- #TODO add layout also in non-DEBUG mode
- layout = QtGui.QVBoxLayout(self)
- layout.addWidget(self.splitter)
+ self.inspector.setPage(self.view.page())
+ self.inspector.show()
+ self.splitter = QtGui.QSplitter()
+ self.splitter.addWidget(self.view)
+ self.splitter.addWidget(self.inspector)
+ # TODO add layout also in non-DEBUG mode
+ layout = QtGui.QVBoxLayout(self)
+ layout.addWidget(self.splitter)
self.setWindowTitle('Bitmask')
self.load_app()
@@ -100,7 +99,7 @@ class BrowserWindow(QDialog):
self.closing = True
global bitmaskd
bitmaskd.join()
- if os.path.isfile(pid):
+ if os.path.isfile(pid):
with open(pid) as f:
pidno = int(f.read())
print('[bitmask] terminating bitmaskd...')
@@ -115,7 +114,6 @@ class BrowserWindow(QDialog):
sys.exit(1)
-
def _handle_kill(*args, **kw):
win = kw.get('win')
if win:
@@ -141,7 +139,6 @@ def launch_gui():
signal.SIGINT,
partial(_handle_kill, win=browser))
-
# Avoid code to get stuck inside c++ loop, returning control
# to python land.
timer = QtCore.QTimer()
@@ -160,7 +157,7 @@ def start_app():
if platform.system() == 'Windows':
# In windows, there are some args added to the invocation
- # by PyInstaller, I guess...
+ # by PyInstaller, I guess...
MIN_ARGS = 3
else:
MIN_ARGS = 1