# Path: fstimer/printer/formatter.py
# def print_startsheets(pytimer, use_csv):
#     '''print startsheets to files'''
#     cols = get_startsheet_columns(pytimer)
#     col_fns = get_col_fns(pytimer, cols)
#     ranking_keys = set(['ID'])
#     rankings = defaultdict(lambda: 'ID')
#     printer = get_printer(pytimer, cols, use_csv, False)
#     # Build the results
#     ranked_results = {}
#     for ranking_key in ranking_keys:
#         ranked_results[ranking_key] = get_sorted_startsheet(
#                 pytimer.timedict, ranking_key, cols, col_fns)
#     fname_overall = '_'.join([os.path.basename(pytimer.path),
#                               'all_startsheet'])
#     fname_cat = '_'.join([os.path.basename(pytimer.path),
#                           'divisions_startsheet'])
#     gen_printouts(pytimer.timedict, pytimer.fieldsdic, pytimer.divisions, rankings,
#                   pytimer.path, printer, ranked_results, fname_overall, fname_cat)
# 
# Path: fstimer/gui/util_classes.py
# class MsgDialog(Gtk.Dialog):
#     
#     def __init__(self, parent, icon_name, buttons, title, text):
#         super(MsgDialog, self).__init__(title, parent, Gtk.DialogFlags.MODAL)
#         btn_list = []
#         for i, btn_name in enumerate(buttons):
#             icon, label, signal = dialog_buttons[btn_name]
#             btn = GtkStockButton(icon, label)
#             btn.connect('clicked', self.click_response, signal)
#             btn_list.append(btn)
#         self.set_border_width(5)
#         self.set_default_size(400, 50)
#         #Load in the icon
#         fname = os.path.join(icon_path, icon_files[icon_name])
#         msg_icon = Gtk.Image.new_from_file(fname)
#         label = Gtk.Label(label=text)
#         #And pack
#         hbox = Gtk.HBox(False, 0)
#         hbox.pack_start(msg_icon, False, False,10)
#         hbox.pack_start(label, False, False,10)
#         vbox = Gtk.VBox(False, 0)
#         vbox.pack_start(hbox, True, True, 15)
#         # Pack in all of the buttons
#         hbox_btns = Gtk.HBox(False, 0)
#         align = Gtk.Alignment.new(1, 0, 1, 0)
#         hbox_btns.pack_start(align, True, True, 0)
#         for btn in btn_list:
#             hbox_btns.pack_start(btn, False, False, 5)
#         vbox.pack_start(hbox_btns, False, False, 0)
#         self.get_content_area().add(vbox)
#         self.show_all()
#     
#     def click_response(self, w, signal):
#         self.response(signal)


import logging
import gi
import os, json, csv, re, datetime
import fstimer.gui.intro
import fstimer.gui.newproject
import fstimer.gui.projecttype
import fstimer.gui.definefields
import fstimer.gui.definedivisions
import fstimer.gui.printfields
import fstimer.gui.definerankings
import fstimer.gui.root
import fstimer.gui.about
import fstimer.gui.importprereg
import fstimer.gui.preregister
import fstimer.gui.register
import fstimer.gui.compile
import fstimer.gui.compileerrors
import fstimer.gui.pretime
import fstimer.gui.timing
from gi.repository import Gtk
from os.path import normpath, join, dirname, abspath, basename
from fstimer.printer.formatter import print_startsheets
from collections import defaultdict
from fstimer.gui.util_classes import MsgDialog
                # make sure there isn't an entry with everything else the same, but an ID
                dupcheck = False
                for i in range(len(self.reg_nodups0)):
                    dicttmp = self.reg_nodups0[i].copy()
                    if dicttmp['ID']:
                        #lets make sure we aren't a dup of this one
                        dicttmp['ID'] = ''
                        if reg == dicttmp:
                            dupcheck = True
                            break
                if not dupcheck:
                    self.reg_nodups.append(reg)
        # Now form the Timing dictionary, and check for errors.
        self.compilewin.setLabel(1, '<span color="blue">Checking for errors...</span>')
        # the timing dictionary. keys are IDs, values are registration dictionaries
        self.timedict = {}
        # the errors dictionary. keys are IDs, values are a list registration dictionaries with that ID
        self.errors = {}
        for reg in self.reg_nodups:
            # Any registration without an ID is left out of the timing dictionary
            if reg['ID']:
                # have we already added this ID to the timing dictionary?
                if reg['ID'] in self.timedict.keys():
                    # If so, then we need to first add to the list the reg that was already stored in timedict.
                    if reg['ID'] not in self.errors.keys():
                        self.errors[reg['ID']] = [self.timedict[reg['ID']]]
                    self.errors[reg['ID']].append(reg)
                else:
                    self.timedict[reg['ID']] = reg
        # If there are errors, we must correct them

