# 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
#
# kano_progress.py
#
# Copyright (C) 2014 - 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2
#
# Customised progress bar widget
#


require_version('Gtk', '3.0')


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)


# Be careful you don't call another function with this
GObject.threads_init()


class ProgressBar(Gtk.ProgressBar):
    def __init__(self, pulse=True, rate=0.01):

        Gtk.ProgressBar.__init__(self)

# 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

#
# kano_progress.py
#
# Copyright (C) 2014 - 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2
#
# Customised progress bar widget
#


require_version('Gtk', '3.0')


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)


# Be careful you don't call another function with this
GObject.threads_init()


class ProgressBar(Gtk.ProgressBar):
    def __init__(self, pulse=True, rate=0.01):

        Gtk.ProgressBar.__init__(self)

        self.activity_mode = pulse