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._BTN_save = wx.Button(self, wx.ID_SAVE, "")
21 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "")
22 self._BTN_restore = wx.Button(self, wx.ID_REVERT_TO_SAVED, "")
23 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
24
25 self.__set_properties()
26 self.__do_layout()
27
28 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
29 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
30 self.Bind(wx.EVT_BUTTON, self._on_restore_button_pressed, self._BTN_restore)
31
32
34
35 self.SetTitle(_("Generic multi line text entry dialog"))
36 self.SetSize((600, 641))
37 self._TCTRL_data.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
38 self._BTN_restore.Enable(False)
39
40
41 - def __do_layout(self):
42
43 __szr_main = wx.BoxSizer(wx.VERTICAL)
44 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
45 __szr_main.Add(self._LBL_msg, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 5)
46 __szr_main.Add(self._TCTRL_data, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
47 __szr_main.Add(self._TCTRL_text, 4, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 5)
48 __szr_buttons.Add(self._BTN_save, 0, wx.EXPAND, 5)
49 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
50 __szr_buttons.Add(self._BTN_clear, 0, wx.RIGHT|wx.EXPAND, 5)
51 __szr_buttons.Add(self._BTN_restore, 0, wx.EXPAND, 3)
52 __szr_buttons.Add((20, 20), 3, wx.EXPAND, 0)
53 __szr_buttons.Add(self._BTN_cancel, 0, wx.EXPAND, 3)
54 __szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 4)
55 self.SetSizer(__szr_main)
56 self.Layout()
57 self.Centre()
58
59
61 print "Event handler `_on_save_button_pressed' not implemented!"
62 event.Skip()
63
65 print "Event handler `_on_delete_button_pressed' not implemented"
66 event.Skip()
67
69 print "Event handler `_on_clear_button_pressed' not implemented"
70 event.Skip()
71
73 print "Event handler `_on_restore_button_pressed' not implemented"
74 event.Skip()
75
76
77
78
79 if __name__ == "__main__":
80 import gettext
81 gettext.install("app")
82
83 app = wx.PySimpleApp(0)
84 wx.InitAllImageHandlers()
85 dialog_1 = wxgMultilineTextEntryDlg(None, -1, "")
86 app.SetTopWindow(dialog_1)
87 dialog_1.Show()
88 app.MainLoop()
89