def _launch_application(self, widget=None):
            # Decide whether application prompts user to plug in WiFi dongle
            # or tell them they have ethernet.
            # Don't want to call this function more than once
            self.wiface = get_wlan_device()

            has_internet = is_internet()
            ethernet_plugged = is_ethernet_plugged()
            dongle_is_plugged_in = is_device(self.wiface)

            if has_internet and ethernet_plugged and self.no_confirm_ether:
                sys.exit(0)

            # For testing
            # dongle_is_plugged_in = False
            # ethernet_plugged = True
            # has_internet = False

            if has_internet and ethernet_plugged:
                self._you_are_connected_via_ethernet()

            elif dongle_is_plugged_in:
                if has_internet:
                    self._you_have_internet_screen(self.wiface)
                else:
                    # Refresh the networks list
                    self.refresh_networks()

            else:
                self._plug_in_wifi_dongle()
Example #2
0
        def _launch_application(self, widget=None):
            # Decide whether application prompts user to plug in WiFi dongle
            # or tell them they have ethernet.
            # Don't want to call this function more than once
            self.wiface = get_wlan_device()

            has_internet = is_internet()
            ethernet_plugged = is_ethernet_plugged()
            dongle_is_plugged_in = is_device(self.wiface)

            if has_internet and ethernet_plugged and self.no_confirm_ether:
                sys.exit(0)

            # For testing
            # dongle_is_plugged_in = False
            # ethernet_plugged = True
            # has_internet = False

            if has_internet and ethernet_plugged:
                self._you_are_connected_via_ethernet()

            elif dongle_is_plugged_in:
                if has_internet:
                    self._you_have_internet_screen(self.wiface)
                else:
                    # Refresh the networks list
                    self.refresh_networks()

            else:
                self._plug_in_wifi_dongle()
def create_wifi_gui(is_plug, socket_id, no_confirm_ether=False):
    base_class = get_window_class(is_plug)
    wifi_gui = get_wifi_gui(base_class)

    iface = get_wlan_device()  # this is now redundant, moved to _launch_application
    win = wifi_gui(socket_id=socket_id, wiface=iface, no_confirm_ether=no_confirm_ether)
    win.show_all()
    Gtk.main()
Example #4
0
def create_wifi_gui(is_plug, socket_id, no_confirm_ether=False):
    base_class = get_window_class(is_plug)
    wifi_gui = get_wifi_gui(base_class)

    iface = get_wlan_device()  # this is now redundant, moved to _launch_application
    win = wifi_gui(socket_id=socket_id, wiface=iface, no_confirm_ether=no_confirm_ether)
    win.show_all()
    Gtk.main()
Example #5
0
def disconnect_wifi():
    from kano.network import KwifiCache, disconnect
    from kano.gtk3.kano_dialog import KanoDialog

    iface = get_wlan_device()
    disconnect(iface)
    wificache = KwifiCache()
    wificache.empty()

    kdialog = KanoDialog(
        # Text from the content team.
        _("Disconnect complete - you're now offline."),
    )
    kdialog.run()

    return 0