| Home | Trees | Indices | Help |
|
|---|
|
|
1 # -*- coding: utf-8 -*-
2 #!/usr/bin/python
3 #############################################################################
4 #
5 # gmGP_PastHistory.py
6 # ----------------------------------
7 #
8 # This panel will hold all the pasthistory details
9 #
10 # If you don't like it - change this code see @TODO!
11 #
12 # @author: Dr. Richard Terry
13 # @copyright: author
14 # @license: GPL v2 or later (details at http://www.gnu.org)
15 # @dependencies: wxPython (>= version 2.3.1)
16 # @change log:
17 # 10.06.2002 rterry initial implementation, untested
18 # 31.07.2002 rterry added to cvs
19 #
20 # @TODO:almost everything!
21 # contains dummy data only
22 #
23 ############################################################################
24 import wx
25
26 import gmGuiElement_HeadingCaptionPanel #panel class to display top headings
27 import gmGuiElement_DividerCaptionPanel #panel class to display sub-headings or divider headings
28 import gmGuiElement_AlertCaptionPanel #panel to hold flashing alert messages
29 import gmEditArea #panel class holding editing prompts and text boxes
30 import gmPlugin_Patient
31
32 import gmDispatcher
33
34 from gmPatientHolder import PatientHolder
35 import gmPatientHolder
36
37 from gmListCtrlMapper import gmListCtrlMapper
38
39 import gmMultiColumnList
40
41 ID_SIGNIFICANTPASTHISTORYLIST = wxNewId()
42 ID_ACTIVEPROBLEMLIST = wxNewId()
43 gmSECTION_PASTHISTORY = 5
44 #------------------------------------
45 #Dummy data to simulate allergy items
46 #------------------------------------
47 activehistorydata = {
48 1 : ("1982","Hypertension"),
49 2 : ("1990","Ischaemic Heart Disease"),
50 3 : ("1995","NIDDM"),
51 4 : ("1998","Lymphoma"),
52 5:("1998","Chemotherapy"),
53 }
54 significanthistorydata = {
55 1 : ("1982","Hypertension"),
56 2 : ("1990","Acute myocardial infarction"),
57 3 : ("1994","CABG"),
58 4 : ("1995","Cholecystectomy"),
59 }
60
61 pasthistoryprompts = {
62 1:("Condition"),
63 2:("Notes"),
64 3:(""),
65 4:("Age Onset"),
66 5:("Year Onset"),
67 6:(""),
68 7:("Progress Notes"),
69 8:(""),
70 }
71
72
73
76 wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxRAISED_BORDER)
77 PatientHolder.__init__(self)
78
79 #--------------------
80 #add the main heading
81 #--------------------
82 self.pasthistorypanelheading = gmGuiElement_HeadingCaptionPanel.HeadingCaptionPanel(self,-1, " PAST HISTORY ")
83 #----------------------------------
84 #dummy panel above the editing area
85 #----------------------------------
86 self.dummypanel1 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0)
87 self.dummypanel1.SetBackgroundColour(wxColor(222,222,222))
88 #--------------------------------------------------
89 #now create the editarea specific for past history
90 #-------------------------------------------------
91 #self.editarea = gmEditArea.EditArea(self,-1,pasthistoryprompts,gmSECTION_PASTHISTORY)
92 self.editarea = gmEditArea.gmPastHistoryEditArea(self,-1)
93 self.dummypanel2 = wxPanel(self,-1,wxDefaultPosition,wxDefaultSize,0)
94 self.dummypanel2.SetBackgroundColour(wxColor(222,222,222))
95 #-----------------------------------------------
96 #add the divider headings below the editing area
97 #-----------------------------------------------
98 self.significant_history_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Significant Past Problems"))
99 self.sizer_significant_history_heading = wxBoxSizer(wxHORIZONTAL)
100 self.sizer_significant_history_heading.Add(self.significant_history_heading,1, wxEXPAND)
101 #--------------------------------------------------------------------------------------
102 #add the list of significant problems
103 #
104 # c++ Default Constructor:
105 # wxListCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
106 # const wxSize& size = wxDefaultSize, long style = wxLC_ICON,
107 # const wxValidator& validator = wxDefaultValidator, const wxString& name = "listCtrl")
108 #
109 #--------------------------------------------------------------------------------------
110 #self.significant_problem_list = wxListCtrl(self, ID_SIGNIFICANTPASTHISTORYLIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER)
111 self.significant_problem_list = gmMultiColumnList.MultiColumnList(self, -1)
112 self.significant_problem_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
113 #self.active_problem_list = wxListCtrl(self, ID_ACTIVEPROBLEMLIST, wxDefaultPosition, wxDefaultSize,wxLC_REPORT|wxLC_NO_HEADER|wxSUNKEN_BORDER)
114 self.active_problem_list = gmMultiColumnList.MultiColumnList(self, -1)
115 self.active_problem_list.SetFont(wxFont(12,wxSWISS, wxNORMAL, wxNORMAL, False, ''))
116 #---------------------------------------------------------
117 # add some dummy data to the significant past problem list
118 #---------------------------------------------------------
119 #self.significant_problem_list.InsertColumn(0, _("year onset"))
120 #self.significant_problem_list.InsertColumn(1, _("Condition"))
121 #self.significant_problem_list.InsertColumn(2, _("Notes"))
122 #-------------------------------------------------------------------------
123 #loop through the significanthistorydata array and add to the list control
124 #note the different syntax for the first coloum of each row
125 #i.e. here > self.significant_problem_list.InsertItem(x, data[0])!!
126 #--------------------------------------------------------------------------
127 #self.significant_mapper = gmListCtrlMapper(self.significant_problem_list)
128 #self.significant_mapper.SetData( significanthistorydata)
129 self.significant_problem_list.SetData( significanthistorydata)
130 #items = significanthistorydata.items()
131 #for x in range(len(items)):
132 # key, data = items[x]
133 # gmLog.gmDefLog.Log (gmLog.lData, items[x])
134 # self.significant_problem_list.InsertItem(x, data[0])
135 # self.significant_problem_list.SetItem(x, 1, data[1])
136 # self.significant_problem_list.SetItemData(x, key)
137 # self.significant_problem_list.SetColumnWidth(0, wxLIST_AUTOSIZE)
138 #self.significant_problem_list.SetColumnWidth(1, wxLIST_AUTOSIZE)
139 #------------------------------------------------
140 #add some dummy data to the active problems list
141 #------------------------------------------------
142 #self.active_problem_list.InsertColumn(0, _("Year Onset"))
143 #self.active_problem_list.InsertColumn(1, _("Condition"))
144 #self.active_problem_list.InsertColumn(2, _("Notes"))
145 #-------------------------------------------------------------
146 #loop through the activehistorydata array and add to the list control
147 #note the different syntax for the first coloum of each row
148 #i.e. here > self.significant_problem_list.InsertItem(x, data[0])!!
149 #-------------------------------------------------------------
150 #self.active_mapper = gmListCtrlMapper(self.active_problem_list)
151 #self.active_mapper.SetData( activehistorydata)
152 self.active_problem_list.SetData( activehistorydata)
153
154 #items = activehistorydata.items()
155 #for x in range(len(items)):
156 # key, data = items[x]
157 # gmLog.gmDefLog.Log (gmLog.lData, items[x])
158 # self.active_problem_list.InsertItem(x, data[0])
159 # self.active_problem_list.SetItem(x, 1, data[1])
160 # self.active_problem_list.SetItemData(x, key)
161 #self.active_problem_list.SetColumnWidth(0, wxLIST_AUTOSIZE)
162 #self.active_problem_list.SetColumnWidth(1, wxLIST_AUTOSIZE)
163 #--------------------------------------------------------------------------------------
164 #add a richtext control or a wxTextCtrl multiline to display the class text information
165 #e.g. would contain say information re the penicillins
166 #--------------------------------------------------------------------------------------
167 self.active_problems_heading = gmGuiElement_DividerCaptionPanel.DividerCaptionPanel(self,-1,_("Active Problems"))
168 #----------------------------------------
169 #add an alert caption panel to the bottom
170 #----------------------------------------
171 self.alertpanel = gmGuiElement_AlertCaptionPanel.AlertCaptionPanel(self,-1," Alerts ")
172 #---------------------------------------------
173 #add all elements to the main background sizer
174 #---------------------------------------------
175 self.mainsizer = wxBoxSizer(wxVERTICAL)
176 self.mainsizer.Add(self.pasthistorypanelheading,0,wxEXPAND)
177 #self.mainsizer.Add(self.dummypanel1,0,wxEXPAND)
178 self.mainsizer.Add(self.editarea,6,wxEXPAND)
179 #self.mainsizer.Add(self.dummypanel2,0,wxEXPAND)
180 self.mainsizer.Add(self.significant_history_heading,0,wxEXPAND)
181 self.mainsizer.Add(self.significant_problem_list,4,wxEXPAND)
182 self.mainsizer.Add(self.active_problems_heading,0,wxEXPAND)
183 self.mainsizer.Add(self.active_problem_list,4,wxEXPAND)
184 self.mainsizer.Add(self.alertpanel,0,wxEXPAND)
185 self.SetSizer(self.mainsizer)
186 self.mainsizer.Fit
187 self.SetAutoLayout(True)
188 self.Show(True)
189
190 gmDispatcher.connect(self._updateUI, 'clin_history_updated')
191
192 self.significant_problem_list.addItemListener( self._significantPastItemSelected)
193
194 self.active_problem_list.addItemListener(self._activePastItemSelected)
195
197 clinical = self.get_past_history()
198 self._historyItemSelected( event ,clinical.get_significant_past_history() )
199
201 clinical = self.get_past_history()
202 self._historyItemSelected( event ,clinical.get_active_history() )
203
205 (selId, str) = event['item']
206 for (id, map) in list:
207 if id == selId:
208 clinical = self.get_past_history()
209 self.editarea.setInputFieldValues(map, id)
210
211
213 clinical = self.get_past_history()
214 significant_past = clinical.get_significant_past_history()
215 active_hx = clinical.get_active_history()
216 self.active_problem_list.SetData( self._get_list_map( active_hx) , fitClientSize = 1)
217 #self.significant_mapper.SetData( self._get_list_map( significant_past) )
218 self.significant_problem_list.SetData( self._get_list_map( significant_past), fitClientSize = 1 )
219
220
222 newMap = {}
223 for (id, map) in clin_history_list:
224 newMap[id] = self.get_past_history().short_format(map)
225 return newMap
226
227
228
229
230
231 #----------------------------------------------------------------------
233 """Plugin to encapsulate the immunisation window."""
234
235 __icons = {
236 """icon_hx_ship""": 'x\xdaU\x8e1\x0b\x830\x10\x85\xf7\xfe\x8a\x80\x82\x85@\xa8K\xb5\xdb\x11\xc1\
237 \xb17\xb8\xbcU\xa4S\xa5\xe9\xff\x9fz\x97\xc44^$\xe4{w\xef\x9d\xd7\xfd\xdb_\
238 \x96\xae\xbf\x1b\xf9\x1e\xa6\xef.\xeb\xd2\xc1l\xc6\xef\xeb\xf6\x8ed\x85\x9a\
239 \x9b\xd40F&\xe5a\x1c\xa6\xcc\xcd\xd1\x9f\x13\x9b\xd4W%r\x10~\x86\xcf+\x02ks\
240 \x1e\xe7)\x0f\xbb\xc4e\xb8U\xf6\xa3\x9f|\x0es\xce\x18H\x85T)1\x00\xcc\x8c \
241 \x07\x95\x18\xc0\x80e\xab\x8d"\x12\xac\xd8\x1b\x96\xc7_\xb42\x198\xe7Vv&9\
242 \xda\xab\xec\x00\x11\xceb\x8c\xc4\xc9\x1e\x87H\x02P-\x92\x1dm\xfaU\xb0@\x11I\
243 E\xbd\x08\x95\x1d\xf9:\xeci\x83\x84\xe6my\xb2\xae\xb2\xe8\xa4e\xbb\xadO\x14\
244 \xdd\x0f&\xf7\x8a\xe4'
245 }
246
249
252
254 if anIconID == None:
255 return self.__icons[_("""icon_hx_ship""")]
256 else:
257 if anIconID in self.__icons:
258 return self.__icons[anIconID]
259 else:
260 return self.__icons[_("""icon_hx_ship""")]
261
264 #----------------------------------------------------------------------
265 if __name__ == "__main__":
266 app = wxPyWidgetTester(size = (600, 600))
267 app.SetWidget(PastHistoryPanel, -1)
268 app.MainLoop()
269
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Jan 25 02:55:27 2019 | http://epydoc.sourceforge.net |