#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# generated by wxGlade 0.4.1 on Mon May  7 21:06:13 2007

import wx

class wxgUnhandledExceptionDlg(wx.Dialog):
    def __init__(self, *args, **kwds):
        # begin wxGlade: wxgUnhandledExceptionDlg.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.THICK_FRAME
        wx.Dialog.__init__(self, *args, **kwds)
        self.__szr_middle_staticbox = wx.StaticBox(self, -1, _("Details"))
        self.__pnl_top_message = wx.Panel(self, -1, style=wx.NO_BORDER)
        self._TCTRL_comment = wx.TextCtrl(self, -1, "")
        self._TCTRL_helpdesk = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY|wx.NO_BORDER)
        self._TCTRL_logfile = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY|wx.NO_BORDER)
        self._TCTRL_exc_type = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY|wx.NO_BORDER)
        self._TCTRL_exc_value = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY|wx.NO_BORDER)
        self._TCTRL_traceback = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
        self._BTN_ok = wx.Button(self, wx.ID_OK, _("Keep running"))
        self._BTN_close = wx.Button(self, wx.ID_CANCEL, _("Close GNUmed"))
        self._BTN_view_log = wx.Button(self, -1, _("View log"))
        self._BTN_mail = wx.Button(self, -1, _("Send report"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self._on_close_gnumed_button_pressed, id=wx.ID_CANCEL)
        self.Bind(wx.EVT_BUTTON, self._on_view_log_button_pressed, self._BTN_view_log)
        self.Bind(wx.EVT_BUTTON, self._on_mail_button_pressed, self._BTN_mail)
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: wxgUnhandledExceptionDlg.__set_properties
        self.SetTitle(_("GNUmed exception handler"))
        self.__pnl_top_message.SetBackgroundColour(wx.Colour(255, 0, 0))
        self._TCTRL_comment.SetFocus()
        self._TCTRL_helpdesk.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
        self._TCTRL_helpdesk.Enable(False)
        self._TCTRL_logfile.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
        self._TCTRL_logfile.Enable(False)
        self._TCTRL_exc_type.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
        self._TCTRL_exc_type.Enable(False)
        self._TCTRL_exc_value.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
        self._TCTRL_exc_value.Enable(False)
        self._BTN_ok.SetToolTipString(_("Close this dialog but keep running GNUmed."))
        self._BTN_ok.SetDefault()
        self._BTN_close.SetToolTipString(_("Close this dialog AND the GNUmed client."))
        self._BTN_view_log.SetToolTipString(_("View the log file."))
        self._BTN_mail.SetToolTipString(_("Email a bug report to the GNUmed developers."))
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: wxgUnhandledExceptionDlg.__do_layout
        __szr_main = wx.BoxSizer(wx.VERTICAL)
        __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
        __szr_middle = wx.StaticBoxSizer(self.__szr_middle_staticbox, wx.VERTICAL)
        _gszr_details = wx.FlexGridSizer(5, 2, 3, 5)
        __szr_top_inner = wx.BoxSizer(wx.VERTICAL)
        __lbl_top_message = wx.StaticText(self.__pnl_top_message, -1, _("An unhandled exception has occurred."), style=wx.ALIGN_CENTRE)
        __lbl_top_message.SetBackgroundColour(wx.Colour(255, 0, 0))
        __lbl_top_message.SetForegroundColour(wx.Colour(255, 255, 0))
        __lbl_top_message.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
        __szr_top_inner.Add(__lbl_top_message, 0, wx.ALL|wx.EXPAND, 10)
        self.__pnl_top_message.SetSizer(__szr_top_inner)
        __szr_main.Add(self.__pnl_top_message, 0, wx.EXPAND, 0)
        __lbl_explanation = wx.StaticText(self, -1, _("GNUmed detected an error for which no specific handler had been defined.\n\nDetails about the error can be found in the log file a copy of which has\nbeen saved away in your home directory (see below). It may contain\nbits of sensitive information so you may want to screen the content\nbefore handing it to IT staff for debugging.\n\nGNUmed will try to keep running. However, it is strongly advised to\nclose this GNUmed workplace as soon as possible. You can try to save\nunsaved data but don't count on it.\n\nIt should then be safe to restart GNUmed."))
        __szr_main.Add(__lbl_explanation, 0, wx.ALL|wx.EXPAND, 5)
        __lbl_comment = wx.StaticText(self, -1, _("Comment"))
        __lbl_comment.SetToolTipString(_("Enter a short comment on what you were trying to do with GNUmed. This information will be added to the logfile for easier identification later on."))
        _gszr_details.Add(__lbl_comment, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        _gszr_details.Add(self._TCTRL_comment, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
        __lbl_helpdesk = wx.StaticText(self, -1, _("Help desk"))
        _gszr_details.Add(__lbl_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        _gszr_details.Add(self._TCTRL_helpdesk, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
        __lbl_logfile = wx.StaticText(self, -1, _("Log file"))
        _gszr_details.Add(__lbl_logfile, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        _gszr_details.Add(self._TCTRL_logfile, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
        __lbl_type = wx.StaticText(self, -1, _("Type"))
        _gszr_details.Add(__lbl_type, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        _gszr_details.Add(self._TCTRL_exc_type, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
        __lbl_value = wx.StaticText(self, -1, _("Value"))
        _gszr_details.Add(__lbl_value, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        _gszr_details.Add(self._TCTRL_exc_value, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
        _gszr_details.AddGrowableCol(1)
        __szr_middle.Add(_gszr_details, 0, wx.TOP|wx.BOTTOM|wx.EXPAND, 5)
        __szr_middle.Add(self._TCTRL_traceback, 1, wx.EXPAND, 0)
        __szr_main.Add(__szr_middle, 1, wx.ALL|wx.EXPAND, 5)
        __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
        __szr_buttons.Add(self._BTN_ok, 0, wx.RIGHT|wx.EXPAND, 3)
        __szr_buttons.Add(self._BTN_close, 0, wx.LEFT|wx.EXPAND, 3)
        __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
        __szr_buttons.Add(self._BTN_view_log, 0, wx.RIGHT|wx.EXPAND, 3)
        __szr_buttons.Add(self._BTN_mail, 0, wx.LEFT|wx.EXPAND, 3)
        __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
        __szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 5)
        self.SetSizer(__szr_main)
        __szr_main.Fit(self)
        self.Layout()
        self.Centre()
        # end wxGlade

    def _on_close_gnumed_button_pressed(self, event): # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
        print "Event handler `_on_close_gnumed_button_pressed' not implemented"
        event.Skip()

    def __on_keep_running_button_pressed(self, event): # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
        print "Event handler `__on_keep_running_button_pressed' not implemented"
        event.Skip()

    def __on_close_gnumed_button_pressed(self, event): # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
        print "Event handler `__on_close_gnumed_button_pressed' not implemented"
        event.Skip()

    def _on_mail_button_pressed(self, event): # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
        print "Event handler `_on_mail_button_pressed' not implemented"
        event.Skip()

    def _on_view_log_button_pressed(self, event): # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
        print "Event handler `_on_view_log_button_pressed' not implemented"
        event.Skip()

# end of class wxgUnhandledExceptionDlg


