# Path: kano/gtk3/scrolled_window.py
# class ScrolledWindow(Gtk.ScrolledWindow):
#     NORMAL_CSS_PATH = os.path.join(common_css_dir, 'scrollbar.css')
#     WIDE_CSS_PATH = os.path.join(common_css_dir, 'scrollbar-wide.css')
# 
#     def __init__(self, hexpand=None, vexpand=None, wide_scrollbar=False):
#         Gtk.ScrolledWindow.__init__(self, hexpand=hexpand, vexpand=vexpand)
#         self.set_overlay_scrolling(False)
# 
#     @staticmethod
#     def apply_styling_to_screen(wide=False):
#         if wide:
#             apply_styling_to_screen(ScrolledWindow.WIDE_CSS_PATH)
#         else:
#             apply_styling_to_screen(ScrolledWindow.NORMAL_CSS_PATH)
# 
#     def apply_styling_to_widget(self, wide=False):
#         for bar in [self.get_vscrollbar(), self.get_hscrollbar()]:
#             apply_colours_to_widget(bar)
#             if wide:
#                 apply_styling_to_widget(bar, self.WIDE_CSS_PATH)
#             else:
#                 apply_styling_to_widget(bar, self.NORMAL_CSS_PATH)
# 
# 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 os
from gi import require_version
from gi.repository import Gtk, GObject
from kano.gtk3.scrolled_window import ScrolledWindow
from kano.gtk3.apply_styles import apply_styling_to_screen
from kano.paths import common_css_dir
#
# multiline_entry.py
#
# Copyright (C) 2015 - 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Modified Gtk.TextView to permit placeholder text and other functions to make
# it more consistent with GtkEntry
#


require_version('Gtk', '3.0')





class KanoTextBuffer(Gtk.TextBuffer):
    __gsignals__ = {
        'insert-text': 'override'
    }

    def __init__(self):
        Gtk.TextBuffer.__init__(self)
        self._max_length = 0

    @property
    def max_length(self):
        return self._max_length


# Path: kano/gtk3/scrolled_window.py
# class ScrolledWindow(Gtk.ScrolledWindow):
#     NORMAL_CSS_PATH = os.path.join(common_css_dir, 'scrollbar.css')
#     WIDE_CSS_PATH = os.path.join(common_css_dir, 'scrollbar-wide.css')
# 
#     def __init__(self, hexpand=None, vexpand=None, wide_scrollbar=False):
#         Gtk.ScrolledWindow.__init__(self, hexpand=hexpand, vexpand=vexpand)
#         self.set_overlay_scrolling(False)
# 
#     @staticmethod
#     def apply_styling_to_screen(wide=False):
#         if wide:
#             apply_styling_to_screen(ScrolledWindow.WIDE_CSS_PATH)
#         else:
#             apply_styling_to_screen(ScrolledWindow.NORMAL_CSS_PATH)
# 
#     def apply_styling_to_widget(self, wide=False):
#         for bar in [self.get_vscrollbar(), self.get_hscrollbar()]:
#             apply_colours_to_widget(bar)
#             if wide:
#                 apply_styling_to_widget(bar, self.WIDE_CSS_PATH)
#             else:
#                 apply_styling_to_widget(bar, self.NORMAL_CSS_PATH)
# 
# 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/multiline_entry.py
import os
from gi import require_version
from gi.repository import Gtk, GObject
from kano.gtk3.scrolled_window import ScrolledWindow
from kano.gtk3.apply_styles import apply_styling_to_screen
from kano.paths import common_css_dir

#
# multiline_entry.py
#
# Copyright (C) 2015 - 2018 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Modified Gtk.TextView to permit placeholder text and other functions to make
# it more consistent with GtkEntry
#


require_version('Gtk', '3.0')





class KanoTextBuffer(Gtk.TextBuffer):
    __gsignals__ = {
        'insert-text': 'override'
    }

    def __init__(self):
        Gtk.TextBuffer.__init__(self)
        self._max_length = 0

    @property
    def max_length(self):
        return self._max_length


    @max_length.setter