# Path: kano_settings/get_window.py
# def get_window_class(plug=False):
#     if plug:
#         logger.debug("Launching as a Gtk.Plug")
#         return application_window_wrapper(Gtk.Plug)
#     else:
#         logger.debug("Launching as a Gtk.Window")
#         return application_window_wrapper(Gtk.Window)
# 
# Path: kano_wifi_gui/RefreshNetworks.py
# class RefreshNetworks():
#     def __init__(self, win):
#         self._win = win
#         self._wiface = self._win.wiface
#         self._refresh_networks()
# 
#     def _refresh_networks(self):
#         title = _("Searching for networks")
#         description = _("Any minute now")
#         self._win.remove_main_widget()
#         SpinnerScreen(self._win, title, description, self._scan_networks)
# 
#     def _go_to_network_screen(self, network_list):
#         self._win.remove_main_widget()
#         NetworkScreen(self._win, network_list)
# 
#     # Get networks and pass to network screen
#     def _scan_networks(self):
# 
#         # Perform a network re-scan
#         network_list = IWList(self._win.wiface).getList(unsecure=False, first=False)
#         GObject.idle_add(self._go_to_network_screen, network_list)
# 
# Path: kano_wifi_gui/paths.py

# 
# Path: kano_wifi_gui/Template.py
# class Template(Gtk.Box):
# 
#     def __init__(self, title, description, buttons, is_plug=False, img_path=None):
#         super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL)
#         self._focus_widget = None
# 
#         heading = Heading(
#             title,
#             description,
#             is_plug,
#             back_btn=False
#         )
#         bbox = Gtk.ButtonBox()
#         bbox.set_spacing(20)
#         bbox.set_layout(Gtk.ButtonBoxStyle.CENTER)
#         bbox.set_margin_right(10)
#         bbox.set_margin_left(10)
# 
#         for b in buttons:
#             label = b["label"]
# 
#             if not label:
#                 gtk_button = Gtk.Label()
# 
#             else:
#                 button_type = b["type"]
#                 callback = b["callback"]
# 
#                 if button_type == "KanoButton":
#                     color = b["color"]
#                     gtk_button = KanoButton(label, color=color)
#                 elif button_type == "OrangeButton":
#                     gtk_button = OrangeButton(label)
# 
#                 gtk_button.connect("clicked", callback)
#             bbox.pack_start(gtk_button, False, False, 0)
# 
#             if "focus" in b:
#                 self._focus_widget = gtk_button
# 
#         self.pack_start(heading.container, False, False, 0)
#         heading.container.set_margin_right(15)
#         heading.container.set_margin_left(15)
# 
#         if img_path:
#             image = Gtk.Image.new_from_file(img_path)
# 
#         if is_plug:
#             self.pack_start(image, False, False, 10)
#             self.pack_start(bbox, False, False, 30)
#         else:
#             self.pack_start(image, False, False, 20)
#             self.pack_end(bbox, False, False, 30)
# 
#         self.show_all()
# 
#     def button_grab_focus(self):
#         if self._focus_widget is not None:
#             self._focus_widget.grab_focus()


import os
import sys
from gi import require_version
from gi.repository import Gtk
from kano.network import is_internet, is_ethernet_plugged, is_device
from kano_networking.ifaces import get_wlan_device
from kano.gtk3.top_bar import TopBar
from kano.gtk3.apply_styles import apply_common_to_screen, \
    apply_styling_to_screen
from kano_settings.get_window import get_window_class
from kano_wifi_gui.RefreshNetworks import RefreshNetworks
from kano_wifi_gui.paths import css_dir, img_dir
from kano_wifi_gui.Template import Template
                self.is_plug(),
                img_path
            )
            self.set_main_widget(screen)
            screen.button_grab_focus()
            screen.show_all()

        def _you_are_connected_via_ethernet(self):
            self.remove_main_widget()
            title = _("You are already connected via ethernet.")
            description = _("Do you still want to connect with WiFi?")

            # Decide which callback to use depending on if wifi dongle is
            # plugged in
            buttons = [
                {
                    'label': _("NO"),
                    'color': 'red',
                    'callback': Gtk.main_quit,
                    'type': 'KanoButton'
                },
                {
                    'label': _("YES"),
                    'color': 'green',
                    'callback': self._ethernet_next_step,
                    'type': 'KanoButton',
                    'focus': True
                }
            ]


