# 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


if __name__ == '__main__' and __package__ is None:
    dir_path = os.path.abspath(
        os.path.join(os.path.dirname(__file__), '../../'))
    if dir_path != '/usr':
        sys.path.insert(1, dir_path)



class GenericButton(Gtk.Button):
    def __init__(self, text="", icon_filename=""):

        Gtk.Button.__init__(self)

        apply_colours_to_widget(self)

        self.internal_box = Gtk.Box(spacing=10)
        self.internal_box.props.halign = Gtk.Align.CENTER
        self.add(self.internal_box)

        if icon_filename:
            self.icon = Gtk.Image.new_from_file(icon_filename)
            self.internal_box.pack_start(self.icon, False, False, 0)
            self.label = Gtk.Label(text)
            self.internal_box.pack_start(self.label, False, False, 0)
        else:
            self.label = Gtk.Label(text)
            self.internal_box.add(self.label)


# 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



if __name__ == '__main__' and __package__ is None:
    dir_path = os.path.abspath(
        os.path.join(os.path.dirname(__file__), '../../'))
    if dir_path != '/usr':
        sys.path.insert(1, dir_path)



class GenericButton(Gtk.Button):
    def __init__(self, text="", icon_filename=""):

        Gtk.Button.__init__(self)

        apply_colours_to_widget(self)

        self.internal_box = Gtk.Box(spacing=10)
        self.internal_box.props.halign = Gtk.Align.CENTER
        self.add(self.internal_box)

        if icon_filename:
            self.icon = Gtk.Image.new_from_file(icon_filename)
            self.internal_box.pack_start(self.icon, False, False, 0)
            self.label = Gtk.Label(text)
            self.internal_box.pack_start(self.label, False, False, 0)
        else:
            self.label = Gtk.Label(text)
            self.internal_box.add(self.label)


        cursor.attach_cursor_events(self)