# Path: kano_registration_gui/ValidationEntry.py
# class ValidationEntry(Gtk.Entry):
# 
#     def __init__(self):
#         Gtk.Entry.__init__(self)
# 
#     def set_image(self, name=""):
#         if name == 'success':
#             filename = os.path.join(media_dir, "images/icons/success.png")
#         elif name == 'fail':
#             filename = os.path.join(media_dir, "images/icons/error.png")
#         else:
#             # if name not correct, leave it blank
#             filename = None
# 
#         if filename:
#             pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 30, 30)
#         else:
#             # If pixbuf is None, then the entry should be blank
#             pixbuf = None
# 
#         self.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, pixbuf)


from gi.repository import Gtk, GObject
from kano_registration_gui.ValidationEntry import ValidationEntry




class LabelledEntry(Gtk.Box):
    '''Produces a labelled entry, suitable for the registration screens
    '''
    __gsignals__ = {
        'labelled-entry-key-release': (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    def __init__(self, text, entry_contents=None):

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        # This is for the two labels above the entry
        # One is information about the entry information
        # The other is about whether the information is valid
        label_hbox = Gtk.Box()
        self._title_label = Gtk.Label(text, xalign=0)
        self._title_label.get_style_context().add_class('get_data_label')

        self._validated = False

        self._validation_label = Gtk.Label()
        self._validation_label.get_style_context().add_class('validation_label')
        label_hbox.pack_start(self._title_label, False, False, 0)
        label_hbox.pack_start(self._validation_label, False, False, 0)
        self.pack_start(label_hbox, False, False, 0)


# Path: kano_registration_gui/ValidationEntry.py
# class ValidationEntry(Gtk.Entry):
# 
#     def __init__(self):
#         Gtk.Entry.__init__(self)
# 
#     def set_image(self, name=""):
#         if name == 'success':
#             filename = os.path.join(media_dir, "images/icons/success.png")
#         elif name == 'fail':
#             filename = os.path.join(media_dir, "images/icons/error.png")
#         else:
#             # if name not correct, leave it blank
#             filename = None
# 
#         if filename:
#             pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(filename, 30, 30)
#         else:
#             # If pixbuf is None, then the entry should be blank
#             pixbuf = None
# 
#         self.set_icon_from_pixbuf(Gtk.EntryIconPosition.SECONDARY, pixbuf)


# Path: kano_registration_gui/LabelledEntry.py
from gi.repository import Gtk, GObject
from kano_registration_gui.ValidationEntry import ValidationEntry





class LabelledEntry(Gtk.Box):
    '''Produces a labelled entry, suitable for the registration screens
    '''
    __gsignals__ = {
        'labelled-entry-key-release': (GObject.SIGNAL_RUN_FIRST, None, ())
    }

    def __init__(self, text, entry_contents=None):

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        # This is for the two labels above the entry
        # One is information about the entry information
        # The other is about whether the information is valid
        label_hbox = Gtk.Box()
        self._title_label = Gtk.Label(text, xalign=0)
        self._title_label.get_style_context().add_class('get_data_label')

        self._validated = False

        self._validation_label = Gtk.Label()
        self._validation_label.get_style_context().add_class('validation_label')
        label_hbox.pack_start(self._title_label, False, False, 0)
        label_hbox.pack_start(self._validation_label, False, False, 0)
        self.pack_start(label_hbox, False, False, 0)


        self._entry = ValidationEntry()