1
2
3
4
5 import wx
6
7
8
9
10
11
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._PNL_ea = wx.ScrolledWindow(self, -1, style=wx.NO_BORDER|wx.TAB_TRAVERSAL)
18 self._BTN_save = wx.Button(self, wx.ID_OK, "")
19 self._BTN_extra_left = wx.Button(self, -1, _("left extra"), style=wx.BU_EXACTFIT)
20 self._BTN_forward = wx.Button(self, -1, _("Add &another"))
21 self._BTN_revert = wx.Button(self, wx.ID_REVERT_TO_SAVED, "")
22 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "")
23 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
24 self._BTN_lucky = wx.Button(self, -1, _("Lala !"), style=wx.BU_EXACTFIT)
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_left_extra_button_pressed, self._BTN_extra_left)
31 self.Bind(wx.EVT_BUTTON, self._on_forward_button_pressed, self._BTN_forward)
32 self.Bind(wx.EVT_BUTTON, self._on_revert_button_pressed, self._BTN_revert)
33 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
34 self.Bind(wx.EVT_BUTTON, self._on_lucky_button_pressed, self._BTN_lucky)
35
36
38
39 self.SetTitle(_("GNUmed generic EditArea dialog"))
40 self.SetSize(wx.DLG_SZE(self, (311, 165)))
41 self.SetMinSize((450, 300))
42 self._PNL_ea.SetScrollRate(10, 10)
43 self._BTN_save.SetToolTipString(_("Save the entered data into the database and close the dialog."))
44 self._BTN_extra_left.SetToolTipString(_("Programmer forgot tooltip for left extra button."))
45 self._BTN_extra_left.Hide()
46 self._BTN_forward.SetToolTipString(_("Save data into database and clear fields for another value."))
47 self._BTN_revert.SetToolTipString(_("Reset all fields to their previous values."))
48 self._BTN_revert.Enable(False)
49 self._BTN_revert.Hide()
50 self._BTN_clear.SetToolTipString(_("Clear all fields."))
51 self._BTN_cancel.SetToolTipString(_("Cancel editing the data and discard changes."))
52 self._BTN_lucky.SetToolTipString(_("Press me !\n\n(This will NOT endanger any data.)"))
53
54
56
57 _szr_main = wx.BoxSizer(wx.VERTICAL)
58 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
59 __szr_pnl_ea = wx.BoxSizer(wx.HORIZONTAL)
60 __szr_pnl_ea.Add(self._PNL_ea, 1, wx.EXPAND, 0)
61 _szr_main.Add(__szr_pnl_ea, 1, wx.ALL|wx.EXPAND, 5)
62 __szr_buttons.Add(self._BTN_save, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
63 __szr_buttons.Add(self._BTN_extra_left, 0, wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
64 __szr_buttons.Add(self._BTN_forward, 0, wx.ALIGN_CENTER_VERTICAL, 3)
65 __szr_buttons.Add((20, 20), 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
66 __szr_buttons.Add(self._BTN_revert, 0, 0, 0)
67 __szr_buttons.Add(self._BTN_clear, 0, wx.ALIGN_CENTER_VERTICAL, 0)
68 __szr_buttons.Add((20, 20), 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
69 __szr_buttons.Add(self._BTN_cancel, 0, wx.ALIGN_CENTER_VERTICAL, 0)
70 __szr_buttons.Add(self._BTN_lucky, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5)
71 _szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 5)
72 self.SetSizer(_szr_main)
73 self.Layout()
74 self.Centre()
75
76
78 print "Event handler `_on_save_button_pressed' not implemented!"
79 event.Skip()
80
82 print "Event handler `_on_left_extra_button_pressed' not implemented!"
83 event.Skip()
84
86 print "Event handler `_on_forward_button_pressed' not implemented!"
87 event.Skip()
88
90 print "Event handler `_on_revert_button_pressed' not implemented!"
91 event.Skip()
92
94 print "Event handler `_on_clear_button_pressed' not implemented!"
95 event.Skip()
96
98 print "Event handler `_on_lucky_button_pressed' not implemented!"
99 event.Skip()
100
101
102
103
104 if __name__ == "__main__":
105 import gettext
106 gettext.install("app")
107
108 app = wx.PySimpleApp(0)
109 wx.InitAllImageHandlers()
110 dialog_1 = wxgGenericEditAreaDlg2(None, -1, "")
111 app.SetTopWindow(dialog_1)
112 dialog_1.Show()
113 app.MainLoop()
114