# Path: fstimer/printer/formatter.py
# def print_startsheets(pytimer, use_csv):
#     '''print startsheets to files'''
#     cols = get_startsheet_columns(pytimer)
#     col_fns = get_col_fns(pytimer, cols)
#     ranking_keys = set(['ID'])
#     rankings = defaultdict(lambda: 'ID')
#     printer = get_printer(pytimer, cols, use_csv, False)
#     # Build the results
#     ranked_results = {}
#     for ranking_key in ranking_keys:
#         ranked_results[ranking_key] = get_sorted_startsheet(
#                 pytimer.timedict, ranking_key, cols, col_fns)
#     fname_overall = '_'.join([os.path.basename(pytimer.path),
#                               'all_startsheet'])
#     fname_cat = '_'.join([os.path.basename(pytimer.path),
#                           'divisions_startsheet'])
#     gen_printouts(pytimer.timedict, pytimer.fieldsdic, pytimer.divisions, rankings,
#                   pytimer.path, printer, ranked_results, fname_overall, fname_cat)
# 
# Path: fstimer/gui/util_classes.py
# class MsgDialog(Gtk.Dialog):
#     
#     def __init__(self, parent, icon_name, buttons, title, text):
#         super(MsgDialog, self).__init__(title, parent, Gtk.DialogFlags.MODAL)
#         btn_list = []
#         for i, btn_name in enumerate(buttons):
#             icon, label, signal = dialog_buttons[btn_name]
#             btn = GtkStockButton(icon, label)
#             btn.connect('clicked', self.click_response, signal)
#             btn_list.append(btn)
#         self.set_border_width(5)
#         self.set_default_size(400, 50)
#         #Load in the icon
#         fname = os.path.join(icon_path, icon_files[icon_name])
#         msg_icon = Gtk.Image.new_from_file(fname)
#         label = Gtk.Label(label=text)
#         #And pack
#         hbox = Gtk.HBox(False, 0)
#         hbox.pack_start(msg_icon, False, False,10)
#         hbox.pack_start(label, False, False,10)
#         vbox = Gtk.VBox(False, 0)
#         vbox.pack_start(hbox, True, True, 15)
#         # Pack in all of the buttons
#         hbox_btns = Gtk.HBox(False, 0)
#         align = Gtk.Alignment.new(1, 0, 1, 0)
#         hbox_btns.pack_start(align, True, True, 0)
#         for btn in btn_list:
#             hbox_btns.pack_start(btn, False, False, 5)
#         vbox.pack_start(hbox_btns, False, False, 0)
#         self.get_content_area().add(vbox)
#         self.show_all()
#     
#     def click_response(self, w, signal):
#         self.response(signal)


# Path: fstimer/timer.py
import logging
import gi
import os, json, csv, re, datetime
import fstimer.gui.intro
import fstimer.gui.newproject
import fstimer.gui.projecttype
import fstimer.gui.definefields
import fstimer.gui.definedivisions
import fstimer.gui.printfields
import fstimer.gui.definerankings
import fstimer.gui.root
import fstimer.gui.about
import fstimer.gui.importprereg
import fstimer.gui.preregister
import fstimer.gui.register
import fstimer.gui.compile
import fstimer.gui.compileerrors
import fstimer.gui.pretime
import fstimer.gui.timing
from gi.repository import Gtk
from os.path import normpath, join, dirname, abspath, basename
from fstimer.printer.formatter import print_startsheets
from collections import defaultdict
from fstimer.gui.util_classes import MsgDialog

                # make sure there isn't an entry with everything else the same, but an ID
                dupcheck = False
                for i in range(len(self.reg_nodups0)):
                    dicttmp = self.reg_nodups0[i].copy()
                    if dicttmp['ID']:
                        #lets make sure we aren't a dup of this one
                        dicttmp['ID'] = ''
                        if reg == dicttmp:
                            dupcheck = True
                            break
                if not dupcheck:
                    self.reg_nodups.append(reg)
        # Now form the Timing dictionary, and check for errors.
        self.compilewin.setLabel(1, '<span color="blue">Checking for errors...</span>')
        # the timing dictionary. keys are IDs, values are registration dictionaries
        self.timedict = {}
        # the errors dictionary. keys are IDs, values are a list registration dictionaries with that ID
        self.errors = {}
        for reg in self.reg_nodups:
            # Any registration without an ID is left out of the timing dictionary
            if reg['ID']:
                # have we already added this ID to the timing dictionary?
                if reg['ID'] in self.timedict.keys():
                    # If so, then we need to first add to the list the reg that was already stored in timedict.
                    if reg['ID'] not in self.errors.keys():
                        self.errors[reg['ID']] = [self.timedict[reg['ID']]]
                    self.errors[reg['ID']].append(reg)
                else:
                    self.timedict[reg['ID']] = reg
        # If there are errors, we must correct them

        if self.errors: