Esempio n. 1
0
def instance():
    import sys
    try:
        import wifi  # pylint: disable=unused-variable
        return LinuxWifi()
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")

    return Wifi()
Esempio n. 2
0
def instance():
    import sys
    try:
        import wifi
        return LinuxWifi()
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")

    return Wifi()
Esempio n. 3
0
def instance():
    import sys

    if whereis_exe('nmcli'):
        return NMCLIWifi()

    try:
        import wifi  # pylint: disable=unused-variable,unused-import
    except ImportError:
        sys.stderr.write("python-wifi not installed. try:"
                         "`pip install --user wifi`.")
        return Wifi()
    return LinuxWifi()
Esempio n. 4
0
from plyer.facades import Wifi
from subprocess import Popen, PIPE, call, STDOUT

try:
    import wifi
except ImportError:
    sys.stderr.write("python-wifi not installed. try:"
                     "`sudo pip install wifi`.")
    return Wifi()


class LinuxWifi(Wifi):
    names = {}

    def _is_enabled():
        '''
        TODO: Implement this in future.
        '''
        return

    def _start_scanning(self):
        '''
        Returns all the network information.
        '''
        list_ = wifi.Cell.all('wlan0')
        for i in range(len(list_)):
            self.names[list_[i].ssid] = list_[i]

    def _get_network_info(self, name):
        '''
        Starts scanning for available Wi-Fi networks and returns the available,