1 try:
2 import wxversion
3 import wx
4 except ImportError:
5 from wxPython import wx
6 from wxPython import grid
7
8 import string
9
10 from Gnumed.wxpython import gmGuiElement_HeadingCaptionPanel
11 from Gnumed.wxpython import gmGuiElement_DividerCaptionPanel
12 from Gnumed.wxpython import gmGuiElement_AlertCaptionPanel
13 from Gnumed.wxpython import gmPlugin_Patient, gmEditArea
14
15 from Gnumed.wxpython.gmPatientHolder import PatientHolder
16 ID_ANCNOTEBOOK =wxNewId()
17
18
20 """
21 """
22
24 wxPyGridTableBase.__init__(self)
25
26
27 self.colLabels = ['Date', 'Gest','Fundus', 'Girth', 'Presentation', ' FH ',
28 ' Urine ', ' BP ', 'Weight',' Comment ']
29 self.dataTypes = [wxGRID_VALUE_STRING,
30 wxGRID_VALUE_STRING,
31 wxGRID_VALUE_STRING,
32 wxGRID_VALUE_STRING,
33 wxGRID_VALUE_CHOICE + ':cephalic,breech,transverse',
34 wxGRID_VALUE_CHOICE + ':FMF,FHH',
35 wxGRID_VALUE_STRING,
36 wxGRID_VALUE_STRING,
37 wxGRID_VALUE_STRING,
38 wxGRID_VALUE_STRING]
39
40 self.data = [
41 ['20/10/2001', "31", '32',"", 'cephalic', 'FHH', 'NAD', '120/70', '77kg','?UTI msu sent'],
42
43
44
45 ]
46
47
48
49
50
52 return len(self.data) + 1
53
55 return len(self.data[0])
56
58 return not self.data[row][col]
59
60
61
62
63
65 try:
66 return self.data[row][col]
67 except IndexError:
68 return ''
69
71 try:
72 self.data[row][col] = value
73 except IndexError:
74
75 self.data.append([''] * self.GetNumberCols())
76 self.SetValue(row, col, value)
77
78
79 msg = wxGridTableMessage(self,
80 wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
81 1)
82
83 self.GetView().ProcessTableMessage(msg)
84
85
86
87
88
89
91 return self.colLabels[col]
92
93
94
95
97 return self.dataTypes[col]
98
99
100
101
103 colType = string.split(self.dataTypes[col], ':')[0]
104 if typeName == colType:
105 return True
106 else:
107 return False
108
111
112
113
114
115
116
117
118
119
122 wxGrid.__init__(self, parent, -1)
123
124 table = CustomDataTable()
125
126
127
128
129 self.SetTable(table, True)
130
131 self.SetRowLabelSize(0)
132 self.SetMargins(0,0)
133 self.AutoSizeColumns(True)
134
135 EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
136
137
138
139
140
142 if self.CanEnableCellControl():
143 self.EnableCellEditControl()
144
145
146
149 wxPanel.__init__(self, parent, id,wxDefaultPosition,wxDefaultSize,wxNO_BORDER)
150 PatientHolder.__init__(self)
151 self.sizer = wxBoxSizer(wxHORIZONTAL)
152 self.notebook1 = wxNotebook(self, -1, wxDefaultPosition, wxDefaultSize, style =0)
153 ListScript_ID = wxNewId()
154
155
156 self.firstvisitpanel = wxPanel(self.notebook1,-1)
157 self.scanpanel = wxPanel(self.notebook1,-1)
158 self.grid = CustTableGrid(self.notebook1)
159 self.notebook1.AddPage(self.firstvisitpanel, "First Visit")
160 self.notebook1.AddPage(self.grid, "Ante-natal Chart")
161 self.notebook1.AddPage(self.scanpanel, "Scans")
162
163 self.notebook1.SetSelection(0)
164 self.szr_notebook = wxNotebookSizer(self.notebook1)
165 self.sizer.AddSizer(self.szr_notebook,1,wxEXPAND)
166 self.SetSizer(self.sizer)
167 self.sizer.Fit(self)
168 self.SetAutoLayout(True)
169 self.Show(True)
170
171
173 """
174 Plugin to encapsulate the antenatalcare window
175 """
176 __icons = {
177 """icon-future_mom""":"x\xdam\x90?o\x830\x10\xc5\xf7|\nKNB\x15\x1cd\xc0\x80!\x7fDm`\xac\x87,\xacQ\
178 \xd4\xa9Q\xe9\xf7\x9f\xea\xf3\xd9Uq\xeb[\xf8\xbd\xf7\xee\x0e\xfb\xe5\xf9\x95\
179 onI^\x93\\\x92\xa2%y\xb2\xb9\xdf\x12I\x1eD=\xef\x8f\x0fG\xc6\x12-9\x94\xe3\
180 \x12\xb8\xe5\x927\xc8\x15\xb0\xe6\x9ck\xe4\x03\xf0 \xb5P\xc8[\xe0\x89\x0f\
181 \xda\xfb\x02\xf3*0G\xd6\xa1\xff\x8a\xfdP\x8e\x8f\xd8?\xea\t\xfd\xcc\xfb\xda\
182 \xfb\x17\xd7/\x95xE?uy9r\x8d\xfe\x1e\xd8\x92V\xc8\xd4\xfb\xc2\xfb;\xcf\xd2s\
183 \x1fx\xc0y'\x9c\xaf\x83?\xe3\xbcA\x8f\xe8\xd7\x98ox\x81\xdc\xa2\x0f\xe5\xb8\
184 \xf1\xbe\xf0>\xb1\xfc\xb6|\xbe;`hNz\xc2\xe19\xb0\x94?\x8f\xdb\x01W\x12\xcaq\
185 \x01\xac\xa4\n\x979\xbb\xc7\xe0P\x8e\x17\xcfb\x08\xcbH6g\xf3b\xec\xb1\xdf$\
186 \x88pL\xda\xd3\xadY\x8b\x86R\xbas\xeao1\xa5=\xed\xf7&j?Pz\x89\xdaA\x86E\xd9:\
187 i\x8e\xa7.^te\xe7\x8e\xe6\xab\x99\x861Vt\xb4\x8c\xb63&\xba\xfeo\x92EI\xc3\
188 \xaa\xaab\xeb\xa4\xd5\xea\xba\x8a\x92 6\xff$mw\x94\x94\x19\xec\x89\xb7\x9b\
189 \xd6\x8a<\xfeO\xe3\x0f^3\xfb\x06\xbe\xc9\xae+"
190 }
191
194
196 return ('view', '&Ante-natal')
197
199 if anIconID == None:
200 return self.__icons[_("""icon-future_mom""")]
201 else:
202 if self.__icons.has_key(anIconID):
203 return self.__icons[anIconID]
204 else:
205 return self.__icons[_("""icon-future_mom""")]
206
209
210
211 if __name__ == "__main__":
212 app = wxPyWidgetTester(size = (600, 600))
213 app.SetWidget(AntenatalPanel, -1)
214 app.MainLoop()
215