# Path: pytrainer/gui/dialogs.py
# def warning_dialog(text="", title="Warning", cancel=False):
#     if cancel:
#         dialog = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION,
#                                        buttons=Gtk.ButtonsType.OK_CANCEL,
#                                        message_format=text,
#                                        flags=Gtk.DialogFlags.MODAL)
#     else:
#         dialog = Gtk.MessageDialog(type=Gtk.MessageType.WARNING,
#                                        buttons=Gtk.ButtonsType.OK,
#                                        message_format=text,
#                                        flags=Gtk.DialogFlags.MODAL)
#     dialog.set_title(title)
#     result = dialog.run()
#     dialog.destroy()
#     return result


from pytrainer.gui.dialogs import warning_dialog
from gi.repository import Gtk
import warnings
        self.title = "Warning"

    def set_title(self, title):
        self.title = title

    def set_text(self, msg):
        self.text = msg

    def on_accept_clicked(self):
        if self.okparams != None:
            num = len(self.okparams)
            if num==0:
                self.okmethod()
            if num==1:
                self.okmethod(self.okparams[0])
            if num==2:
                self.okmethod(self.okparams[0],self.okparams[1])

    def on_cancel_clicked(self):
        if self.cancelparams != None:
            num = len(self.cancelparams)
            if num==0:
                self.cancelmethod()
            if num==1:
                self.cancelmethod(self.cancelparams[0])
            if num==2:
                self.cancelmethod(self.cancelparams[0], self.cancelparams[1])

    def run(self):
        if self.okmethod:

# Path: pytrainer/gui/dialogs.py
# def warning_dialog(text="", title="Warning", cancel=False):
#     if cancel:
#         dialog = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION,
#                                        buttons=Gtk.ButtonsType.OK_CANCEL,
#                                        message_format=text,
#                                        flags=Gtk.DialogFlags.MODAL)
#     else:
#         dialog = Gtk.MessageDialog(type=Gtk.MessageType.WARNING,
#                                        buttons=Gtk.ButtonsType.OK,
#                                        message_format=text,
#                                        flags=Gtk.DialogFlags.MODAL)
#     dialog.set_title(title)
#     result = dialog.run()
#     dialog.destroy()
#     return result


# Path: pytrainer/gui/warning.py
from pytrainer.gui.dialogs import warning_dialog
from gi.repository import Gtk
import warnings

        self.title = "Warning"

    def set_title(self, title):
        self.title = title

    def set_text(self, msg):
        self.text = msg

    def on_accept_clicked(self):
        if self.okparams != None:
            num = len(self.okparams)
            if num==0:
                self.okmethod()
            if num==1:
                self.okmethod(self.okparams[0])
            if num==2:
                self.okmethod(self.okparams[0],self.okparams[1])

    def on_cancel_clicked(self):
        if self.cancelparams != None:
            num = len(self.cancelparams)
            if num==0:
                self.cancelmethod()
            if num==1:
                self.cancelmethod(self.cancelparams[0])
            if num==2:
                self.cancelmethod(self.cancelparams[0], self.cancelparams[1])

    def run(self):
        if self.okmethod:

            response = warning_dialog(text=self.text, title=self.title, cancel=True)