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._TXT_person = wx.TextCtrl(self, -1, _("Data of current patient to be displayed here."), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_WORDWRAP|wx.NO_BORDER)
18 self._TXT_short_alias = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
19 self._TXT_account = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
20 self._TXT_password = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD|wx.NO_BORDER)
21 self._TXT_password_again = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD|wx.NO_BORDER)
22 self._TXT_dbo_password = wx.TextCtrl(self, -1, "", style=wx.TE_PASSWORD|wx.NO_BORDER)
23 self._BTN_enlist = wx.Button(self, -1, _("Enlist"))
24 self._BTN_cancel = wx.Button(self, -1, _("Cancel"))
25
26 self.__set_properties()
27 self.__do_layout()
28
29 self.Bind(wx.EVT_BUTTON, self._on_enlist_button_pressed, self._BTN_enlist)
30 self.Bind(wx.EVT_BUTTON, self._on_cancel_button_pressed, self._BTN_cancel)
31
32
34
35 self.SetTitle(_("Enlist person as GNUmed user"))
36 self._TXT_person.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_GRAYTEXT))
37 self._TXT_person.Enable(False)
38 self._TXT_short_alias.SetToolTipString(_("A short alias identifying the GNUmed user. It is used in the clinical record among other places."))
39 self._TXT_account.SetToolTipString(_("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."))
40 self._TXT_password.SetToolTipString(_("The password for the new database account. Input will not be shown."))
41 self._TXT_password.SetFocus()
42 self._TXT_password_again.SetToolTipString(_("The database password must be typed again to enable double-checking to protect against typos."))
43 self._TXT_dbo_password.SetToolTipString(_("Enlisting GNUmed users is a priviledged operation.\nYou must enter the password for the database administrator \"gm-dbo\" here."))
44 self._BTN_enlist.SetToolTipString(_("Enlist this person as a GNUmed user and associate it with the given database account."))
45 self._BTN_enlist.SetDefault()
46 self._BTN_cancel.SetToolTipString(_("Cancel this dialog, do not enlist new GNUmed user."))
47
48
50
51 __szr_main = wx.BoxSizer(wx.VERTICAL)
52 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
53 __gszr_middle = wx.FlexGridSizer(5, 2, 0, 0)
54 __lbl_person = wx.StaticText(self, -1, _("The currently selected patient is:"))
55 __szr_main.Add(__lbl_person, 0, wx.ALL, 5)
56 __szr_main.Add(self._TXT_person, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 5)
57 __lbl_instructions = wx.StaticText(self, -1, _("User parameters:"))
58 __szr_main.Add(__lbl_instructions, 0, wx.ALL|wx.EXPAND, 5)
59 __lbl_short_alias = wx.StaticText(self, -1, _("Alias"), style=wx.ALIGN_RIGHT)
60 __gszr_middle.Add(__lbl_short_alias, 0, wx.RIGHT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
61 __gszr_middle.Add(self._TXT_short_alias, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
62 __lbl_account = wx.StaticText(self, -1, _("Account"), style=wx.ALIGN_RIGHT)
63 __gszr_middle.Add(__lbl_account, 0, wx.RIGHT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
64 __gszr_middle.Add(self._TXT_account, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
65 __lbl_password = wx.StaticText(self, -1, _("Password"), style=wx.ALIGN_RIGHT)
66 __gszr_middle.Add(__lbl_password, 0, wx.RIGHT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
67 __gszr_middle.Add(self._TXT_password, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
68 __lbl_password_again = wx.StaticText(self, -1, _("Password, again"), style=wx.ALIGN_RIGHT)
69 __gszr_middle.Add(__lbl_password_again, 0, wx.RIGHT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
70 __gszr_middle.Add(self._TXT_password_again, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
71 __lbl_dbo_password = wx.StaticText(self, -1, _("Admin password"), style=wx.ALIGN_RIGHT)
72 __gszr_middle.Add(__lbl_dbo_password, 0, wx.RIGHT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 3)
73 __gszr_middle.Add(self._TXT_dbo_password, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
74 __gszr_middle.AddGrowableCol(1)
75 __szr_main.Add(__gszr_middle, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 5)
76 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
77 __szr_buttons.Add(self._BTN_enlist, 0, 0, 0)
78 __szr_buttons.Add(self._BTN_cancel, 0, 0, 0)
79 __szr_main.Add(__szr_buttons, 0, wx.ALL|wx.EXPAND, 5)
80 self.SetSizer(__szr_main)
81 __szr_main.Fit(self)
82 self.Layout()
83 self.Centre()
84
85
87 print "Event handler `_on_enlist_button_pressed' not implemented!"
88 event.Skip()
89
91 print "Event handler `_on_cancel_button_pressed' not implemented!"
92 event.Skip()
93
94
95
96
97 if __name__ == "__main__":
98 import gettext
99 gettext.install("app")
100
101 app = wx.PySimpleApp(0)
102 wx.InitAllImageHandlers()
103 dialog_1 = wxgAddPatientAsStaffDlg(None, -1, "")
104 app.SetTopWindow(dialog_1)
105 dialog_1.Show()
106 app.MainLoop()
107