Unverified Commit 5b90ad35 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

pep8/flake8

parent 229f8032
......@@ -29,7 +29,7 @@ from leap.bitmask.core import _zmq
from leap.bitmask.core import websocket
from leap.bonafide.service import BonafideService
from leap.common.events import server as event_server
#from leap.vpn import EIPService
# from leap.vpn import EIPService
class BitmaskBackend(configurable.ConfigurableService):
......@@ -96,7 +96,7 @@ class BitmaskBackend(configurable.ConfigurableService):
def init_eip(self):
# FIXME -- land EIP into leap.vpn
pass
#self._maybe_start_service('eip', EIPService)
# self._maybe_start_service('eip', EIPService)
def init_zmq(self):
zs = _zmq.ZMQServerService(self)
......
......@@ -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):
......
......@@ -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
......
......@@ -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 #####################################
......
......@@ -69,7 +69,6 @@ class PreferencesAccountPage(PreferencesPage):
self.app.signaler.prov_get_supported_services.connect(
self._load_services)
def teardown_connections(self):
"""
disconnect signals
......
......@@ -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))
......@@ -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
"""
......@@ -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):
"""
......
......@@ -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):
......
......@@ -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()
......
......@@ -23,7 +23,6 @@ import shutil
import socket
import subprocess
import sys
import time
from itertools import chain, repeat
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment