1
2
3
4
5 import wx
6
7
8
9
10
11
13 - def __init__(self, *args, **kwds):
14
15 from Gnumed.wxpython import gmTextCtrl
16
17
18 kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME
19 wx.Dialog.__init__(self, *args, **kwds)
20 self._LBL_msg = wx.StaticText(self, -1, "")
21 self._TCTRL_data = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP | wx.NO_BORDER)
22 self._TCTRL_text = gmTextCtrl.cTextCtrl(self, -1, "", style=wx.TE_MULTILINE | wx.TE_WORDWRAP)
23 self._CHBOX_is_already_formatted = wx.CheckBox(self, -1, _("Do not reformat text"))
24 self._BTN_save = wx.Button(self, wx.ID_SAVE, "")
25 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "")
26 self._BTN_restore = wx.Button(self, wx.ID_REVERT_TO_SAVED, "")
27 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
28
29 self.__set_properties()
30 self.__do_layout()
31
32 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
33 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
34 self.Bind(wx.EVT_BUTTON, self._on_restore_button_pressed, self._BTN_restore)
35
36
38
39 self.SetTitle(_("Generic multi line text entry dialog"))
40 self.SetSize((600, 641))
41 self._TCTRL_data.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
42 self._CHBOX_is_already_formatted.SetToolTipString(_("Leave this unchecked so that GNUmed can check for characters that need escaping or transforming.\n\nUse this option when you have put in raw formatting, like HTML or LaTeX, that you are confident should be left untouched."))
43 self._CHBOX_is_already_formatted.Enable(False)
44 self._BTN_restore.Enable(False)
45
46
47 - def __do_layout(self):
48
49 __szr_main = wx.BoxSizer(wx.VERTICAL)
50 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
51 __szr_options = wx.BoxSizer(wx.HORIZONTAL)
52 __szr_main.Add(self._LBL_msg, 0, wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, 5)
53 __szr_main.Add(self._TCTRL_data, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
54 __szr_main.Add(self._TCTRL_text, 4, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 5)
55 __szr_options.Add(self._CHBOX_is_already_formatted, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
56 __szr_options.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
57 __szr_main.Add(__szr_options, 0, wx.ALL | wx.EXPAND, 5)
58 __szr_buttons.Add(self._BTN_save, 0, wx.EXPAND, 5)
59 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
60 __szr_buttons.Add(self._BTN_clear, 0, wx.RIGHT | wx.EXPAND, 5)
61 __szr_buttons.Add(self._BTN_restore, 0, wx.EXPAND, 3)
62 __szr_buttons.Add((20, 20), 3, wx.EXPAND, 0)
63 __szr_buttons.Add(self._BTN_cancel, 0, wx.EXPAND, 3)
64 __szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 4)
65 self.SetSizer(__szr_main)
66 self.Layout()
67 self.Centre()
68
69
71 print "Event handler `_on_save_button_pressed' not implemented!"
72 event.Skip()
73
75 print "Event handler `_on_delete_button_pressed' not implemented"
76 event.Skip()
77
79 print "Event handler `_on_clear_button_pressed' not implemented"
80 event.Skip()
81
83 print "Event handler `_on_restore_button_pressed' not implemented"
84 event.Skip()
85
86
87
88
89 if __name__ == "__main__":
90 import gettext
91 gettext.install("app")
92
93 app = wx.PySimpleApp(0)
94 wx.InitAllImageHandlers()
95 dialog_1 = wxgMultilineTextEntryDlg(None, -1, "")
96 app.SetTopWindow(dialog_1)
97 dialog_1.Show()
98 app.MainLoop()
99