# Path: fstimer/gui/util_classes.py
# class GtkStockButton(Gtk.Button):
#     
#     def __init__(self, icon_name, label_text):
#         #Init a regular Gtk.Button
#         Gtk.Button.__init__(self)
#         #Add the icon and the label.
#         fname = os.path.join(icon_path, icon_files[icon_name])
#         btnIcon = Gtk.Image.new_from_file(fname)
#         btnLabel = Gtk.Label(label_text+' ')
#         #pack 'em into an HBox
#         btnHbox = Gtk.HBox(False, 0)
#         btnHbox.pack_start(btnIcon, False, False, 0)
#         btnHbox.pack_start(btnLabel, True, True, 0)
#         self.add(btnHbox)
#         return


import gi
import fstimer.gui
import os, csv, json
import datetime
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton
        # Start with some intro text.
        label1 = Gtk.Label(
            label=('Select a pre-registration csv file to import.\n\n'
                   'If the spreadsheet has accented or non-Latin characters, it must be in utf-8,\n'
                   'see Section 2.2 of the documentation for instructions.'))
        #Continue to the load file.
        btnFILE = GtkStockButton('open',"Open")
        ## Textbuffer
        textbuffer = Gtk.TextBuffer()
        try:
            textbuffer.create_tag("blue", foreground="blue")
            textbuffer.create_tag("red", foreground="red")
        except TypeError:
            pass
        textview = Gtk.TextView()
        textview.set_buffer(textbuffer)
        textview.set_editable(False)
        textview.set_cursor_visible(False)
        textsw = Gtk.ScrolledWindow()
        textsw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        textsw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        textsw.add(textview)
        textalgn = Gtk.Alignment.new(0, 0, 1, 1)
        textalgn.add(textsw)
        hbox2 = Gtk.HBox(False, 5)
        btnFILE.connect('clicked', self.select_preregistration, textbuffer)
        btn_algn = Gtk.Alignment.new(1, 0, 1, 0)
        hbox2.pack_start(btnFILE, False, False, 0)
        hbox2.pack_start(btn_algn, True, True, 0)
        ## buttons

# Path: fstimer/gui/util_classes.py
# class GtkStockButton(Gtk.Button):
#     
#     def __init__(self, icon_name, label_text):
#         #Init a regular Gtk.Button
#         Gtk.Button.__init__(self)
#         #Add the icon and the label.
#         fname = os.path.join(icon_path, icon_files[icon_name])
#         btnIcon = Gtk.Image.new_from_file(fname)
#         btnLabel = Gtk.Label(label_text+' ')
#         #pack 'em into an HBox
#         btnHbox = Gtk.HBox(False, 0)
#         btnHbox.pack_start(btnIcon, False, False, 0)
#         btnHbox.pack_start(btnLabel, True, True, 0)
#         self.add(btnHbox)
#         return


# Path: fstimer/gui/importprereg.py
import gi
import fstimer.gui
import os, csv, json
import datetime
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton

        # Start with some intro text.
        label1 = Gtk.Label(
            label=('Select a pre-registration csv file to import.\n\n'
                   'If the spreadsheet has accented or non-Latin characters, it must be in utf-8,\n'
                   'see Section 2.2 of the documentation for instructions.'))
        #Continue to the load file.
        btnFILE = GtkStockButton('open',"Open")
        ## Textbuffer
        textbuffer = Gtk.TextBuffer()
        try:
            textbuffer.create_tag("blue", foreground="blue")
            textbuffer.create_tag("red", foreground="red")
        except TypeError:
            pass
        textview = Gtk.TextView()
        textview.set_buffer(textbuffer)
        textview.set_editable(False)
        textview.set_cursor_visible(False)
        textsw = Gtk.ScrolledWindow()
        textsw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        textsw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        textsw.add(textview)
        textalgn = Gtk.Alignment.new(0, 0, 1, 1)
        textalgn.add(textsw)
        hbox2 = Gtk.HBox(False, 5)
        btnFILE.connect('clicked', self.select_preregistration, textbuffer)
        btn_algn = Gtk.Alignment.new(1, 0, 1, 0)
        hbox2.pack_start(btnFILE, False, False, 0)
        hbox2.pack_start(btn_algn, True, True, 0)
        ## buttons

        btnOK = GtkStockButton('ok',"OK")