1
2
3
4
5
6 import wx
7
8
9 import gettext
10
11
12
13
14
15
18
19 kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
20 wx.Dialog.__init__(self, *args, **kwds)
21 self.SetSize(wx.DLG_UNIT(self, wx.Size(393, 201)))
22 self._PNL_ea = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.BORDER_NONE | wx.TAB_TRAVERSAL)
23 self._TCTRL_status = wx.TextCtrl(self, wx.ID_ANY, _("Info"), style=wx.TE_READONLY)
24 self._BTN_save = wx.Button(self, wx.ID_OK, "")
25 self._BTN_extra_left = wx.Button(self, wx.ID_ANY, _("left extra"), style=wx.BU_EXACTFIT)
26 self._BTN_forward = wx.Button(self, wx.ID_ANY, _("Add &another"))
27 self._BTN_revert = wx.Button(self, wx.ID_REVERT_TO_SAVED, "")
28 self._BTN_clear = wx.Button(self, wx.ID_CLEAR, "")
29 self._BTN_cancel = wx.Button(self, wx.ID_CANCEL, "")
30 self._BTN_lucky = wx.Button(self, wx.ID_ANY, _("Lala !"), style=wx.BU_EXACTFIT)
31
32 self.__set_properties()
33 self.__do_layout()
34
35 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._BTN_save)
36 self.Bind(wx.EVT_BUTTON, self._on_left_extra_button_pressed, self._BTN_extra_left)
37 self.Bind(wx.EVT_BUTTON, self._on_forward_button_pressed, self._BTN_forward)
38 self.Bind(wx.EVT_BUTTON, self._on_revert_button_pressed, self._BTN_revert)
39 self.Bind(wx.EVT_BUTTON, self._on_clear_button_pressed, self._BTN_clear)
40 self.Bind(wx.EVT_BUTTON, self._on_lucky_button_pressed, self._BTN_lucky)
41
42
44
45 self.SetTitle(_("GNUmed generic EditArea dialog"))
46 self.SetSize(wx.DLG_UNIT(self, wx.Size(393, 201)))
47 self.SetMinSize((450, 300))
48 self._PNL_ea.SetScrollRate(10, 10)
49 self._TCTRL_status.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND))
50 self._TCTRL_status.SetForegroundColour(wx.Colour(255, 127, 0))
51 self._BTN_save.SetToolTip(_("Save the entered data into the database and close the dialog."))
52 self._BTN_extra_left.SetToolTip(_("Programmer forgot tooltip for left extra button."))
53 self._BTN_extra_left.Hide()
54 self._BTN_forward.SetToolTip(_("Save data into database and clear fields for another value."))
55 self._BTN_revert.SetToolTip(_("Reset all fields to their previous values."))
56 self._BTN_revert.Enable(False)
57 self._BTN_revert.Hide()
58 self._BTN_clear.SetToolTip(_("Clear all fields."))
59 self._BTN_cancel.SetToolTip(_("Cancel editing the data and discard changes."))
60 self._BTN_lucky.SetToolTip(_("Press me !\n\n(This will, of course, NOT modify any data.)"))
61
62
64
65 _szr_main = wx.BoxSizer(wx.VERTICAL)
66 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
67 __szr_pnl_ea = wx.BoxSizer(wx.HORIZONTAL)
68 __szr_pnl_ea.Add(self._PNL_ea, 1, wx.EXPAND, 0)
69 _szr_main.Add(__szr_pnl_ea, 1, wx.ALL | wx.EXPAND, 5)
70 _szr_main.Add(self._TCTRL_status, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
71 __szr_buttons.Add(self._BTN_save, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
72 __szr_buttons.Add(self._BTN_extra_left, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
73 __szr_buttons.Add(self._BTN_forward, 0, wx.ALIGN_CENTER_VERTICAL, 3)
74 __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
75 __szr_buttons.Add(self._BTN_revert, 0, 0, 0)
76 __szr_buttons.Add(self._BTN_clear, 0, wx.ALIGN_CENTER_VERTICAL, 0)
77 __szr_buttons.Add((20, 20), 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
78 __szr_buttons.Add(self._BTN_cancel, 0, wx.ALIGN_CENTER_VERTICAL, 0)
79 __szr_buttons.Add(self._BTN_lucky, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
80 _szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 5)
81 self.SetSizer(_szr_main)
82 self.Layout()
83 self.Centre()
84
85
87 print("Event handler '_on_save_button_pressed' not implemented!")
88 event.Skip()
89
91 print("Event handler '_on_left_extra_button_pressed' not implemented!")
92 event.Skip()
93
95 print("Event handler '_on_forward_button_pressed' not implemented!")
96 event.Skip()
97
99 print("Event handler '_on_revert_button_pressed' not implemented!")
100 event.Skip()
101
103 print("Event handler '_on_clear_button_pressed' not implemented!")
104 event.Skip()
105
107 print("Event handler '_on_lucky_button_pressed' not implemented!")
108 event.Skip()
109
110
111