'Add the new spool and close the window.'

def onClickAdd(self, event):

    spool_name = self.name_dialog.field.GetValue()
    spool_length = getFloat(self, self.length_dialog.field.GetValue())
    if (not spool_length):
        self.statusbar.SetStatusText(('ERROR:    Unrecognized    length:    %s.' % self.length_dialog.field.GetValue()))
        return (-1)
    if (not (spool_length > 0)):
        self.statusbar.SetStatusText(('ERROR:    Length    is    zero    or    negative:    %.2f.' % spool_length))
        return (-1)
    if self.parent.spool_manager.isListed(spool_name):
        if checkOverwrite(self, spool_name):
            self.parent.spool_manager.remove(spool_name)
        else:
            return 0
    self.parent.spool_manager.add(spool_name, spool_length)
    self.parent.spool_list.refreshList(self.parent.spool_manager)
    self.parent.current_spools_dialog.refreshDialog(self.parent.spool_manager)
    self.parent.statusbar.SetStatusText((("Added    new    spool    '%s'" % spool_name) + ('    with    %.2f    mm    of    remaining    filament.' % spool_length)))
    self.Close(True)
