# Path: kano/gtk3/cursor.py
# def hand_cursor(button, event):
# def arrow_cursor(button, event):
# def attach_cursor_events(button):
# 
# Path: kano/gtk3/apply_styles.py
# def apply_styling_to_widget(widget, path):
# 
#     if not os.path.exists(path):
#         sys.exit('{} CSS file missing!'.format(path))
# 
#     provider = Gtk.CssProvider()
#     provider.load_from_path(path)
#     styleContext = widget.get_style_context()
#     styleContext.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
# 
# def apply_colours_to_widget(widget):
#     path = os.path.join(common_css_dir, "colours.css")
#     apply_styling_to_widget(widget, path)
# 
# Path: kano/paths.py
# DNS_FILE = '/etc/resolvconf/resolv.conf.d/base'
# DNS_INTERFACES_FILE = '/etc/resolvconf/interface-order'
# DNS_INTERFACES_BACKUP_FILE = '/etc/resolvconf/interface-order.backup'
# SUPPLICANT_LOGFILE = '/var/log/kano_wpa.log'
# SUPPLICANT_CONFIG = '/etc/wpa_supplicant/wpa_supplicant.conf'
# INTERNET_UP_FILE = '/var/run/internet_monitor'
# KANO_CONNECT_PIDFILE = '/var/run/kano-connect.pid'


import os
import sys
from gi import require_version
from gi.repository import Gtk
from kano.gtk3 import cursor
from kano.gtk3.apply_styles import apply_styling_to_widget, apply_colours_to_widget
from kano.paths import common_css_dir

        # This stops the button resizing to fit the size of its container
        self.box = Gtk.Box()
        self.box.add(self)
        self.props.halign = Gtk.Align.CENTER
        self.box.props.halign = Gtk.Align.CENTER

        # This allows us to set our padding
        self.align = Gtk.Alignment(xscale=0, yscale=0)
        self.align.add(self.box)

    def set_padding(self, top, bottom, left, right):
        if self.align is not None:
            self.align.set_padding(top, bottom, left, right)

    def set_color(self, color):
        for c in self.available_colors:
            self.get_style_context().remove_class(c + "_background")
        self.get_style_context().add_class(color + "_background")

    def set_margin(self, top_margin, right_margin, bottom_margin, left_margin):
        self.set_margin_left(left_margin)
        self.set_margin_right(right_margin)
        self.set_margin_top(top_margin)
        self.set_margin_bottom(bottom_margin)

    def add_spinner(self):
        self.spinner = Gtk.Spinner()
        self.spinner.props.active = True
        self.is_spinning = False

# Path: kano/gtk3/cursor.py
# def hand_cursor(button, event):
# def arrow_cursor(button, event):
# def attach_cursor_events(button):
# 
# Path: kano/gtk3/apply_styles.py
# def apply_styling_to_widget(widget, path):
# 
#     if not os.path.exists(path):
#         sys.exit('{} CSS file missing!'.format(path))
# 
#     provider = Gtk.CssProvider()
#     provider.load_from_path(path)
#     styleContext = widget.get_style_context()
#     styleContext.add_provider(provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
# 
# def apply_colours_to_widget(widget):
#     path = os.path.join(common_css_dir, "colours.css")
#     apply_styling_to_widget(widget, path)
# 
# Path: kano/paths.py
# DNS_FILE = '/etc/resolvconf/resolv.conf.d/base'
# DNS_INTERFACES_FILE = '/etc/resolvconf/interface-order'
# DNS_INTERFACES_BACKUP_FILE = '/etc/resolvconf/interface-order.backup'
# SUPPLICANT_LOGFILE = '/var/log/kano_wpa.log'
# SUPPLICANT_CONFIG = '/etc/wpa_supplicant/wpa_supplicant.conf'
# INTERNET_UP_FILE = '/var/run/internet_monitor'
# KANO_CONNECT_PIDFILE = '/var/run/kano-connect.pid'


# Path: kano/gtk3/buttons.py
import os
import sys
from gi import require_version
from gi.repository import Gtk
from kano.gtk3 import cursor
from kano.gtk3.apply_styles import apply_styling_to_widget, apply_colours_to_widget
from kano.paths import common_css_dir


        # This stops the button resizing to fit the size of its container
        self.box = Gtk.Box()
        self.box.add(self)
        self.props.halign = Gtk.Align.CENTER
        self.box.props.halign = Gtk.Align.CENTER

        # This allows us to set our padding
        self.align = Gtk.Alignment(xscale=0, yscale=0)
        self.align.add(self.box)

    def set_padding(self, top, bottom, left, right):
        if self.align is not None:
            self.align.set_padding(top, bottom, left, right)

    def set_color(self, color):
        for c in self.available_colors:
            self.get_style_context().remove_class(c + "_background")
        self.get_style_context().add_class(color + "_background")

    def set_margin(self, top_margin, right_margin, bottom_margin, left_margin):
        self.set_margin_left(left_margin)
        self.set_margin_right(right_margin)
        self.set_margin_top(top_margin)
        self.set_margin_bottom(bottom_margin)

    def add_spinner(self):
        self.spinner = Gtk.Spinner()
        self.spinner.props.active = True
        self.is_spinning = False

        apply_styling_to_widget(self.spinner, self.SPINNER_CSS)