summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-04-19 12:07:09 -0400
committerKali Kaneko <kali@leap.se>2016-04-19 12:07:40 -0400
commit5b90ad3552025436edb40665203ab98eceaa065b (patch)
tree09c0bb6f188e2bacb0a57809f1671748a591195e /src/leap/bitmask/gui
parent229f803235ae9b9a71313d11071c7a0fbea0a681 (diff)
pep8/flake8
Diffstat (limited to 'src/leap/bitmask/gui')
-rw-r--r--src/leap/bitmask/gui/account.py1
-rw-r--r--src/leap/bitmask/gui/app.py4
-rw-r--r--src/leap/bitmask/gui/mainwindow.py8
-rw-r--r--src/leap/bitmask/gui/preferences_account_page.py1
-rw-r--r--src/leap/bitmask/gui/preferences_email_page.py36
-rw-r--r--src/leap/bitmask/gui/preferences_page.py6
-rw-r--r--src/leap/bitmask/gui/preferences_vpn_page.py2
-rw-r--r--src/leap/bitmask/gui/preferenceswindow.py7
-rw-r--r--src/leap/bitmask/gui/statemachines.py5
9 files changed, 37 insertions, 33 deletions
diff --git a/src/leap/bitmask/gui/account.py b/src/leap/bitmask/gui/account.py
index 5e43c8fe..b8b9509a 100644
--- a/src/leap/bitmask/gui/account.py
+++ b/src/leap/bitmask/gui/account.py
@@ -22,6 +22,7 @@ from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.services import EIP_SERVICE, MX_SERVICE
from leap.bitmask._components import HAS_EIP, HAS_MAIL
+
class Account():
def __init__(self, username, domain):
diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py
index e3a4d7fe..1011454e 100644
--- a/src/leap/bitmask/gui/app.py
+++ b/src/leap/bitmask/gui/app.py
@@ -60,8 +60,8 @@ class App(QtGui.QWidget):
def current_account(self):
"""
- Alas, the only definitive account information is buried in the memory of
- QT widgets.
+ Alas, the only definitive account information is buried in the memory
+ of QT widgets.
:returns: an object representing the current user account.
:rtype: Account
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index ca14e631..daf49eb6 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -154,11 +154,11 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
self._providers = Providers(self.ui.cmbProviders)
##
- ## tmphack: important state information about the application is stored
- ## in widgets. Rather than rewrite the UI, for now we simulate this
- ## info being stored in an application object:
+ # tmphack: important state information about the application is stored
+ # in widgets. Rather than rewrite the UI, for now we simulate this
+ # info being stored in an application object:
##
- self.app.login_state = self._login_widget._state
+ self.app.login_state = self._login_widget._state
self.app.providers_widget = self._providers
# Qt Signal Connections #####################################
diff --git a/src/leap/bitmask/gui/preferences_account_page.py b/src/leap/bitmask/gui/preferences_account_page.py
index c175c42b..141523c8 100644
--- a/src/leap/bitmask/gui/preferences_account_page.py
+++ b/src/leap/bitmask/gui/preferences_account_page.py
@@ -69,7 +69,6 @@ class PreferencesAccountPage(PreferencesPage):
self.app.signaler.prov_get_supported_services.connect(
self._load_services)
-
def teardown_connections(self):
"""
disconnect signals
diff --git a/src/leap/bitmask/gui/preferences_email_page.py b/src/leap/bitmask/gui/preferences_email_page.py
index 50f244fb..8211aeb8 100644
--- a/src/leap/bitmask/gui/preferences_email_page.py
+++ b/src/leap/bitmask/gui/preferences_email_page.py
@@ -18,8 +18,6 @@ Widget for "email" preferences
"""
from PySide import QtCore, QtGui
-from datetime import datetime
-
from leap.bitmask.logs.utils import get_logger
from leap.bitmask.gui.ui_preferences_email_page import Ui_PreferencesEmailPage
from leap.bitmask.gui.preferences_page import PreferencesPage
@@ -27,6 +25,7 @@ from leap.mail.imap.service.imap import IMAP_PORT
logger = get_logger()
+
class PreferencesEmailPage(PreferencesPage):
def __init__(self, parent, account, app):
@@ -46,11 +45,11 @@ class PreferencesEmailPage(PreferencesPage):
# the only way to set the tab titles is to re-add them:
self.ui.email_tabs.addTab(self.ui.config_tab,
- self.tr("Mail Client"))
+ self.tr("Mail Client"))
self.ui.email_tabs.addTab(self.ui.my_key_tab,
- self.tr("My Key"))
+ self.tr("My Key"))
self.ui.email_tabs.addTab(self.ui.other_keys_tab,
- self.tr("Other Keys"))
+ self.tr("Other Keys"))
# set mail client configuration help text
lang = QtCore.QLocale.system().name().replace('_', '-')
@@ -61,7 +60,7 @@ class PreferencesEmailPage(PreferencesPage):
"For Thunderbird, you can use the Bitmask extension. "
"Search for \"Bitmask\" in the add-on manager or "
"download it from <a href='{0}'>addons.mozilla.org</a>.".format(
- thunderbird_extension_url)))
+ thunderbird_extension_url)))
self.ui.mail_client_label.setText(self.tr(
"Alternatively, you can manually configure your mail client to "
"use Bitmask Email with these options:"))
@@ -71,7 +70,6 @@ class PreferencesEmailPage(PreferencesPage):
self.setup_connections()
-
def setup_connections(self):
"""
connect signals
@@ -106,7 +104,7 @@ class PreferencesEmailPage(PreferencesPage):
self.ui.message_label.setText(
self.tr('You must be logged in to edit email settings.'))
else:
- self.ui.import_button.setVisible(False) # hide this until working
+ self.ui.import_button.setVisible(False) # hide this until working
self.ui.message_label.setVisible(False)
self.ui.email_tabs.setVisible(True)
smtp_port = 2013
@@ -128,7 +126,7 @@ class PreferencesEmailPage(PreferencesPage):
Set the current user's key details into the gui.
"""
self.ui.fingerprint_edit.setPlainText(
- self._format_fingerprint(details["fingerprint"]))
+ self._format_fingerprint(details["fingerprint"]))
self.ui.expiration_edit.setText(details["expiry_date"])
self.ui.uid_edit.setText(" ".join(details["uids"]))
self.ui.public_key_edit.setPlainText(details["key_data"])
@@ -139,8 +137,8 @@ class PreferencesEmailPage(PreferencesPage):
produces, wrapped to two lines.
"""
fp = fingerprint.upper()
- fp_list = [fp[i:i+4] for i in range(0, len(fp), 4)]
- fp_wrapped = " ".join(fp_list[0:5]) + "\n" + " ".join(fp_list[5:10])
+ fp_list = [fp[i:i + 4] for i in range(0, len(fp), 4)]
+ fp_wrapped = " ".join(fp_list[0:5]) + "\n" + " ".join(fp_list[5:10])
return fp_wrapped
def _export_keys(self):
@@ -156,8 +154,8 @@ class PreferencesEmailPage(PreferencesPage):
if not file_name.endswith('.pem'):
file_name += '.pem'
self.app.backend.keymanager_export_keys(
- username=self.account.address,
- filename=file_name)
+ username=self.account.address,
+ filename=file_name)
else:
logger.debug('Export canceled by the user.')
@@ -186,9 +184,9 @@ class PreferencesEmailPage(PreferencesPage):
"Export canceled."))
def _import_keys(self):
- """
- not yet supported
- """
+ """
+ not yet supported
+ """
def _keymanager_keys_list(self, keys):
"""
@@ -203,5 +201,7 @@ class PreferencesEmailPage(PreferencesPage):
for key in keys:
row = self.ui.keys_table.rowCount()
self.ui.keys_table.insertRow(row)
- self.ui.keys_table.setItem(row, 0, QtGui.QTableWidgetItem(key.address))
- self.ui.keys_table.setItem(row, 1, QtGui.QTableWidgetItem(key.fingerprint))
+ self.ui.keys_table.setItem(
+ row, 0, QtGui.QTableWidgetItem(key.address))
+ self.ui.keys_table.setItem(
+ row, 1, QtGui.QTableWidgetItem(key.fingerprint))
diff --git a/src/leap/bitmask/gui/preferences_page.py b/src/leap/bitmask/gui/preferences_page.py
index c75b4991..a5d811f9 100644
--- a/src/leap/bitmask/gui/preferences_page.py
+++ b/src/leap/bitmask/gui/preferences_page.py
@@ -14,10 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-base class for preference pages
+Base class for preference pages
"""
-from PySide import QtCore, QtGui
+from PySide import QtGui
+
class PreferencesPage(QtGui.QWidget):
@@ -47,4 +48,3 @@ class PreferencesPage(QtGui.QWidget):
disconnect signals
must be overridden by subclass
"""
-
diff --git a/src/leap/bitmask/gui/preferences_vpn_page.py b/src/leap/bitmask/gui/preferences_vpn_page.py
index fc15340f..87b86c4e 100644
--- a/src/leap/bitmask/gui/preferences_vpn_page.py
+++ b/src/leap/bitmask/gui/preferences_vpn_page.py
@@ -20,10 +20,10 @@ Widget for "vpn" preferences
from PySide import QtCore, QtGui
from leap.bitmask.gui.ui_preferences_vpn_page import Ui_PreferencesVpnPage
-from leap.bitmask.config.leapsettings import LeapSettings
from leap.bitmask.gui.flashable import Flashable
from leap.bitmask.gui.preferences_page import PreferencesPage
+
class PreferencesVpnPage(PreferencesPage, Flashable):
"""
diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py
index 1facba69..82dc8d77 100644
--- a/src/leap/bitmask/gui/preferenceswindow.py
+++ b/src/leap/bitmask/gui/preferenceswindow.py
@@ -29,6 +29,7 @@ from leap.bitmask.gui.preferences_email_page import PreferencesEmailPage
logger = get_logger()
+
class PreferencesWindow(QtGui.QDialog):
"""
@@ -122,7 +123,7 @@ class PreferencesWindow(QtGui.QDialog):
"""
Adds the pages for the different configuration categories.
"""
- self._remove_pages() # in case different account was loaded.
+ self._remove_pages() # in case different account was loaded.
# load placeholder widgets if the page should not be loaded.
# the order of the pages is important, and must match the order
@@ -197,8 +198,8 @@ class PreferencesWindow(QtGui.QDialog):
Close this dialog and destroy it.
"""
PreferencesWindow._current_window = None
- self._teardown_connections();
- self._remove_pages();
+ self._teardown_connections()
+ self._remove_pages()
self.deleteLater()
def _change_page(self, current, previous):
diff --git a/src/leap/bitmask/gui/statemachines.py b/src/leap/bitmask/gui/statemachines.py
index ab48b756..92c5431d 100644
--- a/src/leap/bitmask/gui/statemachines.py
+++ b/src/leap/bitmask/gui/statemachines.py
@@ -40,6 +40,7 @@ class SignallingState(QState):
"""
A state that emits a custom signal on entry.
"""
+
def __init__(self, signal, parent=None, name=None):
"""
Initializer.
@@ -134,6 +135,7 @@ class States(object):
class CompositeEvent(QtCore.QEvent):
+
def __init__(self):
super(CompositeEvent, self).__init__(
QtCore.QEvent.Type(self.ID))
@@ -174,6 +176,7 @@ class Events(QtCore.QObject):
A Wrapper object for containing the events that will be
posted to a composite state machine.
"""
+
def __init__(self, parent=None):
"""
Initializes the QObject with the given parent.
@@ -289,6 +292,7 @@ class ConnectionMachineBuilder(object):
"""
Builder class for state machines made from LEAPConnections.
"""
+
def __init__(self, connection):
"""
:param connection: an instance of a concrete LEAPConnection
@@ -352,7 +356,6 @@ class ConnectionMachineBuilder(object):
:rtype: QStateMachine
"""
# TODO split this method in smaller utility functions.
- parent = kwargs.get('parent', None)
# 1. create machine
machine = CompositeMachine()