Gnumed.wxGladeWidgets.wxgUnhandledExceptionDlg

Package Gnumed :: Package wxGladeWidgets :: Module wxgUnhandledExceptionDlg |
[frames] | no frames]

# Source Code for Module Gnumed.wxGladeWidgets.wxgUnhandledExceptionDlg

      1  # -*- coding: UTF-8 -*-
      2  #
      3  # generated by wxGlade
      4  #
      5
      6  import wx
      7
      8  # begin wxGlade: dependencies
      9  import gettext
     10  # end wxGlade
     11
     12  # begin wxGlade: extracode
     13  # end wxGlade
     14
     15
     16 -class wxgUnhandledExceptionDlg(wx.Dialog):
     17 -        def __init__(self, *args, **kwds):
     18                  # begin wxGlade: wxgUnhandledExceptionDlg.__init__
     19                  kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
     20                  wx.Dialog.__init__(self, *args, **kwds)
     21                  self.__pnl_top_message = wx.Panel(self, wx.ID_ANY, style=wx.BORDER_NONE)
     22                  self._TCTRL_comment = wx.TextCtrl(self, wx.ID_ANY, "")
     23                  self._TCTRL_sender = wx.TextCtrl(self, wx.ID_ANY, _("<supply email address for getting feedback on bug report>"))
     24                  self._TCTRL_helpdesk = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
     25                  self._TCTRL_logfile = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
     26                  self._TCTRL_traceback = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.HSCROLL | wx.TE_MULTILINE | wx.TE_READONLY)
     27                  self._BTN_ok = wx.Button(self, wx.ID_OK, _("Keep running"))
     28                  self._BTN_close = wx.Button(self, wx.ID_CANCEL, _("Close GNUmed"))
     29                  self._BTN_abort = wx.Button(self, wx.ID_ANY, _(u"\u2620 Abort GNUmed \u2620"))
     30                  self._BTN_view_log = wx.Button(self, wx.ID_ANY, _("View log"))
     31                  self._BTN_mail = wx.Button(self, wx.ID_ANY, _("Send report"))
     32
     33                  self.__set_properties()
     34                  self.__do_layout()
     35
     36                  self.Bind(wx.EVT_BUTTON, self._on_close_gnumed_button_pressed, id=wx.ID_CANCEL)
     37                  self.Bind(wx.EVT_BUTTON, self._on_abort_gnumed_button_pressed, self._BTN_abort)
     38                  self.Bind(wx.EVT_BUTTON, self._on_view_log_button_pressed, self._BTN_view_log)
     39                  self.Bind(wx.EVT_BUTTON, self._on_mail_button_pressed, self._BTN_mail)
     40                  # end wxGlade
     41
     42 -        def __set_properties(self):
     43                  # begin wxGlade: wxgUnhandledExceptionDlg.__set_properties
     44                  self.SetTitle(_("GNUmed exception handler"))
     45                  self.__pnl_top_message.SetBackgroundColour(wx.Colour(255, 0, 0))
     46                  self._TCTRL_comment.SetToolTip(_("Enter any additional data or commentary you wish to provide such as what you were about to do."))
     47                  self._TCTRL_comment.SetFocus()
     48                  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."))
     49                  self._TCTRL_helpdesk.SetToolTip(_("Find help on http://wiki.gnumed.de, too."))
     50                  self._TCTRL_helpdesk.Enable(False)
     51                  self._TCTRL_logfile.Enable(False)
     52                  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."))
     53                  self._BTN_ok.SetDefault()
     54                  self._BTN_close.SetToolTip(_("Close this GNUmed client.\n\nThis will attempt to run normal shutdown and cleanup procedures."))
     55                  self._BTN_abort.SetToolTip(_("Abort this GNUmed client.\n\nThis will NOT invoke any shutdown and cleanup work."))
     56                  self._BTN_view_log.SetToolTip(_("View the log file."))
     57                  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."))
     58                  # end wxGlade
     59
     60 -        def __do_layout(self):
     61                  # begin wxGlade: wxgUnhandledExceptionDlg.__do_layout
     62                  __szr_main = wx.BoxSizer(wx.VERTICAL)
     63                  __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
     64                  __szr_middle = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Details")), wx.VERTICAL)
     65                  _gszr_details = wx.FlexGridSizer(4, 2, 3, 5)
     66                  __szr_top_inner = wx.BoxSizer(wx.VERTICAL)
     67                  __lbl_top_message = wx.StaticText(self.__pnl_top_message, wx.ID_ANY, _("An unhandled exception has occurred."), style=wx.ALIGN_CENTER)
     68                  __lbl_top_message.SetBackgroundColour(wx.Colour(255, 0, 0))
     69                  __lbl_top_message.SetForegroundColour(wx.Colour(255, 255, 0))
     70                  __lbl_top_message.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
     71                  __szr_top_inner.Add(__lbl_top_message, 0, wx.ALL | wx.EXPAND, 10)
     72                  self.__pnl_top_message.SetSizer(__szr_top_inner)
     73                  __szr_main.Add(self.__pnl_top_message, 0, wx.EXPAND, 0)
     74                  __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://wiki.gnumed.de>."))
     75                  __szr_main.Add(__lbl_explanation, 0, wx.ALL | wx.EXPAND, 5)
     76                  __lbl_comment = wx.StaticText(self, wx.ID_ANY, _("Comment"))
     77                  __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."))
     78                  _gszr_details.Add(__lbl_comment, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     79                  _gszr_details.Add(self._TCTRL_comment, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     80                  __lbl_sender = wx.StaticText(self, wx.ID_ANY, _("Sender"))
     81                  _gszr_details.Add(__lbl_sender, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     82                  _gszr_details.Add(self._TCTRL_sender, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     83                  __lbl_helpdesk = wx.StaticText(self, wx.ID_ANY, _("Help desk"))
     84                  _gszr_details.Add(__lbl_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     85                  _gszr_details.Add(self._TCTRL_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     86                  __lbl_logfile = wx.StaticText(self, wx.ID_ANY, _("Log file"))
     87                  _gszr_details.Add(__lbl_logfile, 0, wx.ALIGN_CENTER_VERTICAL, 0)
     88                  _gszr_details.Add(self._TCTRL_logfile, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
     89                  _gszr_details.AddGrowableCol(1)
     90                  __szr_middle.Add(_gszr_details, 0, wx.BOTTOM | wx.EXPAND | wx.TOP, 5)
     91                  __szr_middle.Add(self._TCTRL_traceback, 1, wx.EXPAND, 0)
     92                  __szr_main.Add(__szr_middle, 1, wx.ALL | wx.EXPAND, 5)
     93                  __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
     94                  __szr_buttons.Add(self._BTN_ok, 0, wx.EXPAND | wx.RIGHT, 3)
     95                  __szr_buttons.Add(self._BTN_close, 0, wx.EXPAND | wx.LEFT, 3)
     96                  __szr_buttons.Add(self._BTN_abort, 0, wx.EXPAND | wx.LEFT, 3)
     97                  __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
     98                  __szr_buttons.Add(self._BTN_view_log, 0, wx.EXPAND | wx.RIGHT, 3)
     99                  __szr_buttons.Add(self._BTN_mail, 0, wx.EXPAND | wx.LEFT, 3)
    100                  __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
    101                  __szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 5)
    102                  self.SetSizer(__szr_main)
    103                  __szr_main.Fit(self)
    104                  self.Layout()
    105                  self.Centre()
    106                  # end wxGlade
    107
    108 -        def _on_close_gnumed_button_pressed(self, event):  # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
    109                  print("Event handler '_on_close_gnumed_button_pressed' not implemented!")
    110                  event.Skip()
    111
    112 -        def _on_abort_gnumed_button_pressed(self, event):  # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
    113                  print("Event handler '_on_abort_gnumed_button_pressed' not implemented!")
    114                  event.Skip()
    115
    116 -        def _on_view_log_button_pressed(self, event):  # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
    117                  print("Event handler '_on_view_log_button_pressed' not implemented!")
    118                  event.Skip()
    119
    120 -        def _on_mail_button_pressed(self, event):  # wxGlade: wxgUnhandledExceptionDlg.<event_handler>
    121                  print("Event handler '_on_mail_button_pressed' not implemented!")
    122                  event.Skip()
    123
    124  # end of class wxgUnhandledExceptionDlg
    125