# Path: kano/gtk3/apply_styles.py
# 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 time
import os
import sys
import types
from gi import require_version
from gi.repository import Gtk, Gdk, GObject, GdkPixbuf
from kano.gtk3.apply_styles import apply_styling_to_screen
from kano.paths import common_images_dir, common_css_dir
    if dir_path != '/usr':
        sys.path.insert(1, dir_path)



class KanoComboBox(Gtk.Button):
    # css file
    CSS_PATH = os.path.join(common_css_dir, "kano_combobox.css")

    # default size for the combobox - use set_size_request to change these
    WIDTH = 250
    HEIGHT = 100

    ARROW_DOWN = os.path.join(common_images_dir, "arrow_down.png")
    SCROLL_ARROW_UP = os.path.join(common_images_dir, "scroll_arrow_up.png")
    SCROLL_ARROW_DOWN = os.path.join(common_images_dir, "scroll_arrow_down.png")

    # signals which are emitted in addition to Button signals
    __gsignals__ = {
        "popup": (GObject.SIGNAL_RUN_FIRST, None, ()),
        # TODO? "popdown": (GObject.SIGNAL_RUN_FIRST, None, ()),
        "selected": (GObject.SIGNAL_RUN_FIRST, None, ()),
        "changed": (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    #
    # default_text         the initial text displayed inside the combobox
    # items                a list of string items to build the dropdown menu from
    # max_display_items    the number of items to display when poping up the dropdown menu
    #

# Path: kano/gtk3/apply_styles.py
# 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_combobox.py
import time
import os
import sys
import types
from gi import require_version
from gi.repository import Gtk, Gdk, GObject, GdkPixbuf
from kano.gtk3.apply_styles import apply_styling_to_screen
from kano.paths import common_images_dir, common_css_dir

    if dir_path != '/usr':
        sys.path.insert(1, dir_path)



class KanoComboBox(Gtk.Button):
    # css file
    CSS_PATH = os.path.join(common_css_dir, "kano_combobox.css")

    # default size for the combobox - use set_size_request to change these
    WIDTH = 250
    HEIGHT = 100

    ARROW_DOWN = os.path.join(common_images_dir, "arrow_down.png")
    SCROLL_ARROW_UP = os.path.join(common_images_dir, "scroll_arrow_up.png")
    SCROLL_ARROW_DOWN = os.path.join(common_images_dir, "scroll_arrow_down.png")

    # signals which are emitted in addition to Button signals
    __gsignals__ = {
        "popup": (GObject.SIGNAL_RUN_FIRST, None, ()),
        # TODO? "popdown": (GObject.SIGNAL_RUN_FIRST, None, ()),
        "selected": (GObject.SIGNAL_RUN_FIRST, None, ()),
        "changed": (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    #
    # default_text         the initial text displayed inside the combobox
    # items                a list of string items to build the dropdown menu from
    # max_display_items    the number of items to display when poping up the dropdown menu
    #

    def __init__(self, default_text="", items=[], max_display_items=4):