# Path: kano/gtk3/apply_styles.py
# def apply_colours_to_screen():
#     apply_styling_to_screen(common_css_dir + "/colours.css", "APPLICATION")
# 
# def apply_styling_to_screen(css_file, priority="USER"):
#     css = Gtk.CssProvider()
# 
#     if not os.path.exists(css_file):
#         sys.exit(css_file + ' CSS file missing!')
# 
#     css.load_from_path(css_file)
# 
#     screen = Gdk.Screen.get_default()
#     styleContext = Gtk.StyleContext()
# 
#     if priority == "FALLBACK":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK
#     elif priority == "THEME":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_THEME
#     elif priority == "SETTINGS":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS
#     elif priority == "APPLICATION":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
#     elif priority == "USER":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_USER
# 
#     styleContext.add_provider_for_screen(screen, css, gtk_priority)
# 
# 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
import threading
import time
from gi import require_version
from gi.repository import Gtk, GObject
from kano.gtk3.apply_styles import apply_colours_to_screen, apply_styling_to_screen
from kano.paths import common_css_dir

            if hasattr(self, "work_args"):
                self.work_function(self.work_args)
            else:
                self.work_function()

    def set_work_function(self, function, args=None):
        self.work_function = function
        if args is not None:
            self.work_args = args


class KanoProgressBar(ProgressBar):
    CSS_PATH = os.path.join(common_css_dir, 'kano_progress.css')

    def __init__(self, pulse=True, title="", rate=0.01):
        apply_colours_to_screen()
        apply_styling_to_screen(self.CSS_PATH)

        ProgressBar.__init__(self, pulse, rate)
        self.get_style_context().add_class("KanoProgressBar")

        self.win = Gtk.Window()
        self.win.get_style_context().add_class("KanoProgressBar")
        self.win.set_decorated(False)
        self.win.set_resizable(False)
        self.win.set_position(Gtk.WindowPosition.CENTER)
        self.win.connect("delete-event", Gtk.main_quit)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

# Path: kano/gtk3/apply_styles.py
# def apply_colours_to_screen():
#     apply_styling_to_screen(common_css_dir + "/colours.css", "APPLICATION")
# 
# def apply_styling_to_screen(css_file, priority="USER"):
#     css = Gtk.CssProvider()
# 
#     if not os.path.exists(css_file):
#         sys.exit(css_file + ' CSS file missing!')
# 
#     css.load_from_path(css_file)
# 
#     screen = Gdk.Screen.get_default()
#     styleContext = Gtk.StyleContext()
# 
#     if priority == "FALLBACK":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK
#     elif priority == "THEME":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_THEME
#     elif priority == "SETTINGS":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_SETTINGS
#     elif priority == "APPLICATION":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
#     elif priority == "USER":
#         gtk_priority = Gtk.STYLE_PROVIDER_PRIORITY_USER
# 
#     styleContext.add_provider_for_screen(screen, css, gtk_priority)
# 
# 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/kano_progress.py
import os
import sys
import threading
import time
from gi import require_version
from gi.repository import Gtk, GObject
from kano.gtk3.apply_styles import apply_colours_to_screen, apply_styling_to_screen
from kano.paths import common_css_dir


            if hasattr(self, "work_args"):
                self.work_function(self.work_args)
            else:
                self.work_function()

    def set_work_function(self, function, args=None):
        self.work_function = function
        if args is not None:
            self.work_args = args


class KanoProgressBar(ProgressBar):
    CSS_PATH = os.path.join(common_css_dir, 'kano_progress.css')

    def __init__(self, pulse=True, title="", rate=0.01):
        apply_colours_to_screen()
        apply_styling_to_screen(self.CSS_PATH)

        ProgressBar.__init__(self, pulse, rate)
        self.get_style_context().add_class("KanoProgressBar")

        self.win = Gtk.Window()
        self.win.get_style_context().add_class("KanoProgressBar")
        self.win.set_decorated(False)
        self.win.set_resizable(False)
        self.win.set_position(Gtk.WindowPosition.CENTER)
        self.win.connect("delete-event", Gtk.main_quit)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.win.add(box)