summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/network.py
blob: c73e806211a23094c1d7d05c7915855cde1a535a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import print_function
import logging
import time
logger = logging.getLogger(name=__name__)

from leap.base.network import NetworkChecker
from leap.baseapp.dialogs import ErrorDialog


class NetworkCheckerAppMixin(object):
    """
    initialize an instance of the Network Checker,
    which gathers error and passes them on.
    """

    def __init__(self, *args, **kwargs):
        self.network_checker = NetworkChecker(
            watcher_cb=self.newLogLine.emit,
            error_cb=self.handle_network_error,
            debug=self.debugmode)

        self.network_checker.run_checks()