# Path: kano_settings/common.py
# IMAGES_DIR = os.path.join(media, "Graphics")


from gi.repository import Gtk
from kano.gtk3.icons import set_from_name
from kano.gtk3.apply_styles import apply_styling_to_screen
from kano.gtk3.cursor import attach_cursor_events
from kano_settings.common import css_dir
import os
    def __init__(self, title, description, is_plug=False, back_btn=False):
        self.back_button = None
        css_path = os.path.join(css_dir, "heading.css")
        apply_styling_to_screen(css_path)
        title_hbox = None

        if is_plug:
            title_hbox = Gtk.Box()
            close_button = Gtk.Button()
            close_button.set_image(set_from_name('cross'))
            close_button.get_style_context().add_class('back_button')
            close_button.connect('clicked', Gtk.main_quit)
            close_button.set_margin_top(15)
            attach_cursor_events(close_button)
            title_hbox.pack_end(close_button, True, True, 0)

            if back_btn:
                self.back_button = Gtk.Button()
                attach_cursor_events(self.back_button)
                self.back_button.get_style_context().add_class('back_button')
                # TODO: get better back icon
                self.back_button.set_image(set_from_name('dark_left_arrow'))
                self.back_button.set_margin_top(15)
                title_hbox.pack_start(self.back_button, True, False, 0)

            else:
                empty_button = Gtk.Button(" ")
                empty_button.get_style_context().add_class('transparent')
                title_hbox.pack_start(empty_button, True, True, 0)


# Path: kano_settings/common.py
# IMAGES_DIR = os.path.join(media, "Graphics")


# Path: kano_settings/components/heading.py
from gi.repository import Gtk
from kano.gtk3.icons import set_from_name
from kano.gtk3.apply_styles import apply_styling_to_screen
from kano.gtk3.cursor import attach_cursor_events
from kano_settings.common import css_dir
import os

    def __init__(self, title, description, is_plug=False, back_btn=False):
        self.back_button = None
        css_path = os.path.join(css_dir, "heading.css")
        apply_styling_to_screen(css_path)
        title_hbox = None

        if is_plug:
            title_hbox = Gtk.Box()
            close_button = Gtk.Button()
            close_button.set_image(set_from_name('cross'))
            close_button.get_style_context().add_class('back_button')
            close_button.connect('clicked', Gtk.main_quit)
            close_button.set_margin_top(15)
            attach_cursor_events(close_button)
            title_hbox.pack_end(close_button, True, True, 0)

            if back_btn:
                self.back_button = Gtk.Button()
                attach_cursor_events(self.back_button)
                self.back_button.get_style_context().add_class('back_button')
                # TODO: get better back icon
                self.back_button.set_image(set_from_name('dark_left_arrow'))
                self.back_button.set_margin_top(15)
                title_hbox.pack_start(self.back_button, True, False, 0)

            else:
                empty_button = Gtk.Button(" ")
                empty_button.get_style_context().add_class('transparent')
                title_hbox.pack_start(empty_button, True, True, 0)


        self.title = Gtk.Label(title)