1
2
3
4
5 import wx
6
7
8
9
10
11
13 - def __init__(self, *args, **kwds):
14
15 kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.THICK_FRAME
16 wx.Dialog.__init__(self, *args, **kwds)
17 self._LBL_msg = wx.StaticText(self, -1, "")
18 self._TCTRL_data = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_WORDWRAP|wx.NO_BORDER)
19 self._TCTRL_text = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.HSCROLL)
20 self._CHBOX_is_already_formatted = wx.CheckBox(self, -1, _("Is manually formatted"))
21 self._BTN_save = wx.Button(self, wx.ID_SAVE, "")
22 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "")
23 self._BTN_restore = wx.Button(self, wx.ID_REVERT_TO_SAVED, "")
24 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
25
26 self.__set_properties()
27 self.__do_layout()
28
29 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
30 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
31 self.Bind(wx.EVT_BUTTON, self._on_restore_button_pressed, self._BTN_restore)
32
33
35
36 self.SetTitle(_("Generic multi line text entry dialog"))
37 self.SetSize((600, 641))
38 self._TCTRL_data.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
39 self._CHBOX_is_already_formatted.SetToolTipString(_("Check this if the text you entered is already manually pre-formatted, valid text in the sense of the target format.\n\nTypically you would leave this unchecked so that GNUmed verifies that your input is suitably formatted for the intended purpose. However, sometimes you may want to enter, say, raw LaTeX. In this case you can check this to prevent GNUmed from mangling your text."))
40 self._CHBOX_is_already_formatted.Enable(False)
41 self._BTN_restore.Enable(False)
42
43
44 - def __do_layout(self):
45
46 __szr_main = wx.BoxSizer(wx.VERTICAL)
47 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
48 __szr_options = wx.BoxSizer(wx.HORIZONTAL)
49 __szr_main.Add(self._LBL_msg, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 5)
50 __szr_main.Add(self._TCTRL_data, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
51 __szr_main.Add(self._TCTRL_text, 4, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
52 __szr_options.Add(self._CHBOX_is_already_formatted, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
53 __szr_options.Add((20, 20), 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
54 __szr_main.Add(__szr_options, 0, wx.ALL|wx.EXPAND, 5)
55 __szr_buttons.Add(self._BTN_save, 0, wx.EXPAND, 5)
56 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
57 __szr_buttons.Add(self._BTN_clear, 0, wx.RIGHT|wx.EXPAND, 5)
58 __szr_buttons.Add(self._BTN_restore, 0, wx.EXPAND, 3)
59 __szr_buttons.Add((20, 20), 3, wx.EXPAND, 0)
60 __szr_buttons.Add(self._BTN_cancel, 0, wx.EXPAND, 3)
61 __szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 4)
62 self.SetSizer(__szr_main)
63 self.Layout()
64 self.Centre()
65
66
68 print "Event handler `_on_save_button_pressed' not implemented!"
69 event.Skip()
70
72 print "Event handler `_on_delete_button_pressed' not implemented"
73 event.Skip()
74
76 print "Event handler `_on_clear_button_pressed' not implemented"
77 event.Skip()
78
80 print "Event handler `_on_restore_button_pressed' not implemented"
81 event.Skip()
82
83
84
85
86 if __name__ == "__main__":
87 import gettext
88 gettext.install("app")
89
90 app = wx.PySimpleApp(0)
91 wx.InitAllImageHandlers()
92 dialog_1 = wxgMultilineTextEntryDlg(None, -1, "")
93 app.SetTopWindow(dialog_1)
94 dialog_1.Show()
95 app.MainLoop()
96