1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13
14
15
18
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, _("Please supply your email address here !"))
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_exc_type = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
27 self._TCTRL_exc_value = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
28 self._TCTRL_traceback = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.HSCROLL | wx.TE_MULTILINE | wx.TE_READONLY)
29 self._BTN_ok = wx.Button(self, wx.ID_OK, _("Keep running"))
30 self._BTN_close = wx.Button(self, wx.ID_CANCEL, _("Close GNUmed"))
31 self._BTN_view_log = wx.Button(self, wx.ID_ANY, _("View log"))
32 self._BTN_mail = wx.Button(self, wx.ID_ANY, _("Send report"))
33
34 self.__set_properties()
35 self.__do_layout()
36
37 self.Bind(wx.EVT_BUTTON, self._on_close_gnumed_button_pressed, id=wx.ID_CANCEL)
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
41
43
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 (http://lists.gnu.org/mailman/listinfo/gnumed-bugs) ONLY to which you will then have to subscribe."))
49 self._TCTRL_helpdesk.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
50 self._TCTRL_helpdesk.SetToolTip(_("Find help on http://wiki.gnumed.de, too."))
51 self._TCTRL_helpdesk.Enable(False)
52 self._TCTRL_logfile.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
53 self._TCTRL_logfile.Enable(False)
54 self._TCTRL_exc_type.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
55 self._TCTRL_exc_type.Enable(False)
56 self._TCTRL_exc_value.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
57 self._TCTRL_exc_value.Enable(False)
58 self._BTN_ok.SetToolTip(_("Close this dialog but keep running GNUmed."))
59 self._BTN_ok.SetDefault()
60 self._BTN_close.SetToolTip(_("Close this dialog AND the GNUmed client."))
61 self._BTN_view_log.SetToolTip(_("View the log file."))
62 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."))
63
64
66
67 __szr_main = wx.BoxSizer(wx.VERTICAL)
68 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
69 __szr_middle = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, _("Details")), wx.VERTICAL)
70 _gszr_details = wx.FlexGridSizer(6, 2, 3, 5)
71 __szr_top_inner = wx.BoxSizer(wx.VERTICAL)
72 __lbl_top_message = wx.StaticText(self.__pnl_top_message, wx.ID_ANY, _("An unhandled exception has occurred."), style=wx.ALIGN_CENTER)
73 __lbl_top_message.SetBackgroundColour(wx.Colour(255, 0, 0))
74 __lbl_top_message.SetForegroundColour(wx.Colour(255, 255, 0))
75 __lbl_top_message.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
76 __szr_top_inner.Add(__lbl_top_message, 0, wx.ALL | wx.EXPAND, 10)
77 self.__pnl_top_message.SetSizer(__szr_top_inner)
78 __szr_main.Add(self.__pnl_top_message, 0, wx.EXPAND, 0)
79 __lbl_explanation = wx.StaticText(self, wx.ID_ANY, _("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.\n\nDocumentation to be found at <http://wiki.gnumed.de>."))
80 __szr_main.Add(__lbl_explanation, 0, wx.ALL | wx.EXPAND, 5)
81 __lbl_comment = wx.StaticText(self, wx.ID_ANY, _("Comment"))
82 __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."))
83 _gszr_details.Add(__lbl_comment, 0, wx.ALIGN_CENTER_VERTICAL, 0)
84 _gszr_details.Add(self._TCTRL_comment, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
85 __lbl_sender = wx.StaticText(self, wx.ID_ANY, _("Sender"))
86 _gszr_details.Add(__lbl_sender, 0, wx.ALIGN_CENTER_VERTICAL, 0)
87 _gszr_details.Add(self._TCTRL_sender, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
88 __lbl_helpdesk = wx.StaticText(self, wx.ID_ANY, _("Help desk"))
89 _gszr_details.Add(__lbl_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL, 0)
90 _gszr_details.Add(self._TCTRL_helpdesk, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
91 __lbl_logfile = wx.StaticText(self, wx.ID_ANY, _("Log file"))
92 _gszr_details.Add(__lbl_logfile, 0, wx.ALIGN_CENTER_VERTICAL, 0)
93 _gszr_details.Add(self._TCTRL_logfile, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
94 __lbl_type = wx.StaticText(self, wx.ID_ANY, _("Type"))
95 _gszr_details.Add(__lbl_type, 0, wx.ALIGN_CENTER_VERTICAL, 0)
96 _gszr_details.Add(self._TCTRL_exc_type, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
97 __lbl_value = wx.StaticText(self, wx.ID_ANY, _("Value"))
98 _gszr_details.Add(__lbl_value, 0, wx.ALIGN_CENTER_VERTICAL, 0)
99 _gszr_details.Add(self._TCTRL_exc_value, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
100 _gszr_details.AddGrowableCol(1)
101 __szr_middle.Add(_gszr_details, 0, wx.BOTTOM | wx.EXPAND | wx.TOP, 5)
102 __szr_middle.Add(self._TCTRL_traceback, 1, wx.EXPAND, 0)
103 __szr_main.Add(__szr_middle, 1, wx.ALL | wx.EXPAND, 5)
104 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
105 __szr_buttons.Add(self._BTN_ok, 0, wx.EXPAND | wx.RIGHT, 3)
106 __szr_buttons.Add(self._BTN_close, 0, wx.EXPAND | wx.LEFT, 3)
107 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
108 __szr_buttons.Add(self._BTN_view_log, 0, wx.EXPAND | wx.RIGHT, 3)
109 __szr_buttons.Add(self._BTN_mail, 0, wx.EXPAND | wx.LEFT, 3)
110 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
111 __szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 5)
112 self.SetSizer(__szr_main)
113 __szr_main.Fit(self)
114 self.Layout()
115 self.Centre()
116
117
119 print("Event handler '_on_close_gnumed_button_pressed' not implemented!")
120 event.Skip()
121
123 print("Event handler '_on_view_log_button_pressed' not implemented!")
124 event.Skip()
125
127 print("Event handler '_on_mail_button_pressed' not implemented!")
128 event.Skip()
129
130
131