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._TXT_person = wx.TextCtrl(self, wx.ID_ANY, _("Data of current patient to be displayed here."), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP)
22 self._TXT_short_alias = wx.TextCtrl(self, wx.ID_ANY, "")
23 self._TXT_account = wx.TextCtrl(self, wx.ID_ANY, "")
24 self._TXT_password = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD)
25 self._TXT_password_again = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD)
26 self._TXT_dbo_password = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD)
27 self._BTN_enlist = wx.Button(self, wx.ID_ANY, _("Enlist"))
28 self._BTN_cancel = wx.Button(self, wx.ID_ANY, _("Cancel"))
29
30 self.__set_properties()
31 self.__do_layout()
32
33 self.Bind(wx.EVT_BUTTON, self._on_enlist_button_pressed, self._BTN_enlist)
34 self.Bind(wx.EVT_BUTTON, self._on_cancel_button_pressed, self._BTN_cancel)
35
36
38
39 self.SetTitle(_("Enlist person as GNUmed user"))
40 self._TXT_person.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
41 self._TXT_person.Enable(False)
42 self._TXT_short_alias.SetToolTip(_("A short alias identifying the GNUmed user. It is used in the clinical record among other places."))
43 self._TXT_account.SetToolTip(_("The database account for this user.\n\nThe account will be created in the database with proper access rights. Privacy restrictions are currently hardcoded to membership in the PostgreSQL group \"gm-doctors\".\n\nYou can use the name of an existing account but it must not be used by any other GNUmed user yet."))
44 self._TXT_password.SetToolTip(_("The password for the new database account. Input will not be shown."))
45 self._TXT_password.SetFocus()
46 self._TXT_password_again.SetToolTip(_("The database password must be typed again to enable double-checking to protect against typos."))
47 self._TXT_dbo_password.SetToolTip(_("Enlisting GNUmed users is a priviledged operation.\nYou must enter the password for the database administrator \"gm-dbo\" here."))
48 self._BTN_enlist.SetToolTip(_("Enlist this person as a GNUmed user and associate it with the given database account."))
49 self._BTN_enlist.SetDefault()
50 self._BTN_cancel.SetToolTip(_("Cancel this dialog, do not enlist new GNUmed user."))
51
52
54
55 __szr_main = wx.BoxSizer(wx.VERTICAL)
56 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
57 __gszr_middle = wx.FlexGridSizer(5, 2, 0, 0)
58 __lbl_person = wx.StaticText(self, wx.ID_ANY, _("The currently selected patient is:"))
59 __szr_main.Add(__lbl_person, 0, wx.ALL, 5)
60 __szr_main.Add(self._TXT_person, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
61 __lbl_instructions = wx.StaticText(self, wx.ID_ANY, _("User parameters:"))
62 __szr_main.Add(__lbl_instructions, 0, wx.ALL | wx.EXPAND, 5)
63 __lbl_short_alias = wx.StaticText(self, wx.ID_ANY, _("Alias"), style=wx.ALIGN_RIGHT)
64 __gszr_middle.Add(__lbl_short_alias, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 3)
65 __gszr_middle.Add(self._TXT_short_alias, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
66 __lbl_account = wx.StaticText(self, wx.ID_ANY, _("Account"), style=wx.ALIGN_RIGHT)
67 __gszr_middle.Add(__lbl_account, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 3)
68 __gszr_middle.Add(self._TXT_account, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
69 __lbl_password = wx.StaticText(self, wx.ID_ANY, _("Password"), style=wx.ALIGN_RIGHT)
70 __gszr_middle.Add(__lbl_password, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 3)
71 __gszr_middle.Add(self._TXT_password, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
72 __lbl_password_again = wx.StaticText(self, wx.ID_ANY, _("Password, again"), style=wx.ALIGN_RIGHT)
73 __gszr_middle.Add(__lbl_password_again, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 3)
74 __gszr_middle.Add(self._TXT_password_again, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
75 __lbl_dbo_password = wx.StaticText(self, wx.ID_ANY, _("Admin password"), style=wx.ALIGN_RIGHT)
76 __gszr_middle.Add(__lbl_dbo_password, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 3)
77 __gszr_middle.Add(self._TXT_dbo_password, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 0)
78 __gszr_middle.AddGrowableCol(1)
79 __szr_main.Add(__gszr_middle, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
80 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
81 __szr_buttons.Add(self._BTN_enlist, 0, 0, 0)
82 __szr_buttons.Add(self._BTN_cancel, 0, 0, 0)
83 __szr_main.Add(__szr_buttons, 0, wx.ALL | wx.EXPAND, 5)
84 self.SetSizer(__szr_main)
85 __szr_main.Fit(self)
86 self.Layout()
87 self.Centre()
88
89
91 print("Event handler '_on_enlist_button_pressed' not implemented!")
92 event.Skip()
93
95 print("Event handler '_on_cancel_button_pressed' not implemented!")
96 event.Skip()
97
98
99