# -*- coding: UTF-8 -*-
#
# generated by wxGlade
#

import wx

# begin wxGlade: dependencies
import gettext
# end wxGlade

# begin wxGlade: extracode
# end wxGlade


class wxgUnhandledExceptionDlg(wx.Dialog):
	def __init__(self, *args, **kwds):
		# begin wxGlade: wxgUnhandledExceptionDlg.__init__
		kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
		wx.Dialog.__init__(self, *args, **kwds)
		self.__pnl_top_message = wx.Panel(self, wx.ID_ANY, style=wx.BORDER_NONE)
		self._TCTRL_comment = wx.TextCtrl(self, wx.ID_ANY, "")
		self._TCTRL_sender = wx.TextCtrl(self, wx.ID_ANY, _("<supply email address for getting feedback on bug report>"))
		self._TCTRL_helpdesk = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
		self._TCTRL_logfile = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
		self._TCTRL_traceback = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.HSCROLL | wx.TE_MULTILINE | wx.TE_READONLY)
		self._BTN_ok = wx.Button(self, wx.ID_OK, _("Keep running"))
		self._BTN_close = wx.Button(self, wx.ID_CANCEL, _("Close GNUmed"))
		self._BTN_abort = wx.Button(self, wx.ID_ANY, _(u"\u2620 Abort GNUmed \u2620"))
		self._BTN_view_log = wx.Button(self, wx.ID_ANY, _("View log"))
		self._BTN_mail = wx.Button(self, wx.ID_ANY, _("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_abort_gnumed_button_pressed, self._BTN_abort)
		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.SetToolTip(_("Enter any additional data or commentary you wish to provide such as what you were about to do."))
		self._TCTRL_comment.SetFocus()
		self._TCTRL_sender.SetToolTip(_("Please enter your email address so we can provide help to you directly.\n\nOtherwise, feedback can be given on the GNUmed mailing list ONLY (http://lists.gnu.org/mailman/listinfo/gnumed-bugs) to which you will then have to subscribe."))
		self._TCTRL_helpdesk.SetToolTip(_("Find help on http://www.gnumed.de, too."))
		self._TCTRL_helpdesk.Enable(False)
		self._TCTRL_logfile.Enable(False)
		self._BTN_ok.SetToolTip(_("Close this dialog but keep open the GNUmed client.\n\nYou should manually restart the client as soon as possible, however."))
		self._BTN_ok.SetDefault()
		self._BTN_close.SetToolTip(_("Close this GNUmed client.\n\nThis will attempt to run normal shutdown and cleanup procedures."))
		self._BTN_abort.SetToolTip(_("Abort this GNUmed client.\n\nThis will NOT invoke any shutdown and cleanup work."))
		self._BTN_view_log.SetToolTip(_("View the log file."))
		self._BTN_mail.SetToolTip(_("Email a bug report to the GNUmed developers.\n\nMost questions will be answered on the mailing list so you are well advised to either subscribe or check its archive (http://lists.gnu.org/mailman/listinfo/gnumed-bugs).\n\nIf you specify your address in the Sender field above the developers will be able to contact you directly for feedback."))
		# 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(wx.StaticBox(self, wx.ID_ANY, _("Details")), wx.VERTICAL)
		_gszr_details = wx.FlexGridSizer(4, 2, 3, 5)
		__szr_top_inner = wx.BoxSizer(wx.VERTICAL)
		__lbl_top_message = wx.StaticText(self.__pnl_top_message, wx.ID_ANY, _("An unhandled exception has occurred."), style=wx.ALIGN_CENTER)
		__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, wx.ID_ANY, _("GNUmed detected an error for which no specific handling had been defined.\n\nDetails about the error can be found in the log file, a copy of which has\nbeen stored 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\nYou can choose to keep open this GNUmed workplace. However, it is strongly\nadvised to restart this workplace as soon as possible. Meanwhile you can try\nto save unsaved data but don't count on it.\n\nIt should then be safe to restart GNUmed.\n\nDocumentation can be found at <http://www.gnumed.de>."))
		__szr_main.Add(__lbl_explanation, 0, wx.ALL | wx.EXPAND, 5)
		__lbl_comment = wx.StaticText(self, wx.ID_ANY, _("Comment"))
		__lbl_comment.SetToolTip(_("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.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
		__lbl_sender = wx.StaticText(self, wx.ID_ANY, _("Sender"))
		_gszr_details.Add(__lbl_sender, 0, wx.ALIGN_CENTER_VERTICAL, 0)
		_gszr_details.Add(self._TCTRL_sender, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
		__lbl_helpdesk = wx.StaticText(self, wx.ID_ANY, _("Help desk"))
		_gszr_details.Add(__lbl_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL, 0)
		_gszr_details.Add(self._TCTRL_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
		__lbl_logfile = wx.StaticText(self, wx.ID_ANY, _("Log file"))
		_gszr_details.Add(__lbl_logfile, 0, wx.ALIGN_CENTER_VERTICAL, 0)
		_gszr_details.Add(self._TCTRL_logfile, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
		_gszr_details.AddGrowableCol(1)
		__szr_middle.Add(_gszr_details, 0, wx.BOTTOM | wx.EXPAND | wx.TOP, 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.EXPAND | wx.RIGHT, 3)
		__szr_buttons.Add(self._BTN_close, 0, wx.EXPAND | wx.LEFT, 3)
		__szr_buttons.Add(self._BTN_abort, 0, wx.EXPAND | wx.LEFT, 3)
		__szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
		__szr_buttons.Add(self._BTN_view_log, 0, wx.EXPAND | wx.RIGHT, 3)
		__szr_buttons.Add(self._BTN_mail, 0, wx.EXPAND | wx.LEFT, 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_abort_gnumed_button_pressed(self, event):  # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
		print("Event handler '_on_abort_gnumed_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()

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

# end of class wxgUnhandledExceptionDlg
