1
2
3
4
5 import wx
6
7
8
9
10
13
14 from Gnumed.wxpython.gmStaffWidgets import cUserRolePRW
15
16
17 kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.THICK_FRAME
18 wx.Dialog.__init__(self, *args, **kwds)
19 self._LCTRL_staff = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_ALIGN_LEFT | wx.LC_SINGLE_SEL | wx.LC_SORT_ASCENDING | wx.NO_BORDER)
20 self._TCTRL_name = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY | wx.NO_BORDER)
21 self._TCTRL_alias = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
22 self._TCTRL_account = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
23 self._PRW_user_role = cUserRolePRW(self, -1, "", style=wx.NO_BORDER)
24 self._TCTRL_comment = wx.TextCtrl(self, -1, "", style=wx.NO_BORDER)
25 self._btn_save = wx.Button(self, -1, _("Save"))
26 self._btn_activate = wx.Button(self, -1, _("Activate"))
27 self._btn_deactivate = wx.Button(self, -1, _("Deactivate"))
28 self._btn_delete = wx.Button(self, -1, _("Delete"))
29 self._btn_close = wx.Button(self, wx.ID_CANCEL, _("Close"))
30
31 self.__set_properties()
32 self.__do_layout()
33
34 self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._on_listitem_deselected, self._LCTRL_staff)
35 self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._on_listitem_selected, self._LCTRL_staff)
36 self.Bind(wx.EVT_BUTTON, self._on_save_button_pressed, self._btn_save)
37 self.Bind(wx.EVT_BUTTON, self._on_activate_button_pressed, self._btn_activate)
38 self.Bind(wx.EVT_BUTTON, self._on_deactivate_button_pressed, self._btn_deactivate)
39 self.Bind(wx.EVT_BUTTON, self._on_delete_button_pressed, self._btn_delete)
40
41
43
44 self.SetTitle(_("Edit staff list"))
45 self.SetSize((682, 480))
46 self._LCTRL_staff.SetToolTipString(_("The list of currently existing GNUmed users."))
47 self._LCTRL_staff.SetFocus()
48 self._TCTRL_name.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_BACKGROUND))
49 self._TCTRL_alias.SetToolTipString(_("Short alias for the GNUmed user. Must be unique for this system."))
50 self._TCTRL_account.SetToolTipString(_("The database account for this GNUmed user. Note that you cannot change your *own* database account."))
51 self._PRW_user_role.SetToolTipString(_("Select the role of this GNUmed staff member.\n\nThe selected role defines the range of access rights."))
52 self._TCTRL_comment.SetToolTipString(_("A short comment on this GNUmed user."))
53 self._btn_save.SetToolTipString(_("Save modified user details.\n\nYou will need to know the password for the GNUmed database administrator <gm-dbo>."))
54 self._btn_save.Enable(False)
55 self._btn_activate.SetToolTipString(_("Activate selected user.\n\nYou will need to know the password for the GNUmed database administrator <gm-dbo>."))
56 self._btn_activate.Enable(False)
57 self._btn_deactivate.SetToolTipString(_("Deactivate selected user.\n\nYou will need to know the password for the GNUmed database administrator <gm-dbo>."))
58 self._btn_deactivate.Enable(False)
59 self._btn_delete.SetToolTipString(_("Entirely remove the GNUmed user (including the database account).\n\nThis will only be possible if no patient data was saved under this account. If any data exists the entry will be deactivated instead.\n\nYou will need to know the password for the GNUmed database administrator <gm-dbo>."))
60 self._btn_delete.Enable(False)
61 self._btn_close.SetToolTipString(_("Close this dialog."))
62 self._btn_close.SetDefault()
63
64
66
67 __szr_main = wx.BoxSizer(wx.VERTICAL)
68 __szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
69 _gszr_staff_editor = wx.FlexGridSizer(4, 2, 2, 2)
70 __szr_account_details = wx.BoxSizer(wx.HORIZONTAL)
71 __szr_main.Add(self._LCTRL_staff, 1, wx.EXPAND, 0)
72 _lbl_name = wx.StaticText(self, -1, _("Name"))
73 _gszr_staff_editor.Add(_lbl_name, 0, wx.ALIGN_CENTER_VERTICAL, 0)
74 _gszr_staff_editor.Add(self._TCTRL_name, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
75 _lbl_alias = wx.StaticText(self, -1, _("Alias"))
76 _gszr_staff_editor.Add(_lbl_alias, 0, wx.ALIGN_CENTER_VERTICAL, 0)
77 _gszr_staff_editor.Add(self._TCTRL_alias, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
78 _lbl_account = wx.StaticText(self, -1, _("Account"))
79 _gszr_staff_editor.Add(_lbl_account, 0, wx.ALIGN_CENTER_VERTICAL, 0)
80 __szr_account_details.Add(self._TCTRL_account, 1, wx.RIGHT | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
81 __lbl_role = wx.StaticText(self, -1, _("Role:"))
82 __szr_account_details.Add(__lbl_role, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
83 __szr_account_details.Add(self._PRW_user_role, 1, wx.ALIGN_CENTER_VERTICAL, 0)
84 _gszr_staff_editor.Add(__szr_account_details, 1, wx.EXPAND, 0)
85 _lbl_comment = wx.StaticText(self, -1, _("Comment"))
86 _gszr_staff_editor.Add(_lbl_comment, 0, wx.ALIGN_CENTER_VERTICAL, 0)
87 _gszr_staff_editor.Add(self._TCTRL_comment, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
88 _gszr_staff_editor.AddGrowableCol(1)
89 __szr_main.Add(_gszr_staff_editor, 0, wx.ALL | wx.EXPAND, 2)
90 __szr_buttons.Add(self._btn_save, 0, 0, 0)
91 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
92 __szr_buttons.Add(self._btn_activate, 0, 0, 0)
93 __szr_buttons.Add(self._btn_deactivate, 0, 0, 0)
94 __szr_buttons.Add(self._btn_delete, 0, 0, 0)
95 __szr_buttons.Add((20, 20), 1, wx.EXPAND, 0)
96 __szr_buttons.Add(self._btn_close, 0, 0, 0)
97 __szr_main.Add(__szr_buttons, 0, wx.EXPAND, 0)
98 self.SetSizer(__szr_main)
99 self.Layout()
100 self.Centre()
101
102
104 print "Event handler `_on_listitem_deselected' not implemented!"
105 event.Skip()
106
108 print "Event handler `_on_listitem_selected' not implemented!"
109 event.Skip()
110
112 print "Event handler `_on_save_button_pressed' not implemented!"
113 event.Skip()
114
116 print "Event handler `_on_activate_button_pressed' not implemented!"
117 event.Skip()
118
120 print "Event handler `_on_deactivate_button_pressed' not implemented!"
121 event.Skip()
122
124 print "Event handler `_on_delete_button_pressed' not implemented!"
125 event.Skip()
126
127
128 if __name__ == "__main__":
129 import gettext
130 gettext.install("app")
131
132 app = wx.PySimpleApp(0)
133 wx.InitAllImageHandlers()
134 dialog_1 = wxgEditStaffListDlg(None, -1, "")
135 app.SetTopWindow(dialog_1)
136 dialog_1.Show()
137 app.MainLoop()
138