1
2
3
4
5 import wx
6
7
8
9
10
13
14 kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME
15 wx.Dialog.__init__(self, *args, **kwds)
16 self._PNL_ea = wx.ScrolledWindow(self, -1, style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
17 self._TCTRL_status = wx.TextCtrl(self, -1, _("Info"), style=wx.TE_READONLY | wx.NO_BORDER)
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, (393, 201)))
41 self.SetMinSize((450, 300))
42 self._PNL_ea.SetScrollRate(10, 10)
43 self._TCTRL_status.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
44 self._TCTRL_status.SetForegroundColour(wx.Colour(255, 127, 0))
45 self._BTN_save.SetToolTipString(_("Save the entered data into the database and close the dialog."))
46 self._BTN_extra_left.SetToolTipString(_("Programmer forgot tooltip for left extra button."))
47 self._BTN_extra_left.Hide()
48 self._BTN_forward.SetToolTipString(_("Save data into database and clear fields for another value."))
49 self._BTN_revert.SetToolTipString(_("Reset all fields to their previous values."))
50 self._BTN_revert.Enable(False)
51 self._BTN_revert.Hide()
52 self._BTN_clear.SetToolTipString(_("Clear all fields."))
53 self._BTN_cancel.SetToolTipString(_("Cancel editing the data and discard changes."))
54 self._BTN_lucky.SetToolTipString(_("Press me !\n\n(This will NOT endanger any data.)"))
55
56
58
59 _szr_main = wx.BoxSizer(wx.VERTICAL)
60 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
61 __szr_pnl_ea = wx.BoxSizer(wx.HORIZONTAL)
62 __szr_pnl_ea.Add(self._PNL_ea, 1, wx.EXPAND, 0)
63 _szr_main.Add(__szr_pnl_ea, 1, wx.ALL | wx.EXPAND, 5)
64 _szr_main.Add(self._TCTRL_status, 0, wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
65 __szr_buttons.Add(self._BTN_save, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
66 __szr_buttons.Add(self._BTN_extra_left, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 3)
67 __szr_buttons.Add(self._BTN_forward, 0, wx.ALIGN_CENTER_VERTICAL, 3)
68 __szr_buttons.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
69 __szr_buttons.Add(self._BTN_revert, 0, 0, 0)
70 __szr_buttons.Add(self._BTN_clear, 0, wx.ALIGN_CENTER_VERTICAL, 0)
71 __szr_buttons.Add((20, 20), 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
72 __szr_buttons.Add(self._BTN_cancel, 0, wx.ALIGN_CENTER_VERTICAL, 0)
73 __szr_buttons.Add(self._BTN_lucky, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5)
74 _szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 5)
75 self.SetSizer(_szr_main)
76 self.Layout()
77 self.Centre()
78
79
81 print "Event handler `_on_save_button_pressed' not implemented!"
82 event.Skip()
83
85 print "Event handler `_on_left_extra_button_pressed' not implemented!"
86 event.Skip()
87
89 print "Event handler `_on_forward_button_pressed' not implemented!"
90 event.Skip()
91
93 print "Event handler `_on_revert_button_pressed' not implemented!"
94 event.Skip()
95
97 print "Event handler `_on_clear_button_pressed' not implemented!"
98 event.Skip()
99
101 print "Event handler `_on_lucky_button_pressed' not implemented!"
102 event.Skip()
103
104
105 if __name__ == "__main__":
106 import gettext
107 gettext.install("app")
108
109 app = wx.PySimpleApp(0)
110 wx.InitAllImageHandlers()
111 dialog_1 = wxgGenericEditAreaDlg2(None, -1, "")
112 app.SetTopWindow(dialog_1)
113 dialog_1.Show()
114 app.MainLoop()
115