# Path: kano_settings/get_window.py
# def get_window_class(plug=False):
#     if plug:
#         logger.debug("Launching as a Gtk.Plug")
#         return application_window_wrapper(Gtk.Plug)
#     else:
#         logger.debug("Launching as a Gtk.Window")
#         return application_window_wrapper(Gtk.Window)
# 
# Path: kano_wifi_gui/RefreshNetworks.py
# class RefreshNetworks():
#     def __init__(self, win):
#         self._win = win
#         self._wiface = self._win.wiface
#         self._refresh_networks()
# 
#     def _refresh_networks(self):
#         title = _("Searching for networks")
#         description = _("Any minute now")
#         self._win.remove_main_widget()
#         SpinnerScreen(self._win, title, description, self._scan_networks)
# 
#     def _go_to_network_screen(self, network_list):
#         self._win.remove_main_widget()
#         NetworkScreen(self._win, network_list)
# 
#     # Get networks and pass to network screen
#     def _scan_networks(self):
# 
#         # Perform a network re-scan
#         network_list = IWList(self._win.wiface).getList(unsecure=False, first=False)
#         GObject.idle_add(self._go_to_network_screen, network_list)
# 
# Path: kano_wifi_gui/paths.py

# 
# Path: kano_wifi_gui/Template.py
# class Template(Gtk.Box):
# 
#     def __init__(self, title, description, buttons, is_plug=False, img_path=None):
#         super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL)
#         self._focus_widget = None
# 
#         heading = Heading(
#             title,
#             description,
#             is_plug,
#             back_btn=False
#         )
#         bbox = Gtk.ButtonBox()
#         bbox.set_spacing(20)
#         bbox.set_layout(Gtk.ButtonBoxStyle.CENTER)
#         bbox.set_margin_right(10)
#         bbox.set_margin_left(10)
# 
#         for b in buttons:
#             label = b["label"]
# 
#             if not label:
#                 gtk_button = Gtk.Label()
# 
#             else:
#                 button_type = b["type"]
#                 callback = b["callback"]
# 
#                 if button_type == "KanoButton":
#                     color = b["color"]
#                     gtk_button = KanoButton(label, color=color)
#                 elif button_type == "OrangeButton":
#                     gtk_button = OrangeButton(label)
# 
#                 gtk_button.connect("clicked", callback)
#             bbox.pack_start(gtk_button, False, False, 0)
# 
#             if "focus" in b:
#                 self._focus_widget = gtk_button
# 
#         self.pack_start(heading.container, False, False, 0)
#         heading.container.set_margin_right(15)
#         heading.container.set_margin_left(15)
# 
#         if img_path:
#             image = Gtk.Image.new_from_file(img_path)
# 
#         if is_plug:
#             self.pack_start(image, False, False, 10)
#             self.pack_start(bbox, False, False, 30)
#         else:
#             self.pack_start(image, False, False, 20)
#             self.pack_end(bbox, False, False, 30)
# 
#         self.show_all()
# 
#     def button_grab_focus(self):
#         if self._focus_widget is not None:
#             self._focus_widget.grab_focus()


# Path: kano_wifi_gui/wifi_window.py
import os
import sys
from gi import require_version
from gi.repository import Gtk
from kano.network import is_internet, is_ethernet_plugged, is_device
from kano_networking.ifaces import get_wlan_device
from kano.gtk3.top_bar import TopBar
from kano.gtk3.apply_styles import apply_common_to_screen, \
    apply_styling_to_screen
from kano_settings.get_window import get_window_class
from kano_wifi_gui.RefreshNetworks import RefreshNetworks
from kano_wifi_gui.paths import css_dir, img_dir
from kano_wifi_gui.Template import Template

                self.is_plug(),
                img_path
            )
            self.set_main_widget(screen)
            screen.button_grab_focus()
            screen.show_all()

        def _you_are_connected_via_ethernet(self):
            self.remove_main_widget()
            title = _("You are already connected via ethernet.")
            description = _("Do you still want to connect with WiFi?")

            # Decide which callback to use depending on if wifi dongle is
            # plugged in
            buttons = [
                {
                    'label': _("NO"),
                    'color': 'red',
                    'callback': Gtk.main_quit,
                    'type': 'KanoButton'
                },
                {
                    'label': _("YES"),
                    'color': 'green',
                    'callback': self._ethernet_next_step,
                    'type': 'KanoButton',
                    'focus': True
                }
            ]


            img_path = os.path.join(img_dir, "ethernet-2.png")