# 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
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton
            corerrorsw = Gtk.ScrolledWindow()
            corerrorsw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
            corerrorsw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            self.corerrorlist = Gtk.ListStore(*[str for field in self.fields])
            self.corerrortreeview = Gtk.TreeView()
            # Now define each column in the treeview
            # Take these from self.fields
            for (colid, field) in enumerate(self.fields):
                column = Gtk.TreeViewColumn(field, Gtk.CellRendererText(), text=colid)
                column.set_sort_column_id(colid)
                self.corerrortreeview.append_column(column)
            # Add in the info from self.errors
            for reg in self.errors[current_id]:
                self.corerrorlist.append([reg[field] for field in self.fields])
            self.corerrortreeview.set_model(self.corerrorlist)
            corerrorsw.add(self.corerrortreeview)
            errvbox1 = Gtk.VBox(False, 8)
            errvbox1.pack_start(Gtk.Label('''These entries share the same ID.
Use "Keep entry" to associate an entry with the ID.
Otherwise, press "OK" to continue, no entry will be associated with this ID.'''), False, False, 0)
            errvbox1.pack_start(corerrorsw, True, True, 0)
            vbox1align = Gtk.Alignment.new(0, 0, 1, 1)
            vbox1align.add(errvbox1)
            #Now build a table for the buttons
            errtable = Gtk.Table(2, 1, False)
            errtable.set_row_spacings(5)
            errtable.set_col_spacings(5)
            errtable.set_border_width(5)
            btnKEEP = Gtk.Button('Keep entry')
            btnKEEP.connect('clicked', self.keep_correct, current_id, treeiter)

# 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/compileerrors.py
import gi
import fstimer.gui
import os
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton

            corerrorsw = Gtk.ScrolledWindow()
            corerrorsw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
            corerrorsw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
            self.corerrorlist = Gtk.ListStore(*[str for field in self.fields])
            self.corerrortreeview = Gtk.TreeView()
            # Now define each column in the treeview
            # Take these from self.fields
            for (colid, field) in enumerate(self.fields):
                column = Gtk.TreeViewColumn(field, Gtk.CellRendererText(), text=colid)
                column.set_sort_column_id(colid)
                self.corerrortreeview.append_column(column)
            # Add in the info from self.errors
            for reg in self.errors[current_id]:
                self.corerrorlist.append([reg[field] for field in self.fields])
            self.corerrortreeview.set_model(self.corerrorlist)
            corerrorsw.add(self.corerrortreeview)
            errvbox1 = Gtk.VBox(False, 8)
            errvbox1.pack_start(Gtk.Label('''These entries share the same ID.
Use "Keep entry" to associate an entry with the ID.
Otherwise, press "OK" to continue, no entry will be associated with this ID.'''), False, False, 0)
            errvbox1.pack_start(corerrorsw, True, True, 0)
            vbox1align = Gtk.Alignment.new(0, 0, 1, 1)
            vbox1align.add(errvbox1)
            #Now build a table for the buttons
            errtable = Gtk.Table(2, 1, False)
            errtable.set_row_spacings(5)
            errtable.set_col_spacings(5)
            errtable.set_border_width(5)
            btnKEEP = Gtk.Button('Keep entry')
            btnKEEP.connect('clicked', self.keep_correct, current_id, treeiter)

            btnCANCEL = GtkStockButton('close','Close')