#
#   Python GUI - Alerts - Generic
#

from BaseAlerts import BaseAlert
from Buttons import Button


class Alert(BaseAlert):

    def __init__(self, kind, prompt,
            ok_label = "OK", default = 1, **kwds):
        BaseAlert.__init__(self, kind, prompt,
            button_labels = [ok_label], default = default, **kwds)

    def create_buttons(self, ok_label):
        self.yes_button = Button(title = ok_label, action = self.yes)
        #self.default_button = self.ok_button


class Alert2(BaseAlert):

    def __init__(self, kind, prompt,
            yes_label = "Yes", no_label = "No",
            default = 1, cancel = 0, **kwds):
        BaseAlert.__init__(self, kind, prompt,
            button_labels = [yes_label, no_label],
            default = default, cancel = cancel, **kwds)

    def create_buttons(self, yes_label, no_label):
        self.yes_button = Button(title = yes_label, action = self.yes)
        self.no_button = Button(title = no_label, action = self.no)


class Alert3(BaseAlert):

    def __init__(self, kind, prompt,
            yes_label = "Yes", no_label = "No", other_label = "Cancel",
            default = 1, cancel = -1, **kwds):
        BaseAlert.__init__(self, kind, prompt,
            button_labels = [yes_label, no_label, other_label],
            default = default, cancel = cancel, **kwds)

    def create_buttons(self, yes_label, no_label, cancel_label):
        self.yes_button = Button(title = yes_label, action = self.yes)
        self.no_button = Button(title = no_label, action = self.no)
        self.other_button = Button(title = cancel_label, action = self.other)
