| Home | Trees | Indices | Help |
|
|---|
|
|
1 #====================================================================
2 # GNUmed Richard style Edit Area
3 #====================================================================
4 __license__ = 'GPL'
5 __version__ = "$Revision: 1.135 $"
6 __author__ = "R.Terry, K.Hilbert"
7
8 #======================================================================
9 import logging, datetime as pydt
10
11
12 import wx
13
14
15 from Gnumed.pycommon import gmDispatcher, gmExceptions
16 from Gnumed.wxGladeWidgets import wxgGenericEditAreaDlg, wxgGenericEditAreaDlg2
17
18
19 _log = logging.getLogger('gm.ui')
20 _log.info(__version__)
21 #====================================================================
22 edit_area_modes = ['new', 'edit', 'new_from_existing']
23
25 """Mixin for edit area panels providing generic functionality.
26
27 #====================================================================
28 # Class definition:
29
30 from Gnumed.wxGladeWidgets import wxgXxxEAPnl
31
32 class cXxxEAPnl(wxgXxxEAPnl.wxgXxxEAPnl, gmEditArea.cGenericEditAreaMixin):
33
34 def __init__(self, *args, **kwargs):
35
36 try:
37 data = kwargs['xxx']
38 del kwargs['xxx']
39 except KeyError:
40 data = None
41
42 wxgXxxEAPnl.wxgXxxEAPnl.__init__(self, *args, **kwargs)
43 gmEditArea.cGenericEditAreaMixin.__init__(self)
44
45 # Code using this mixin should set mode and data
46 # after instantiating the class:
47 self.mode = 'new'
48 self.data = data
49 if data is not None:
50 self.mode = 'edit'
51
52 #self.__init_ui()
53 #----------------------------------------------------------------
54 # def __init_ui(self):
55 # # adjust phrasewheels etc
56 #----------------------------------------------------------------
57 # generic Edit Area mixin API
58 #----------------------------------------------------------------
59 def _valid_for_save(self):
60 return False
61 return True
62 #----------------------------------------------------------------
63 def _save_as_new(self):
64 # save the data as a new instance
65 data =
66
67 data[''] =
68 data[''] =
69
70 data.save()
71
72 # must be done very late or else the property access
73 # will refresh the display such that later field
74 # access will return empty values
75 self.data = data
76 return False
77 return True
78 #----------------------------------------------------------------
79 def _save_as_update(self):
80 # update self.data and save the changes
81 self.data[''] =
82 self.data[''] =
83 self.data[''] =
84 self.data.save()
85 return True
86 #----------------------------------------------------------------
87 def _refresh_as_new(self):
88 pass
89 #----------------------------------------------------------------
90 def _refresh_from_existing(self):
91 pass
92 #----------------------------------------------------------------
93 def _refresh_as_new_from_existing(self):
94 pass
95 #----------------------------------------------------------------
96 """
98 self.__mode = 'new'
99 self.__data = None
100 self.successful_save_msg = None
101 self._refresh_as_new()
102 self.__tctrl_validity_colors = {
103 True: wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW),
104 False: 'pink'
105 }
106 #----------------------------------------------------------------
109
111 if mode not in edit_area_modes:
112 raise ValueError('[%s] <mode> must be in %s' % (self.__class__.__name__, edit_area_modes))
113 if mode == 'edit':
114 if self.__data is None:
115 raise ValueError('[%s] <mode> "edit" needs data value' % self.__class__.__name__)
116
117 prev_mode = self.__mode
118 self.__mode = mode
119 if mode != prev_mode:
120 self.refresh()
121
122 mode = property(_get_mode, _set_mode)
123 #----------------------------------------------------------------
126
128 if data is None:
129 if self.__mode == 'edit':
130 raise ValueError('[%s] <mode> "edit" needs data value' % self.__class__.__name__)
131 self.__data = data
132 self.refresh()
133
134 data = property(_get_data, _set_data)
135 #----------------------------------------------------------------
137 """Invoked from the generic edit area dialog.
138
139 Invokes
140 _valid_for_save,
141 _save_as_new,
142 _save_as_update
143 on the implementing edit area as needed.
144
145 _save_as_* must set self.__data and return True/False
146 """
147 if not self._valid_for_save():
148 return False
149
150 if self.__mode in ['new', 'new_from_existing']:
151 if self._save_as_new():
152 self.mode = 'edit'
153 return True
154 return False
155
156 elif self.__mode == 'edit':
157 return self._save_as_update()
158
159 else:
160 raise ValueError('[%s] <mode> must be in %s' % (self.__class__.__name__, edit_area_modes))
161 #----------------------------------------------------------------
163 """Invoked from the generic edit area dialog.
164
165 Invokes
166 _refresh_as_new
167 _refresh_from_existing
168 _refresh_as_new_from_existing
169 on the implementing edit area as needed.
170 """
171 if self.__mode == 'new':
172 return self._refresh_as_new()
173 elif self.__mode == 'edit':
174 return self._refresh_from_existing()
175 elif self.__mode == 'new_from_existing':
176 return self._refresh_as_new_from_existing()
177 else:
178 raise ValueError('[%s] <mode> must be in %s' % (self.__class__.__name__, edit_area_modes))
179 #----------------------------------------------------------------
183 #====================================================================
185 """Dialog for parenting edit area panels with save/clear/next/cancel"""
186
187 _lucky_day = 1
188 _lucky_month = 4
189 _today = pydt.date.today()
190
192
193 new_ea = kwargs['edit_area']
194 del kwargs['edit_area']
195
196 if not isinstance(new_ea, cGenericEditAreaMixin):
197 raise TypeError('[%s]: edit area instance must be child of cGenericEditAreaMixin')
198
199 try:
200 single_entry = kwargs['single_entry']
201 del kwargs['single_entry']
202 except KeyError:
203 single_entry = False
204
205 wxgGenericEditAreaDlg2.wxgGenericEditAreaDlg2.__init__(self, *args, **kwargs)
206
207 if cGenericEditAreaDlg2._today.day != cGenericEditAreaDlg2._lucky_day:
208 self._BTN_lucky.Enable(False)
209 self._BTN_lucky.Hide()
210 else:
211 if cGenericEditAreaDlg2._today.month != cGenericEditAreaDlg2._lucky_month:
212 self._BTN_lucky.Enable(False)
213 self._BTN_lucky.Hide()
214
215 # replace dummy panel
216 old_ea = self._PNL_ea
217 ea_pnl_szr = old_ea.GetContainingSizer()
218 ea_pnl_parent = old_ea.GetParent()
219 ea_pnl_szr.Remove(old_ea)
220 old_ea.Destroy()
221 del old_ea
222 new_ea.Reparent(ea_pnl_parent)
223 self._PNL_ea = new_ea
224 ea_pnl_szr.Add(self._PNL_ea, 1, wx.EXPAND, 0)
225
226 # adjust buttons
227 if single_entry:
228 self._BTN_forward.Enable(False)
229 self._BTN_forward.Hide()
230
231 self._adjust_clear_revert_buttons()
232
233 # redraw layout
234 self.Layout()
235 main_szr = self.GetSizer()
236 main_szr.Fit(self)
237 self.Refresh()
238
239 self._PNL_ea.refresh()
240 #--------------------------------------------------------
252 #--------------------------------------------------------
259 #--------------------------------------------------------
262 #--------------------------------------------------------
265 #--------------------------------------------------------
280 #--------------------------------------------------------
290 #====================================================================
291 # DEPRECATED:
293 """Dialog for parenting edit area with save/clear/cancel"""
294
296
297 ea = kwargs['edit_area']
298 del kwargs['edit_area']
299
300 wxgGenericEditAreaDlg.wxgGenericEditAreaDlg.__init__(self, *args, **kwargs)
301
302 szr = self._PNL_ea.GetContainingSizer()
303 szr.Remove(self._PNL_ea)
304 ea.Reparent(self)
305 szr.Add(ea, 1, wx.ALL|wx.EXPAND, 4)
306 self._PNL_ea = ea
307
308 self.Layout()
309 szr = self.GetSizer()
310 szr.Fit(self)
311 self.Refresh()
312
313 self._PNL_ea.refresh()
314 #--------------------------------------------------------
322 #--------------------------------------------------------
325 #====================================================================
326 #====================================================================
327 #====================================================================
328 import time
329
330 from Gnumed.business import gmPerson, gmDemographicRecord
331 from Gnumed.pycommon import gmGuiBroker
332 from Gnumed.wxpython import gmDateTimeInput, gmPhraseWheel, gmGuiHelpers
333
334 _gb = gmGuiBroker.GuiBroker()
335
336 gmSECTION_SUMMARY = 1
337 gmSECTION_DEMOGRAPHICS = 2
338 gmSECTION_CLINICALNOTES = 3
339 gmSECTION_FAMILYHISTORY = 4
340 gmSECTION_PASTHISTORY = 5
341 gmSECTION_SCRIPT = 8
342 gmSECTION_REQUESTS = 9
343 gmSECTION_REFERRALS = 11
344 gmSECTION_RECALLS = 12
345
346 richards_blue = wx.Colour(0,0,131)
347 richards_aqua = wx.Colour(0,194,197)
348 richards_dark_gray = wx.Color(131,129,131)
349 richards_light_gray = wx.Color(255,255,255)
350 richards_coloured_gray = wx.Color(131,129,131)
351
352
353 CONTROLS_WITHOUT_LABELS =['wxTextCtrl', 'cEditAreaField', 'wx.SpinCtrl', 'gmPhraseWheel', 'wx.ComboBox']
354
356 widget.SetForegroundColour(wx.Color(255, 0, 0))
357 widget.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False, ''))
358 #====================================================================
360 - def __init__ (
361 self,
362 parent,
363 id,
364 title = 'edit area popup',
365 pos=wx.DefaultPosition,
366 size=wx.DefaultSize,
367 style=wx.SIMPLE_BORDER,
368 name='',
369 edit_area = None
370 ):
371 if not isinstance(edit_area, cEditArea2):
372 raise gmExceptions.ConstructorError, '<edit_area> must be of type cEditArea2 but is <%s>' % type(edit_area)
373 wx.Dialog.__init__(self, parent, id, title, pos, size, style, name)
374 self.__wxID_BTN_SAVE = wx.NewId()
375 self.__wxID_BTN_RESET = wx.NewId()
376 self.__editarea = edit_area
377 self.__do_layout()
378 self.__register_events()
379 #--------------------------------------------------------
380 # public API
381 #--------------------------------------------------------
383 return self.__editarea.get_summary()
384 #--------------------------------------------------------
386 self.__editarea.Reparent(self)
387
388 self.__btn_SAVE = wx.Button(self, self.__wxID_BTN_SAVE, _("Save"))
389 self.__btn_SAVE.SetToolTipString(_('save entry into medical record'))
390 self.__btn_RESET = wx.Button(self, self.__wxID_BTN_RESET, _("Reset"))
391 self.__btn_RESET.SetToolTipString(_('reset entry'))
392 self.__btn_CANCEL = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
393 self.__btn_CANCEL.SetToolTipString(_('discard entry and cancel'))
394
395 szr_buttons = wx.BoxSizer(wx.HORIZONTAL)
396 szr_buttons.Add(self.__btn_SAVE, 1, wx.EXPAND | wx.ALL, 1)
397 szr_buttons.Add(self.__btn_RESET, 1, wx.EXPAND | wx.ALL, 1)
398 szr_buttons.Add(self.__btn_CANCEL, 1, wx.EXPAND | wx.ALL, 1)
399
400 szr_main = wx.BoxSizer(wx.VERTICAL)
401 szr_main.Add(self.__editarea, 1, wx.EXPAND)
402 szr_main.Add(szr_buttons, 0, wx.EXPAND)
403
404 self.SetSizerAndFit(szr_main)
405 #--------------------------------------------------------
406 # event handling
407 #--------------------------------------------------------
409 # connect standard buttons
410 wx.EVT_BUTTON(self.__btn_SAVE, self.__wxID_BTN_SAVE, self._on_SAVE_btn_pressed)
411 wx.EVT_BUTTON(self.__btn_RESET, self.__wxID_BTN_RESET, self._on_RESET_btn_pressed)
412 wx.EVT_BUTTON(self.__btn_CANCEL, wx.ID_CANCEL, self._on_CANCEL_btn_pressed)
413
414 wx.EVT_CLOSE(self, self._on_CANCEL_btn_pressed)
415
416 # client internal signals
417 # gmDispatcher.connect(signal = gmSignals.pre_patient_selection(), receiver = self._on_pre_patient_selection)
418 # gmDispatcher.connect(signal = gmSignals.application_closing(), receiver = self._on_application_closing)
419 # gmDispatcher.connect(signal = gmSignals.post_patient_selection(), receiver = self.on_post_patient_selection)
420
421 return 1
422 #--------------------------------------------------------
424 if self.__editarea.save_data():
425 self.__editarea.Close()
426 self.EndModal(wx.ID_OK)
427 return
428 short_err = self.__editarea.get_short_error()
429 long_err = self.__editarea.get_long_error()
430 if (short_err is None) and (long_err is None):
431 long_err = _(
432 'Unspecified error saving data in edit area.\n\n'
433 'Programmer forgot to specify proper error\n'
434 'message in [%s].'
435 ) % self.__editarea.__class__.__name__
436 if short_err is not None:
437 gmDispatcher.send(signal = 'statustext', msg = short_err)
438 if long_err is not None:
439 gmGuiHelpers.gm_show_error(long_err, _('saving clinical data'))
440 #--------------------------------------------------------
444 #--------------------------------------------------------
446 self.__editarea.reset_ui()
447 #====================================================================
449 - def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL):
450 # init main background panel
451 wx.Panel.__init__ (
452 self,
453 parent,
454 id,
455 pos = pos,
456 size = size,
457 style = style | wx.TAB_TRAVERSAL
458 )
459 self.SetBackgroundColour(wx.Color(222,222,222))
460
461 self.data = None # a placeholder for opaque data
462 self.fields = {}
463 self.prompts = {}
464 self._short_error = None
465 self._long_error = None
466 self._summary = None
467 self._patient = gmPerson.gmCurrentPatient()
468 self.__wxID_BTN_OK = wx.NewId()
469 self.__wxID_BTN_CLEAR = wx.NewId()
470 self.__do_layout()
471 self.__register_events()
472 self.Show()
473 #--------------------------------------------------------
474 # external API
475 #--------------------------------------------------------
477 """This needs to be overridden by child classes."""
478 self._long_error = _(
479 'Cannot save data from edit area.\n\n'
480 'Programmer forgot to override method:\n'
481 ' <%s.save_data>'
482 ) % self.__class__.__name__
483 return False
484 #--------------------------------------------------------
486 msg = _(
487 'Cannot reset fields in edit area.\n\n'
488 'Programmer forgot to override method:\n'
489 ' <%s.reset_ui>'
490 ) % self.__class__.__name__
491 gmGuiHelpers.gm_show_error(msg)
492 #--------------------------------------------------------
497 #--------------------------------------------------------
502 #--------------------------------------------------------
504 return _('<No embed string for [%s]>') % self.__class__.__name__
505 #--------------------------------------------------------
506 # event handling
507 #--------------------------------------------------------
509 # client internal signals
510 if self._patient.connected:
511 gmDispatcher.connect(signal = 'pre_patient_selection', receiver = self._on_pre_patient_selection)
512 gmDispatcher.connect(signal = 'post_patient_selection', receiver = self.on_post_patient_selection)
513 gmDispatcher.connect(signal = 'application_closing', receiver = self._on_application_closing)
514
515 # wxPython events
516 wx.EVT_CLOSE(self, self._on_close)
517
518 return 1
519 #--------------------------------------------------------
521 gmDispatcher.disconnect(signal = u'pre_patient_selection', receiver = self._on_pre_patient_selection)
522 gmDispatcher.disconnect(signal = u'post_patient_selection', receiver = self.on_post_patient_selection)
523 gmDispatcher.disconnect(signal = u'application_closing', receiver = self._on_application_closing)
524 #--------------------------------------------------------
525 # handlers
526 #--------------------------------------------------------
530 #--------------------------------------------------------
532 """Only active if _make_standard_buttons was called in child class."""
533 # FIXME: this try: except: block seems to large
534 try:
535 event.Skip()
536 if self.data is None:
537 self._save_new_entry()
538 self.reset_ui()
539 else:
540 self._save_modified_entry()
541 self.reset_ui()
542 except gmExceptions.InvalidInputError, err:
543 # nasty evil popup dialogue box
544 # but for invalid input we want to interrupt user
545 gmGuiHelpers.gm_show_error (err, _("Invalid Input"))
546 except:
547 _log.exception( "save data problem in [%s]" % self.__class__.__name__)
548 #--------------------------------------------------------
550 """Only active if _make_standard_buttons was called in child class."""
551 # FIXME: check for unsaved data
552 self.reset_ui()
553 event.Skip()
554 #--------------------------------------------------------
556 self.__deregister_events()
557 # remember wxCallAfter
558 if not self._patient.connected:
559 return True
560 # FIXME: should do this:
561 # if self.user_wants_save():
562 # if self.save_data():
563 # return True
564 return True
565 _log.error('[%s] lossage' % self.__class__.__name__)
566 return False
567 #--------------------------------------------------------
569 """Just before new patient becomes active."""
570 # remember wxCallAfter
571 if not self._patient.connected:
572 return True
573 # FIXME: should do this:
574 # if self.user_wants_save():
575 # if self.save_data():
576 # return True
577 return True
578 _log.error('[%s] lossage' % self.__class__.__name__)
579 return False
580 #--------------------------------------------------------
582 """Just after new patient became active."""
583 # remember to use wxCallAfter()
584 self.reset_ui()
585 #----------------------------------------------------------------
586 # internal helpers
587 #----------------------------------------------------------------
589
590 # define prompts and fields
591 self._define_prompts()
592 self._define_fields(parent = self)
593 if len(self.fields) != len(self.prompts):
594 _log.error('[%s]: #fields != #prompts' % self.__class__.__name__)
595 return None
596
597 # and generate edit area from it
598 szr_main_fgrid = wx.FlexGridSizer(rows = len(self.prompts), cols=2)
599 color = richards_aqua
600 lines = self.prompts.keys()
601 lines.sort()
602 for line in lines:
603 # 1) prompt
604 label, color, weight = self.prompts[line]
605 # FIXME: style for centering in vertical direction ?
606 prompt = wx.StaticText (
607 parent = self,
608 id = -1,
609 label = label,
610 style = wx.ALIGN_CENTRE
611 )
612 # FIXME: resolution dependant
613 prompt.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False, ''))
614 prompt.SetForegroundColour(color)
615 prompt.SetBackgroundColour(richards_light_gray)
616 szr_main_fgrid.Add(prompt, flag=wx.EXPAND | wx.ALIGN_RIGHT)
617
618 # 2) widget(s) for line
619 szr_line = wx.BoxSizer(wx.HORIZONTAL)
620 positions = self.fields[line].keys()
621 positions.sort()
622 for pos in positions:
623 field, weight = self.fields[line][pos]
624 # field.SetBackgroundColour(wx.Color(222,222,222))
625 szr_line.Add(field, weight, wx.EXPAND)
626 szr_main_fgrid.Add(szr_line, flag=wx.GROW | wx.ALIGN_LEFT)
627
628 # grid can grow column 1 only, not column 0
629 szr_main_fgrid.AddGrowableCol(1)
630
631 # # use sizer for border around everything plus a little gap
632 # # FIXME: fold into szr_main_panels ?
633 # self.szr_central_container = wx.BoxSizer(wxHORIZONTAL)
634 # self.szr_central_container.Add(self.szr_main_panels, 1, wx.EXPAND | wxALL, 5)
635
636 # and do the layouting
637 self.SetSizerAndFit(szr_main_fgrid)
638 # self.FitInside()
639 #----------------------------------------------------------------
640 # intra-class API
641 #----------------------------------------------------------------
643 """Child classes override this to define their prompts using _add_prompt()"""
644 _log.error('missing override in [%s]' % self.__class__.__name__)
645 #----------------------------------------------------------------
647 """Add a new prompt line.
648
649 To be used from _define_fields in child classes.
650
651 - label, the label text
652 - color
653 - weight, the weight given in sizing the various rows. 0 means the row
654 always has minimum size
655 """
656 self.prompts[line] = (label, color, weight)
657 #----------------------------------------------------------------
659 """Defines the fields.
660
661 - override in child classes
662 - mostly uses _add_field()
663 """
664 _log.error('missing override in [%s]' % self.__class__.__name__)
665 #----------------------------------------------------------------
667 if None in (line, pos, widget):
668 _log.error('argument error in [%s]: line=%s, pos=%s, widget=%s' % (self.__class__.__name__, line, pos, widget))
669 if not self.fields.has_key(line):
670 self.fields[line] = {}
671 self.fields[line][pos] = (widget, weight)
672 #----------------------------------------------------------------
690 #====================================================================
691 #====================================================================
692 #text control class to be later replaced by the gmPhraseWheel
693 #--------------------------------------------------------------------
696 wx.TextCtrl.__init__(self,parent,id,"",pos, size ,wx.SIMPLE_BORDER)
697 _decorate_editarea_field(self)
698 #====================================================================
701
702 print "class [%s] is deprecated, use cEditArea2 instead" % self.__class__.__name__
703
704 # init main background panel
705 wx.Panel.__init__(self, parent, id, pos=pos, size=size, style=wx.NO_BORDER | wx.TAB_TRAVERSAL)
706 self.SetBackgroundColour(wx.Color(222,222,222))
707
708 self.data = None
709 self.fields = {}
710 self.prompts = {}
711
712 ID_BTN_OK = wx.NewId()
713 ID_BTN_CLEAR = wx.NewId()
714
715 self.__do_layout()
716
717 # self.input_fields = {}
718
719 # self._postInit()
720 # self.old_data = {}
721
722 self._patient = gmPerson.gmCurrentPatient()
723 self.__register_events()
724 self.Show(True)
725 #----------------------------------------------------------------
726 # internal helpers
727 #----------------------------------------------------------------
729 # define prompts and fields
730 self._define_prompts()
731 self.fields_pnl = wx.Panel(self, -1, style = wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
732 self._define_fields(parent = self.fields_pnl)
733 # and generate edit area from it
734 szr_prompts = self.__generate_prompts()
735 szr_fields = self.__generate_fields()
736
737 # stack prompts and fields horizontally
738 self.szr_main_panels = wx.BoxSizer(wx.HORIZONTAL)
739 self.szr_main_panels.Add(szr_prompts, 11, wx.EXPAND)
740 self.szr_main_panels.Add(5, 0, 0, wx.EXPAND)
741 self.szr_main_panels.Add(szr_fields, 90, wx.EXPAND)
742
743 # use sizer for border around everything plus a little gap
744 # FIXME: fold into szr_main_panels ?
745 self.szr_central_container = wx.BoxSizer(wx.HORIZONTAL)
746 self.szr_central_container.Add(self.szr_main_panels, 1, wx.EXPAND | wx.ALL, 5)
747
748 # and do the layouting
749 self.SetAutoLayout(True)
750 self.SetSizer(self.szr_central_container)
751 self.szr_central_container.Fit(self)
752 #----------------------------------------------------------------
754 if len(self.fields) != len(self.prompts):
755 _log.error('[%s]: #fields != #prompts' % self.__class__.__name__)
756 return None
757 # prompts live on a panel
758 prompt_pnl = wx.Panel(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER)
759 prompt_pnl.SetBackgroundColour(richards_light_gray)
760 # make them
761 color = richards_aqua
762 lines = self.prompts.keys()
763 lines.sort()
764 self.prompt_widget = {}
765 for line in lines:
766 label, color, weight = self.prompts[line]
767 self.prompt_widget[line] = self.__make_prompt(prompt_pnl, "%s " % label, color)
768 # make shadow below prompts in gray
769 shadow_below_prompts = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
770 shadow_below_prompts.SetBackgroundColour(richards_dark_gray)
771 szr_shadow_below_prompts = wx.BoxSizer (wx.HORIZONTAL)
772 szr_shadow_below_prompts.Add(5, 0, 0, wx.EXPAND)
773 szr_shadow_below_prompts.Add(shadow_below_prompts, 10, wx.EXPAND)
774
775 # stack prompt panel and shadow vertically
776 vszr_prompts = wx.BoxSizer(wx.VERTICAL)
777 vszr_prompts.Add(prompt_pnl, 97, wx.EXPAND)
778 vszr_prompts.Add(szr_shadow_below_prompts, 5, wx.EXPAND)
779
780 # make shadow to the right of the prompts
781 shadow_rightof_prompts = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
782 shadow_rightof_prompts.SetBackgroundColour(richards_dark_gray)
783 szr_shadow_rightof_prompts = wx.BoxSizer(wx.VERTICAL)
784 szr_shadow_rightof_prompts.Add(0,5,0,wx.EXPAND)
785 szr_shadow_rightof_prompts.Add(shadow_rightof_prompts, 1, wx.EXPAND)
786
787 # stack vertical prompt sizer and shadow horizontally
788 hszr_prompts = wx.BoxSizer(wx.HORIZONTAL)
789 hszr_prompts.Add(vszr_prompts, 10, wx.EXPAND)
790 hszr_prompts.Add(szr_shadow_rightof_prompts, 1, wx.EXPAND)
791
792 return hszr_prompts
793 #----------------------------------------------------------------
795 self.fields_pnl.SetBackgroundColour(wx.Color(222,222,222))
796 # rows, cols, hgap, vgap
797 vszr = wx.BoxSizer(wx.VERTICAL)
798 lines = self.fields.keys()
799 lines.sort()
800 self.field_line_szr = {}
801 for line in lines:
802 self.field_line_szr[line] = wx.BoxSizer(wx.HORIZONTAL)
803 positions = self.fields[line].keys()
804 positions.sort()
805 for pos in positions:
806 field, weight = self.fields[line][pos]
807 self.field_line_szr[line].Add(field, weight, wx.EXPAND)
808 try:
809 vszr.Add(self.field_line_szr[line], self.prompts[line][2], flag = wx.EXPAND) # use same lineweight as prompts
810 except KeyError:
811 _log.error("Error with line=%s, self.field_line_szr has key:%s; self.prompts has key: %s" % (line, self.field_line_szr.has_key(line), self.prompts.has_key(line) ) )
812 # put them on the panel
813 self.fields_pnl.SetSizer(vszr)
814 vszr.Fit(self.fields_pnl)
815
816 # make shadow below edit fields in gray
817 shadow_below_edit_fields = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
818 shadow_below_edit_fields.SetBackgroundColour(richards_coloured_gray)
819 szr_shadow_below_edit_fields = wx.BoxSizer(wx.HORIZONTAL)
820 szr_shadow_below_edit_fields.Add(5, 0, 0, wx.EXPAND)
821 szr_shadow_below_edit_fields.Add(shadow_below_edit_fields, 12, wx.EXPAND)
822
823 # stack edit fields and shadow vertically
824 vszr_edit_fields = wx.BoxSizer(wx.VERTICAL)
825 vszr_edit_fields.Add(self.fields_pnl, 92, wx.EXPAND)
826 vszr_edit_fields.Add(szr_shadow_below_edit_fields, 5, wx.EXPAND)
827
828 # make shadow to the right of the edit area
829 shadow_rightof_edit_fields = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
830 shadow_rightof_edit_fields.SetBackgroundColour(richards_coloured_gray)
831 szr_shadow_rightof_edit_fields = wx.BoxSizer(wx.VERTICAL)
832 szr_shadow_rightof_edit_fields.Add(0, 5, 0, wx.EXPAND)
833 szr_shadow_rightof_edit_fields.Add(shadow_rightof_edit_fields, 1, wx.EXPAND)
834
835 # stack vertical edit fields sizer and shadow horizontally
836 hszr_edit_fields = wx.BoxSizer(wx.HORIZONTAL)
837 hszr_edit_fields.Add(vszr_edit_fields, 89, wx.EXPAND)
838 hszr_edit_fields.Add(szr_shadow_rightof_edit_fields, 1, wx.EXPAND)
839
840 return hszr_edit_fields
841 #---------------------------------------------------------------
843 # FIXME: style for centering in vertical direction ?
844 prompt = wx.StaticText(
845 parent,
846 -1,
847 aLabel,
848 style = wx.ALIGN_RIGHT
849 )
850 prompt.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False, ''))
851 prompt.SetForegroundColour(aColor)
852 return prompt
853 #----------------------------------------------------------------
854 # intra-class API
855 #----------------------------------------------------------------
857 """Add a new prompt line.
858
859 To be used from _define_fields in child classes.
860
861 - label, the label text
862 - color
863 - weight, the weight given in sizing the various rows. 0 means the rwo
864 always has minimum size
865 """
866 self.prompts[line] = (label, color, weight)
867 #----------------------------------------------------------------
869 if None in (line, pos, widget):
870 _log.error('argument error in [%s]: line=%s, pos=%s, widget=%s' % (self.__class__.__name__, line, pos, widget))
871 if not self.fields.has_key(line):
872 self.fields[line] = {}
873 self.fields[line][pos] = (widget, weight)
874 #----------------------------------------------------------------
876 """Defines the fields.
877
878 - override in child classes
879 - mostly uses _add_field()
880 """
881 _log.error('missing override in [%s]' % self.__class__.__name__)
882 #----------------------------------------------------------------
884 _log.error('missing override in [%s]' % self.__class__.__name__)
885 #----------------------------------------------------------------
899 #--------------------------------------------------------
902 #--------------------------------------------------------
904 _log.error('[%s] programmer forgot to define _save_data()' % self.__class__.__name__)
905 _log.info('child classes of cEditArea *must* override this function')
906 return False
907 #--------------------------------------------------------
908 # event handling
909 #--------------------------------------------------------
911 # connect standard buttons
912 wx.EVT_BUTTON(self.btn_OK, ID_BTN_OK, self._on_OK_btn_pressed)
913 wx.EVT_BUTTON(self.btn_Clear, ID_BTN_CLEAR, self._on_clear_btn_pressed)
914
915 wx.EVT_SIZE (self.fields_pnl, self._on_resize_fields)
916
917 # client internal signals
918 gmDispatcher.connect(signal = u'pre_patient_selection', receiver = self._on_pre_patient_selection)
919 gmDispatcher.connect(signal = u'application_closing', receiver = self._on_application_closing)
920 gmDispatcher.connect(signal = u'post_patient_selection', receiver = self.on_post_patient_selection)
921
922 return 1
923 #--------------------------------------------------------
924 # handlers
925 #--------------------------------------------------------
927 # FIXME: this try: except: block seems to large
928 try:
929 event.Skip()
930 if self.data is None:
931 self._save_new_entry()
932 self.set_data()
933 else:
934 self._save_modified_entry()
935 self.set_data()
936 except gmExceptions.InvalidInputError, err:
937 # nasty evil popup dialogue box
938 # but for invalid input we want to interrupt user
939 gmGuiHelpers.gm_show_error (err, _("Invalid Input"))
940 except:
941 _log.exception( "save data problem in [%s]" % self.__class__.__name__)
942 #--------------------------------------------------------
947 #--------------------------------------------------------
951 #--------------------------------------------------------
953 # remember wxCallAfter
954 if not self._patient.connected:
955 return True
956 if self._save_data():
957 return True
958 _log.error('[%s] lossage' % self.__class__.__name__)
959 return False
960 #--------------------------------------------------------
962 # remember wxCallAfter
963 if not self._patient.connected:
964 return True
965 if self._save_data():
966 return True
967 _log.error('[%s] lossage' % self.__class__.__name__)
968 return False
969 #--------------------------------------------------------
971 self.fields_pnl.Layout()
972 # resize the prompts accordingly
973 for i in self.field_line_szr.keys():
974 # query the BoxSizer to find where the field line is
975 pos = self.field_line_szr[i].GetPosition()
976 # and set the prompt lable to the same Y position
977 self.prompt_widget[i].SetPosition((0, pos.y))
978 #====================================================================
981
982 print "class [%s] is deprecated, use cEditArea2 instead" % self.__class__.__name__
983
984 # sanity checks
985 if aType not in _known_edit_area_types:
986 _log.error('unknown edit area type: [%s]' % aType)
987 raise gmExceptions.ConstructorError, 'unknown edit area type: [%s]' % aType
988 self._type = aType
989
990 # init main background panel
991 cEditArea.__init__(self, parent, id)
992
993 self.input_fields = {}
994
995 self._postInit()
996 self.old_data = {}
997
998 self._patient = gmPerson.gmCurrentPatient()
999 self.Show(True)
1000 #----------------------------------------------------------------
1001 # internal helpers
1002 #----------------------------------------------------------------
1003 #----------------------------------------------------------------
1004 # to be obsoleted
1005 #----------------------------------------------------------------
1007 # prompts live on a panel
1008 prompt_pnl = wx.Panel(self, -1, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER)
1009 prompt_pnl.SetBackgroundColour(richards_light_gray)
1010 # make them
1011 gszr = wx.FlexGridSizer (len(prompt_labels)+1, 1, 2, 2)
1012 color = richards_aqua
1013 for prompt in prompt_labels:
1014 label = self.__make_prompt(prompt_pnl, "%s " % prompt, color)
1015 gszr.Add(label, 0, wx.EXPAND | wx.ALIGN_RIGHT)
1016 color = richards_blue
1017 gszr.RemoveGrowableRow (line-1)
1018 # put sizer on panel
1019 prompt_pnl.SetSizer(gszr)
1020 gszr.Fit(prompt_pnl)
1021 prompt_pnl.SetAutoLayout(True)
1022
1023 # make shadow below prompts in gray
1024 shadow_below_prompts = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1025 shadow_below_prompts.SetBackgroundColour(richards_dark_gray)
1026 szr_shadow_below_prompts = wx.BoxSizer (wx.HORIZONTAL)
1027 szr_shadow_below_prompts.Add(5, 0, 0, wx.EXPAND)
1028 szr_shadow_below_prompts.Add(shadow_below_prompts, 10, wx.EXPAND)
1029
1030 # stack prompt panel and shadow vertically
1031 vszr_prompts = wx.BoxSizer(wx.VERTICAL)
1032 vszr_prompts.Add(prompt_pnl, 97, wx.EXPAND)
1033 vszr_prompts.Add(szr_shadow_below_prompts, 5, wx.EXPAND)
1034
1035 # make shadow to the right of the prompts
1036 shadow_rightof_prompts = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1037 shadow_rightof_prompts.SetBackgroundColour(richards_dark_gray)
1038 szr_shadow_rightof_prompts = wx.BoxSizer(wx.VERTICAL)
1039 szr_shadow_rightof_prompts.Add(0,5,0,wx.EXPAND)
1040 szr_shadow_rightof_prompts.Add(shadow_rightof_prompts,1,wx.EXPAND)
1041
1042 # stack vertical prompt sizer and shadow horizontally
1043 hszr_prompts = wx.BoxSizer(wx.HORIZONTAL)
1044 hszr_prompts.Add(vszr_prompts, 10, wx.EXPAND)
1045 hszr_prompts.Add(szr_shadow_rightof_prompts, 1, wx.EXPAND)
1046
1047 return hszr_prompts
1048 #----------------------------------------------------------------
1050 _log.error('programmer forgot to define edit area lines for [%s]' % self._type)
1051 _log.info('child classes of gmEditArea *must* override this function')
1052 return []
1053 #----------------------------------------------------------------
1055 # make edit fields
1056 fields_pnl = wx.Panel(self, -1, wx.DefaultPosition, wx.DefaultSize, style = wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
1057 fields_pnl.SetBackgroundColour(wx.Color(222,222,222))
1058 # rows, cols, hgap, vgap
1059 gszr = wx.GridSizer(len(_prompt_defs[self._type]), 1, 2, 2)
1060
1061 # get lines
1062 lines = self._make_edit_lines(parent = fields_pnl)
1063
1064 self.lines = lines
1065 if len(lines) != len(_prompt_defs[self._type]):
1066 _log.error('#(edit lines) not equal #(prompts) for [%s], something is fishy' % self._type)
1067 for line in lines:
1068 gszr.Add(line, 0, wx.EXPAND | wx.ALIGN_LEFT)
1069 # put them on the panel
1070 fields_pnl.SetSizer(gszr)
1071 gszr.Fit(fields_pnl)
1072 fields_pnl.SetAutoLayout(True)
1073
1074 # make shadow below edit fields in gray
1075 shadow_below_edit_fields = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1076 shadow_below_edit_fields.SetBackgroundColour(richards_coloured_gray)
1077 szr_shadow_below_edit_fields = wx.BoxSizer(wx.HORIZONTAL)
1078 szr_shadow_below_edit_fields.Add(5, 0, 0, wx.EXPAND)
1079 szr_shadow_below_edit_fields.Add(shadow_below_edit_fields, 12, wx.EXPAND)
1080
1081 # stack edit fields and shadow vertically
1082 vszr_edit_fields = wx.BoxSizer(wx.VERTICAL)
1083 vszr_edit_fields.Add(fields_pnl, 92, wx.EXPAND)
1084 vszr_edit_fields.Add(szr_shadow_below_edit_fields, 5, wx.EXPAND)
1085
1086 # make shadow to the right of the edit area
1087 shadow_rightof_edit_fields = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1088 shadow_rightof_edit_fields.SetBackgroundColour(richards_coloured_gray)
1089 szr_shadow_rightof_edit_fields = wx.BoxSizer(wx.VERTICAL)
1090 szr_shadow_rightof_edit_fields.Add(0, 5, 0, wx.EXPAND)
1091 szr_shadow_rightof_edit_fields.Add(shadow_rightof_edit_fields, 1, wx.EXPAND)
1092
1093 # stack vertical edit fields sizer and shadow horizontally
1094 hszr_edit_fields = wx.BoxSizer(wx.HORIZONTAL)
1095 hszr_edit_fields.Add(vszr_edit_fields, 89, wx.EXPAND)
1096 hszr_edit_fields.Add(szr_shadow_rightof_edit_fields, 1, wx.EXPAND)
1097
1098 return hszr_edit_fields
1099
1102
1104 #self.dirty = 0 #this flag is for patient_activating event to save any unsaved entries
1105 self.setInputFieldValues( self._get_init_values())
1106 self.data = None
1107
1113
1114 #--------------------------------------------------------
1117
1118 # _log.Log(gmLog.lErr, 'programmer forgot to define _init_fields() for [%s]' % self._type)
1119 # _log.Log(gmLog.lInfo, 'child classes of gmEditArea *must* override this function')
1120 # raise AttributeError
1121 #-------------------------------------------------------------------------------------------------------------
1123 _log.warning("you may want to override _updateUI for [%s]" % self.__class__.__name__)
1124
1125
1129
1130
1132 szr = wx.BoxSizer(wx.HORIZONTAL)
1133 szr.Add( widget, weight, wx.EXPAND)
1134 szr.Add( 0,0, spacerWeight, wx.EXPAND)
1135 return szr
1136
1138
1139 cb = wx.CheckBox( parent, -1, _(title))
1140 cb.SetForegroundColour( richards_blue)
1141 return cb
1142
1143
1144
1146 """this is a utlity method to add extra columns"""
1147 #add an extra column if the class has attribute "extraColumns"
1148 if self.__class__.__dict__.has_key("extraColumns"):
1149 for x in self.__class__.extraColumns:
1150 lines = self._addColumn(parent, lines, x, weightMap)
1151 return lines
1152
1153
1154
1155 - def _addColumn(self, parent, lines, extra, weightMap = {}, existingWeight = 5 , extraWeight = 2):
1156 """
1157 # add ia extra column in the edit area.
1158 # preconditions:
1159 # parent is fields_pnl (weak);
1160 # self.input_fields exists (required);
1161 # ; extra is a list of tuples of format -
1162 # ( key for input_fields, widget label , widget class to instantiate )
1163 """
1164
1165 newlines = []
1166 i = 0
1167 for x in lines:
1168 # adjust weight if line has specific weightings.
1169 if weightMap.has_key( x):
1170 (existingWeight, extraWeight) = weightMap[x]
1171
1172 szr = wx.BoxSizer(wx.HORIZONTAL)
1173 szr.Add( x, existingWeight, wx.EXPAND)
1174 if i < len(extra) and extra[i] <> None:
1175
1176 (inputKey, widgetLabel, aclass) = extra[i]
1177 if aclass.__name__ in CONTROLS_WITHOUT_LABELS:
1178 szr.Add( self._make_prompt(parent, widgetLabel, richards_blue) )
1179 widgetLabel = ""
1180
1181
1182 w = aclass( parent, -1, widgetLabel)
1183 if not aclass.__name__ in CONTROLS_WITHOUT_LABELS:
1184 w.SetForegroundColour(richards_blue)
1185
1186 szr.Add(w, extraWeight , wx.EXPAND)
1187
1188 # make sure the widget is locatable via input_fields
1189 self.input_fields[inputKey] = w
1190
1191 newlines.append(szr)
1192 i += 1
1193 return newlines
1194
1196 #self.monitoring_dirty = 0
1197 for k,v in map.items():
1198 field = self.input_fields.get(k, None)
1199 if field == None:
1200 continue
1201 try:
1202 field.SetValue( str(v) )
1203 except:
1204 try:
1205 if type(v) == type(''):
1206 v = 0
1207
1208 field.SetValue( v)
1209 except:
1210 pass
1211 self.setDataId(id)
1212 #self.monitoring_dirty = 1
1213 self.set_old_data(self.getInputFieldValues())
1214
1216 return self.data
1217
1219 self.data = id
1220
1222 values = {}
1223 for k,v in self.input_fields.items():
1224 values[k] = v.GetValue()
1225 return values
1226
1237 #====================================================================
1240 try:
1241 gmEditArea.__init__(self, parent, id, aType = 'family history')
1242 except gmExceptions.ConstructorError:
1243 _log.exceptions('cannot instantiate family Hx edit area')
1244 raise
1245 #----------------------------------------------------------------
1247 _log.debug("making family Hx lines")
1248 lines = []
1249 self.input_fields = {}
1250 # line 1
1251 # FIXME: put patient search widget here, too ...
1252 # add button "make active patient"
1253 self.input_fields['name'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1254 self.input_fields['DOB'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1255 lbl_dob = self._make_prompt(parent, _(" Date of Birth "), richards_blue)
1256 szr = wx.BoxSizer(wx.HORIZONTAL)
1257 szr.Add(self.input_fields['name'], 4, wx.EXPAND)
1258 szr.Add(lbl_dob, 2, wx.EXPAND)
1259 szr.Add(self.input_fields['DOB'], 4, wx.EXPAND)
1260 lines.append(szr)
1261 # line 2
1262 # FIXME: keep relationship attachments permamently ! (may need to make new patient ...)
1263 # FIXME: learning phrasewheel attached to list loaded from backend
1264 self.input_fields['relationship'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1265 szr = wx.BoxSizer(wx.HORIZONTAL)
1266 szr.Add(self.input_fields['relationship'], 4, wx.EXPAND)
1267 lines.append(szr)
1268 # line 3
1269 self.input_fields['condition'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1270 self.cb_condition_confidential = wx.CheckBox(parent, -1, _("confidental"), wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
1271 szr = wx.BoxSizer(wx.HORIZONTAL)
1272 szr.Add(self.input_fields['condition'], 6, wx.EXPAND)
1273 szr.Add(self.cb_condition_confidential, 0, wx.EXPAND)
1274 lines.append(szr)
1275 # line 4
1276 self.input_fields['comment'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1277 lines.append(self.input_fields['comment'])
1278 # line 5
1279 lbl_onset = self._make_prompt(parent, _(" age onset "), richards_blue)
1280 self.input_fields['age onset'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1281 # FIXME: combo box ...
1282 lbl_caused_death = self._make_prompt(parent, _(" caused death "), richards_blue)
1283 self.input_fields['caused death'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1284 lbl_aod = self._make_prompt(parent, _(" age died "), richards_blue)
1285 self.input_fields['AOD'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1286 szr = wx.BoxSizer(wx.HORIZONTAL)
1287 szr.Add(lbl_onset, 0, wx.EXPAND)
1288 szr.Add(self.input_fields['age onset'], 1,wx.EXPAND)
1289 szr.Add(lbl_caused_death, 0, wx.EXPAND)
1290 szr.Add(self.input_fields['caused death'], 2,wx.EXPAND)
1291 szr.Add(lbl_aod, 0, wx.EXPAND)
1292 szr.Add(self.input_fields['AOD'], 1, wx.EXPAND)
1293 szr.Add(2, 2, 8)
1294 lines.append(szr)
1295 # line 6
1296 self.input_fields['progress notes'] = cEditAreaField(parent, -1, wx.DefaultPosition, wx.DefaultSize)
1297 lines.append(self.input_fields['progress notes'])
1298 # line 8
1299 self.Btn_next_condition = wx.Button(parent, -1, _("Next Condition"))
1300 szr = wx.BoxSizer(wx.HORIZONTAL)
1301 szr.AddSpacer(10, 0, 0)
1302 szr.Add(self.Btn_next_condition, 0, wx.EXPAND | wx.ALL, 1)
1303 szr.Add(2, 1, 5)
1304 szr.Add(self._make_standard_buttons(parent), 0, wx.EXPAND)
1305 lines.append(szr)
1306
1307 return lines
1308
1311
1312 #====================================================================
1314
1317
1319 self._add_prompt(line = 1, label = _("When Noted"))
1320 self._add_prompt(line = 2, label = _("Laterality"))
1321 self._add_prompt(line = 3, label = _("Condition"))
1322 self._add_prompt(line = 4, label = _("Notes"))
1323 self._add_prompt(line = 6, label = _("Status"))
1324 self._add_prompt(line = 7, label = _("Progress Note"))
1325 self._add_prompt(line = 8, label = '')
1326 #--------------------------------------------------------
1328 # line 1
1329 self.fld_date_noted = gmDateTimeInput.gmDateInput(
1330 parent = parent,
1331 id = -1,
1332 style = wx.SIMPLE_BORDER
1333 )
1334 self._add_field(
1335 line = 1,
1336 pos = 1,
1337 widget = self.fld_date_noted,
1338 weight = 2
1339 )
1340 self._add_field(
1341 line = 1,
1342 pos = 2,
1343 widget = cPrompt_edit_area(parent,-1, _("Age")),
1344 weight = 0)
1345
1346 self.fld_age_noted = cEditAreaField(parent)
1347 self._add_field(
1348 line = 1,
1349 pos = 3,
1350 widget = self.fld_age_noted,
1351 weight = 2
1352 )
1353
1354 # line 2
1355 self.fld_laterality_none= wx.RadioButton(parent, -1, _("N/A"))
1356 self.fld_laterality_left= wx.RadioButton(parent, -1, _("L"))
1357 self.fld_laterality_right= wx.RadioButton(parent, -1, _("R"))
1358 self.fld_laterality_both= wx.RadioButton(parent, -1, _("both"))
1359 self._add_field(
1360 line = 2,
1361 pos = 1,
1362 widget = self.fld_laterality_none,
1363 weight = 0
1364 )
1365 self._add_field(
1366 line = 2,
1367 pos = 2,
1368 widget = self.fld_laterality_left,
1369 weight = 0
1370 )
1371 self._add_field(
1372 line = 2,
1373 pos = 3,
1374 widget = self.fld_laterality_right,
1375 weight = 1
1376 )
1377 self._add_field(
1378 line = 2,
1379 pos = 4,
1380 widget = self.fld_laterality_both,
1381 weight = 1
1382 )
1383 # line 3
1384 self.fld_condition= cEditAreaField(parent)
1385 self._add_field(
1386 line = 3,
1387 pos = 1,
1388 widget = self.fld_condition,
1389 weight = 6
1390 )
1391 # line 4
1392 self.fld_notes= cEditAreaField(parent)
1393 self._add_field(
1394 line = 4,
1395 pos = 1,
1396 widget = self.fld_notes,
1397 weight = 6
1398 )
1399 # line 5
1400 self.fld_significant= wx.CheckBox(
1401 parent,
1402 -1,
1403 _("significant"),
1404 style = wx.NO_BORDER
1405 )
1406 self.fld_active= wx.CheckBox(
1407 parent,
1408 -1,
1409 _("active"),
1410 style = wx.NO_BORDER
1411 )
1412
1413 self._add_field(
1414 line = 5,
1415 pos = 1,
1416 widget = self.fld_significant,
1417 weight = 0
1418 )
1419 self._add_field(
1420 line = 5,
1421 pos = 2,
1422 widget = self.fld_active,
1423 weight = 0
1424 )
1425 #line 6
1426 self.fld_progress= cEditAreaField(parent)
1427 self._add_field(
1428 line = 6,
1429 pos = 1,
1430 widget = self.fld_progress,
1431 weight = 6
1432 )
1433
1434 #line 7
1435 self._add_field(
1436 line = 7,
1437 pos = 4,
1438 widget = self._make_standard_buttons(parent),
1439 weight = 2
1440 )
1441 #--------------------------------------------------------
1443 return
1444 #handling of auto age or year filling.
1445 wx.EVT_KILL_FOCUS( self.fld_age_noted, self._ageKillFocus)
1446 wx.EVT_KILL_FOCUS( self.fld_date_noted, self._yearKillFocus)
1447 #--------------------------------------------------------
1449 # skip first, else later failure later in block causes widget to be unfocusable
1450 event.Skip()
1451 try :
1452 year = self._getBirthYear() + int(self.fld_age_noted.GetValue().strip() )
1453 self.fld_date_noted.SetValue( str (year) )
1454 except:
1455 pass
1456
1458 try:
1459 birthyear = int(str(self._patient['dob']).split('-')[0])
1460 except:
1461 birthyear = time.localtime()[0]
1462
1463 return birthyear
1464
1466 event.Skip()
1467 try:
1468 age = int(self.fld_date_noted.GetValue().strip() ) - self._getBirthYear()
1469 self.fld_age_noted.SetValue( str (age) )
1470 except:
1471 pass
1472
1473 __init_values = {
1474 "condition": "",
1475 "notes1": "",
1476 "notes2": "",
1477 "age": "",
1478 "year": str(time.localtime()[0]),
1479 "progress": "",
1480 "active": 1,
1481 "operation": 0,
1482 "confidential": 0,
1483 "significant": 1,
1484 "both": 0,
1485 "left": 0,
1486 "right": 0,
1487 "none" : 1
1488 }
1489
1495
1497 values = gmPastHistoryEditArea.__init_values
1498 values["age"] = str( self._getDefaultAge())
1499 return values
1500
1501
1503 clinical = self._patient.get_emr().get_past_history()
1504 if self.getDataId() is None:
1505 id = clinical.create_history( self.get_fields_formatting_values() )
1506 self.setDataId(id)
1507 return
1508
1509 clinical.update_history( self.get_fields_formatting_values(), self.getDataId() )
1510
1511 #====================================================================
1513
1515 try:
1516 gmEditArea.__init__(self, parent, id, aType = 'referral')
1517 except gmExceptions.ConstructorError:
1518 _log.exception('cannot instantiate referral edit area')
1519 self.data = None # we don't use this in this widget
1520 self.recipient = None
1521
1523 self._add_prompt (line = 1, label = _ ("Specialty"))
1524 self._add_prompt (line = 2, label = _ ("Name"))
1525 self._add_prompt (line = 3, label = _ ("Address"))
1526 self._add_prompt (line = 4, label = _ ("Options"))
1527 self._add_prompt (line = 5, label = _("Text"), weight =6)
1528 self._add_prompt (line = 6, label = "")
1529
1531 self.fld_specialty = gmPhraseWheel.cPhraseWheel (
1532 parent = parent,
1533 id = -1,
1534 style = wx.SIMPLE_BORDER
1535 )
1536 #_decorate_editarea_field (self.fld_specialty)
1537 self._add_field (
1538 line = 1,
1539 pos = 1,
1540 widget = self.fld_specialty,
1541 weight = 1
1542 )
1543 self.fld_name = gmPhraseWheel.cPhraseWheel (
1544 parent = parent,
1545 id = -1,
1546 style = wx.SIMPLE_BORDER
1547 )
1548 #_decorate_editarea_field (self.fld_name)
1549 self._add_field (
1550 line = 2,
1551 pos = 1,
1552 widget = self.fld_name,
1553 weight = 1
1554 )
1555 self.fld_address = wx.ComboBox (parent, -1, style = wx.CB_READONLY)
1556 #_decorate_editarea_field (self.fld_address)
1557 self._add_field (
1558 line = 3,
1559 pos = 1,
1560 widget = self.fld_address,
1561 weight = 1
1562 )
1563 # FIXME: replace with set_callback_on_*
1564 # self.fld_specialty.setDependent (self.fld_name, "occupation")
1565 self.fld_name.add_callback_on_selection(self.setAddresses)
1566 # flags line
1567 self.fld_med = wx.CheckBox (parent, -1, _("Meds"), style=wx.NO_BORDER)
1568 self._add_field (
1569 line = 4,
1570 pos = 1,
1571 widget = self.fld_med,
1572 weight = 1
1573 )
1574 self.fld_past = wx.CheckBox (parent, -1, _("Past Hx"), style=wx.NO_BORDER)
1575 self._add_field (
1576 line = 4,
1577 pos = 4,
1578 widget = self.fld_past,
1579 weight = 1
1580 )
1581 self.fld_text = wx.TextCtrl (parent, -1, style= wx.TE_MULTILINE)
1582 self._add_field (
1583 line = 5,
1584 pos = 1,
1585 widget = self.fld_text,
1586 weight = 1)
1587 # final line
1588 self._add_field(
1589 line = 6,
1590 pos = 1,
1591 widget = self._make_standard_buttons(parent),
1592 weight = 1
1593 )
1594 return 1
1595
1597 """
1598 Doesn't accept any value as this doesn't make sense for this edit area
1599 """
1600 self.fld_specialty.SetValue ('')
1601 self.fld_name.SetValue ('')
1602 self.fld_address.Clear ()
1603 self.fld_address.SetValue ('')
1604 self.fld_med.SetValue (0)
1605 self.fld_past.SetValue (0)
1606 self.fld_text.SetValue ('')
1607 self.recipient = None
1608
1610 """
1611 Set the available addresses for the selected identity
1612 """
1613 if id is None:
1614 self.recipient = None
1615 self.fld_address.Clear ()
1616 self.fld_address.SetValue ('')
1617 else:
1618 self.recipient = gmDemographicRecord.cDemographicRecord_SQL (id)
1619 self.fld_address.Clear ()
1620 self.addr = self.recipient.getAddresses ('work')
1621 for i in self.addr:
1622 self.fld_address.Append (_("%(number)s %(street)s, %(urb)s %(postcode)s") % i, ('post', i))
1623 fax = self.recipient.getCommChannel (gmDemographicRecord.FAX)
1624 email = self.recipient.getCommChannel (gmDemographicRecord.EMAIL)
1625 if fax:
1626 self.fld_address.Append ("%s: %s" % (_("FAX"), fax), ('fax', fax))
1627 if email:
1628 self.fld_address.Append ("%s: %s" % (_("E-MAIL"), email), ('email', email))
1629
1631 """
1632 We are always saving a "new entry" here because data_ID is always None
1633 """
1634 if not self.recipient:
1635 raise gmExceptions.InvalidInputError(_('must have a recipient'))
1636 if self.fld_address.GetSelection() == -1:
1637 raise gmExceptions.InvalidInputError(_('must select address'))
1638 channel, addr = self.fld_address.GetClientData (self.fld_address.GetSelection())
1639 text = self.fld_text.GetValue()
1640 flags = {}
1641 flags['meds'] = self.fld_med.GetValue()
1642 flags['pasthx'] = self.fld_past.GetValue()
1643 if not gmReferral.create_referral (self._patient, self.recipient, channel, addr, text, flags):
1644 raise gmExceptions.InvalidInputError('error sending form')
1645
1646 #====================================================================
1647 #====================================================================
1648 # unconverted edit areas below
1649 #====================================================================
1652 try:
1653 gmEditArea.__init__(self, parent, id, aType = 'prescription')
1654 except gmExceptions.ConstructorError:
1655 _log.exceptions('cannot instantiate prescription edit area')
1656 raise
1657
1658
1659 #----------------------------------------------------------------
1661 _log.debug("making prescription lines")
1662 lines = []
1663 self.txt_problem = cEditAreaField(parent)
1664 self.txt_class = cEditAreaField(parent)
1665 self.txt_generic = cEditAreaField(parent)
1666 self.txt_brand = cEditAreaField(parent)
1667 self.txt_strength= cEditAreaField(parent)
1668 self.txt_directions= cEditAreaField(parent)
1669 self.txt_for = cEditAreaField(parent)
1670 self.txt_progress = cEditAreaField(parent)
1671
1672 lines.append(self.txt_problem)
1673 lines.append(self.txt_class)
1674 lines.append(self.txt_generic)
1675 lines.append(self.txt_brand)
1676 lines.append(self.txt_strength)
1677 lines.append(self.txt_directions)
1678 lines.append(self.txt_for)
1679 lines.append(self.txt_progress)
1680 lines.append(self._make_standard_buttons(parent))
1681 self.input_fields = {
1682 "problem": self.txt_problem,
1683 "class" : self.txt_class,
1684 "generic" : self.txt_generic,
1685 "brand" : self.txt_brand,
1686 "strength": self.txt_strength,
1687 "directions": self.txt_directions,
1688 "for" : self.txt_for,
1689 "progress": self.txt_progress
1690
1691 }
1692
1693 return self._makeExtraColumns( parent, lines)
1694
1695
1696 # This makes gmPrescriptionEditArea more adaptable to different nationalities special requirements.
1697 # ( well, it could be.)
1698 # to change at runtime, do
1699
1700 # gmPrescriptionEditArea.extraColumns = [ one or more columnListInfo ]
1701
1702 # each columnListInfo element describes one column,
1703 # where columnListInfo is a list of
1704 # tuples of [ inputMap name, widget label, widget class to instantiate from]
1705
1706 #gmPrescriptionEditArea.extraColumns = [ basicPrescriptionExtra ]
1707 #gmPrescriptionEditArea.extraColumns = [ auPrescriptionExtra ]
1708
1709
1712
1713 #====================================================================
1714 # old style stuff below
1715 #====================================================================
1716 #Class which shows a blue bold label left justified
1717 #--------------------------------------------------------------------
1720 wx.StaticText.__init__(self, parent, id, prompt, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_LEFT)
1721 self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False, ''))
1722 self.SetForegroundColour(aColor)
1723 #====================================================================
1724 # create the editorprompts class which expects a dictionary of labels
1725 # passed to it with prompts relevant to the editing area.
1726 # remove the if else from this once the edit area labelling is fixed
1727 #--------------------------------------------------------------------
1730 wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER)
1731 self.SetBackgroundColour(richards_light_gray)
1732 gszr = wx.GridSizer (len(prompt_labels)+1, 1, 2, 2)
1733 color = richards_aqua
1734 for prompt_key in prompt_labels.keys():
1735 label = cPrompt_edit_area(self, -1, " %s" % prompt_labels[prompt_key], aColor = color)
1736 gszr.Add(label, 0, wx.EXPAND | wx.ALIGN_RIGHT)
1737 color = richards_blue
1738 self.SetSizer(gszr)
1739 gszr.Fit(self)
1740 self.SetAutoLayout(True)
1741 #====================================================================
1742 #Class central to gnumed data input
1743 #allows data entry of multiple different types.e.g scripts,
1744 #referrals, measurements, recalls etc
1745 #@TODO : just about everything
1746 #section = calling section eg allergies, script
1747 #----------------------------------------------------------
1750 wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize,style = wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
1751 self.SetBackgroundColour(wx.Color(222,222,222))
1752 self.parent = parent
1753 # rows, cols, hgap, vgap
1754 self.gszr = wx.GridSizer(len(editareaprompts), 1, 2, 2)
1755
1756 if section == gmSECTION_SUMMARY:
1757 pass
1758 elif section == gmSECTION_DEMOGRAPHICS:
1759 pass
1760 elif section == gmSECTION_CLINICALNOTES:
1761 pass
1762 elif section == gmSECTION_FAMILYHISTORY:
1763 pass
1764 elif section == gmSECTION_PASTHISTORY:
1765 pass
1766 # line 1
1767
1768 self.txt_condition = cEditAreaField(self,PHX_CONDITION,wx.DefaultPosition,wx.DefaultSize)
1769 self.rb_sideleft = wxRadioButton(self,PHX_LEFT, _(" (L) "), wx.DefaultPosition,wx.DefaultSize)
1770 self.rb_sideright = wxRadioButton(self, PHX_RIGHT, _("(R)"), wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER)
1771 self.rb_sideboth = wxRadioButton(self, PHX_BOTH, _("Both"), wx.DefaultPosition,wx.DefaultSize)
1772 rbsizer = wx.BoxSizer(wx.HORIZONTAL)
1773 rbsizer.Add(self.rb_sideleft,1,wx.EXPAND)
1774 rbsizer.Add(self.rb_sideright,1,wx.EXPAND)
1775 rbsizer.Add(self.rb_sideboth,1,wx.EXPAND)
1776 szr1 = wx.BoxSizer(wx.HORIZONTAL)
1777 szr1.Add(self.txt_condition, 4, wx.EXPAND)
1778 szr1.Add(rbsizer, 3, wx.EXPAND)
1779 # self.sizer_line1.Add(self.rb_sideleft,1,wx.EXPAND|wxALL,2)
1780 # self.sizer_line1.Add(self.rb_sideright,1,wx.EXPAND|wxALL,2)
1781 # self.sizer_line1.Add(self.rb_sideboth,1,wx.EXPAND|wxALL,2)
1782 # line 2
1783 self.txt_notes1 = cEditAreaField(self,PHX_NOTES,wx.DefaultPosition,wx.DefaultSize)
1784 # line 3
1785 self.txt_notes2= cEditAreaField(self,PHX_NOTES2,wx.DefaultPosition,wx.DefaultSize)
1786 # line 4
1787 self.txt_agenoted = cEditAreaField(self, PHX_AGE, wx.DefaultPosition, wx.DefaultSize)
1788 szr4 = wx.BoxSizer(wx.HORIZONTAL)
1789 szr4.Add(self.txt_agenoted, 1, wx.EXPAND)
1790 szr4.Add(5, 0, 5)
1791 # line 5
1792 self.txt_yearnoted = cEditAreaField(self,PHX_YEAR,wx.DefaultPosition,wx.DefaultSize)
1793 szr5 = wx.BoxSizer(wx.HORIZONTAL)
1794 szr5.Add(self.txt_yearnoted, 1, wx.EXPAND)
1795 szr5.Add(5, 0, 5)
1796 # line 6
1797 self.parent.cb_active = wx.CheckBox(self, PHX_ACTIVE, _("Active"), wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1798 self.parent.cb_operation = wx.CheckBox(self, PHX_OPERATION, _("Operation"), wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1799 self.parent.cb_confidential = wx.CheckBox(self, PHX_CONFIDENTIAL , _("Confidential"), wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1800 self.parent.cb_significant = wx.CheckBox(self, PHX_SIGNIFICANT, _("Significant"), wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1801 szr6 = wx.BoxSizer(wx.HORIZONTAL)
1802 szr6.Add(self.parent.cb_active, 1, wx.EXPAND)
1803 szr6.Add(self.parent.cb_operation, 1, wx.EXPAND)
1804 szr6.Add(self.parent.cb_confidential, 1, wx.EXPAND)
1805 szr6.Add(self.parent.cb_significant, 1, wx.EXPAND)
1806 # line 7
1807 self.txt_progressnotes = cEditAreaField(self,PHX_PROGRESSNOTES ,wx.DefaultPosition,wx.DefaultSize)
1808 # line 8
1809 szr8 = wx.BoxSizer(wx.HORIZONTAL)
1810 szr8.Add(5, 0, 6)
1811 szr8.Add(self._make_standard_buttons(), 0, wx.EXPAND)
1812
1813 self.gszr.Add(szr1,0,wx.EXPAND)
1814 self.gszr.Add(self.txt_notes1,0,wx.EXPAND)
1815 self.gszr.Add(self.txt_notes2,0,wx.EXPAND)
1816 self.gszr.Add(szr4,0,wx.EXPAND)
1817 self.gszr.Add(szr5,0,wx.EXPAND)
1818 self.gszr.Add(szr6,0,wx.EXPAND)
1819 self.gszr.Add(self.txt_progressnotes,0,wx.EXPAND)
1820 self.gszr.Add(szr8,0,wx.EXPAND)
1821 #self.anylist = wx.ListCtrl(self, -1, wx.DefaultPosition,wx.DefaultSize,wx.LC_REPORT|wx.LC_LIST|wx.SUNKEN_BORDER)
1822
1823 elif section == gmSECTION_SCRIPT:
1824 pass
1825 elif section == gmSECTION_REQUESTS:
1826 pass
1827 elif section == gmSECTION_RECALLS:
1828 pass
1829 else:
1830 pass
1831
1832 self.SetSizer(self.gszr)
1833 self.gszr.Fit(self)
1834
1835 self.SetAutoLayout(True)
1836 self.Show(True)
1837 #----------------------------------------------------------------
1846 #====================================================================
1849 _log.warning('***** old style EditArea instantiated, please convert *****')
1850
1851 wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize, style = wx.NO_BORDER)
1852 self.SetBackgroundColour(wx.Color(222,222,222))
1853
1854 # make prompts
1855 prompts = gmPnlEditAreaPrompts(self, -1, line_labels)
1856 # and shadow below prompts in ...
1857 shadow_below_prompts = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1858 # ... gray
1859 shadow_below_prompts.SetBackgroundColour(richards_dark_gray)
1860 szr_shadow_below_prompts = wx.BoxSizer (wx.HORIZONTAL)
1861 szr_shadow_below_prompts.Add(5,0,0,wx.EXPAND)
1862 szr_shadow_below_prompts.Add(shadow_below_prompts, 10, wx.EXPAND)
1863 # stack prompts and shadow vertically
1864 szr_prompts = wx.BoxSizer(wx.VERTICAL)
1865 szr_prompts.Add(prompts, 97, wx.EXPAND)
1866 szr_prompts.Add(szr_shadow_below_prompts, 5, wx.EXPAND)
1867
1868 # make edit fields
1869 edit_fields = EditTextBoxes(self, -1, line_labels, section)
1870 # make shadow below edit area ...
1871 shadow_below_editarea = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1872 # ... gray
1873 shadow_below_editarea.SetBackgroundColour(richards_coloured_gray)
1874 szr_shadow_below_editarea = wx.BoxSizer(wx.HORIZONTAL)
1875 szr_shadow_below_editarea.Add(5,0,0,wx.EXPAND)
1876 szr_shadow_below_editarea.Add(shadow_below_editarea, 12, wx.EXPAND)
1877 # stack edit fields and shadow vertically
1878 szr_editarea = wx.BoxSizer(wx.VERTICAL)
1879 szr_editarea.Add(edit_fields, 92, wx.EXPAND)
1880 szr_editarea.Add(szr_shadow_below_editarea, 5, wx.EXPAND)
1881
1882 # make shadows to the right of ...
1883 # ... the prompts ...
1884 shadow_rightof_prompts = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1885 shadow_rightof_prompts.SetBackgroundColour(richards_dark_gray)
1886 szr_shadow_rightof_prompts = wx.BoxSizer(wx.VERTICAL)
1887 szr_shadow_rightof_prompts.Add(0,5,0,wx.EXPAND)
1888 szr_shadow_rightof_prompts.Add(shadow_rightof_prompts,1,wx.EXPAND)
1889 # ... and the edit area
1890 shadow_rightof_editarea = wxWindow(self, -1, wx.DefaultPosition, wx.DefaultSize, 0)
1891 shadow_rightof_editarea.SetBackgroundColour(richards_coloured_gray)
1892 szr_shadow_rightof_editarea = wx.BoxSizer(wx.VERTICAL)
1893 szr_shadow_rightof_editarea.Add(0, 5, 0, wx.EXPAND)
1894 szr_shadow_rightof_editarea.Add(shadow_rightof_editarea, 1, wx.EXPAND)
1895
1896 # stack prompts, shadows and fields horizontally
1897 self.szr_main_panels = wx.BoxSizer(wx.HORIZONTAL)
1898 self.szr_main_panels.Add(szr_prompts, 10, wx.EXPAND)
1899 self.szr_main_panels.Add(szr_shadow_rightof_prompts, 1, wx.EXPAND)
1900 self.szr_main_panels.Add(5, 0, 0, wx.EXPAND)
1901 self.szr_main_panels.Add(szr_editarea, 89, wx.EXPAND)
1902 self.szr_main_panels.Add(szr_shadow_rightof_editarea, 1, wx.EXPAND)
1903
1904 # use sizer for border around everything plus a little gap
1905 # FIXME: fold into szr_main_panels ?
1906 self.szr_central_container = wx.BoxSizer(wx.HORIZONTAL)
1907 self.szr_central_container.Add(self.szr_main_panels, 1, wx.EXPAND | wx.ALL, 5)
1908 self.SetSizer(self.szr_central_container)
1909 self.szr_central_container.Fit(self)
1910 self.SetAutoLayout(True)
1911 self.Show(True)
1912
1913
1914 #====================================================================
1915 # old stuff still needed for conversion
1916 #--------------------------------------------------------------------
1917 #====================================================================
1918
1919 #====================================================================
1920
1921 # elif section == gmSECTION_SCRIPT:
1922 # gmLog.gmDefLog.Log (gmLog.lData, "in script section now")
1923 # self.text1_prescription_reason = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1924 # self.text2_drug_class = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1925 # self.text3_generic_drug = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1926 # self.text4_brand_drug = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1927 # self.text5_strength = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1928 # self.text6_directions = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1929 # self.text7_for_duration = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1930 # self.text8_prescription_progress_notes = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1931 # self.text9_quantity = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1932 # lbl_veterans = cPrompt_edit_area(self,-1," Veteran ")
1933 # lbl_reg24 = cPrompt_edit_area(self,-1," Reg 24 ")
1934 # lbl_quantity = cPrompt_edit_area(self,-1," Quantity ")
1935 # lbl_repeats = cPrompt_edit_area(self,-1," Repeats ")
1936 # lbl_usualmed = cPrompt_edit_area(self,-1," Usual ")
1937 # self.cb_veteran = wx.CheckBox(self, -1, " Yes ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1938 # self.cb_reg24 = wx.CheckBox(self, -1, " Yes ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1939 # self.cb_usualmed = wx.CheckBox(self, -1, " Yes ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1940 # self.sizer_auth_PI = wx.BoxSizer(wxHORIZONTAL)
1941 # self.btn_authority = wx.Button(self,-1,">Authority") #create authority script
1942 # self.btn_briefPI = wx.Button(self,-1,"Brief PI") #show brief drug product information
1943 # self.sizer_auth_PI.Add(self.btn_authority,1,wx.EXPAND|wxALL,2) #put authority button and PI button
1944 # self.sizer_auth_PI.Add(self.btn_briefPI,1,wx.EXPAND|wxALL,2) #on same sizer
1945 # self.text10_repeats = cEditAreaField(self,-1,wx.DefaultPosition,wx.DefaultSize)
1946 # self.sizer_line3.Add(self.text3_generic_drug,5,wx.EXPAND)
1947 # self.sizer_line3.Add(lbl_veterans,1,wx.EXPAND)
1948 # self.sizer_line3.Add(self.cb_veteran,1,wx.EXPAND)
1949 # self.sizer_line4.Add(self.text4_brand_drug,5,wx.EXPAND)
1950 # self.sizer_line4.Add(lbl_reg24,1,wx.EXPAND)
1951 # self.sizer_line4.Add(self.cb_reg24,1,wx.EXPAND)
1952 # self.sizer_line5.Add(self.text5_strength,5,wx.EXPAND)
1953 # self.sizer_line5.Add(lbl_quantity,1,wx.EXPAND)
1954 # self.sizer_line5.Add(self.text9_quantity,1,wx.EXPAND)
1955 # self.sizer_line6.Add(self.text6_directions,5,wx.EXPAND)
1956 # self.sizer_line6.Add(lbl_repeats,1,wx.EXPAND)
1957 # self.sizer_line6.Add(self.text10_repeats,1,wx.EXPAND)
1958 # self.sizer_line7.Add(self.text7_for_duration,5,wx.EXPAND)
1959 # self.sizer_line7.Add(lbl_usualmed,1,wx.EXPAND)
1960 # self.sizer_line7.Add(self.cb_usualmed,1,wx.EXPAND)
1961 # self.sizer_line8.Add(5,0,0)
1962 # self.sizer_line8.Add(self.sizer_auth_PI,2,wx.EXPAND)
1963 # self.sizer_line8.Add(5,0,2)
1964 # self.sizer_line8.Add(self.btn_OK,1,wx.EXPAND|wxALL,2)
1965 # self.sizer_line8.Add(self.btn_Clear,1,wx.EXPAND|wxALL,2)
1966 # self.gszr.Add(self.text1_prescription_reason,1,wx.EXPAND) #prescribe for
1967 # self.gszr.Add(self.text2_drug_class,1,wx.EXPAND) #prescribe by class
1968 # self.gszr.Add(self.sizer_line3,1,wx.EXPAND) #prescribe by generic, lbl_veterans, cb_veteran
1969 # self.gszr.Add(self.sizer_line4,1,wx.EXPAND) #prescribe by brand, lbl_reg24, cb_reg24
1970 # self.gszr.Add(self.sizer_line5,1,wx.EXPAND) #drug strength, lbl_quantity, text_quantity
1971 # self.gszr.Add(self.sizer_line6,1,wx.EXPAND) #txt_directions, lbl_repeats, text_repeats
1972 # self.gszr.Add(self.sizer_line7,1,wx.EXPAND) #text_for,lbl_usual,chk_usual
1973 # self.gszr.Add(self.text8_prescription_progress_notes,1,wx.EXPAND) #text_progressNotes
1974 # self.gszr.Add(self.sizer_line8,1,wx.EXPAND)
1975
1976
1977 # elif section == gmSECTION_REQUESTS:
1978 # #-----------------------------------------------------------------------------
1979 #editing area for general requests e.g pathology, radiology, physiotherapy etc
1980 #create textboxes, radiobuttons etc
1981 #-----------------------------------------------------------------------------
1982 # self.txt_request_type = cEditAreaField(self,ID_REQUEST_TYPE,wx.DefaultPosition,wx.DefaultSize)
1983 # self.txt_request_company = cEditAreaField(self,ID_REQUEST_COMPANY,wx.DefaultPosition,wx.DefaultSize)
1984 # self.txt_request_street = cEditAreaField(self,ID_REQUEST_STREET,wx.DefaultPosition,wx.DefaultSize)
1985 # self.txt_request_suburb = cEditAreaField(self,ID_REQUEST_SUBURB,wx.DefaultPosition,wx.DefaultSize)
1986 # self.txt_request_phone= cEditAreaField(self,ID_REQUEST_PHONE,wx.DefaultPosition,wx.DefaultSize)
1987 # self.txt_request_requests = cEditAreaField(self,ID_REQUEST_REQUESTS,wx.DefaultPosition,wx.DefaultSize)
1988 # self.txt_request_notes = cEditAreaField(self,ID_REQUEST_FORMNOTES,wx.DefaultPosition,wx.DefaultSize)
1989 # self.txt_request_medications = cEditAreaField(self,ID_REQUEST_MEDICATIONS,wx.DefaultPosition,wx.DefaultSize)
1990 # self.txt_request_copyto = cEditAreaField(self,ID_REQUEST_COPYTO,wx.DefaultPosition,wx.DefaultSize)
1991 # self.txt_request_progressnotes = cEditAreaField(self,ID_PROGRESSNOTES,wx.DefaultPosition,wx.DefaultSize)
1992 # self.lbl_companyphone = cPrompt_edit_area(self,-1," Phone ")
1993 # self.cb_includeallmedications = wx.CheckBox(self, -1, " Include all medications ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
1994 # self.rb_request_bill_bb = wxRadioButton(self, ID_REQUEST_BILL_BB, "Bulk Bill ", wx.DefaultPosition,wx.DefaultSize)
1995 # self.rb_request_bill_private = wxRadioButton(self, ID_REQUEST_BILL_PRIVATE, "Private", wx.DefaultPosition,wx.DefaultSize,wx.SUNKEN_BORDER)
1996 # self.rb_request_bill_rebate = wxRadioButton(self, ID_REQUEST_BILL_REBATE, "Rebate", wx.DefaultPosition,wx.DefaultSize)
1997 # self.rb_request_bill_wcover = wxRadioButton(self, ID_REQUEST_BILL_wcover, "w/cover", wx.DefaultPosition,wx.DefaultSize)
1998 #--------------------------------------------------------------
1999 #add controls to sizers where multiple controls per editor line
2000 #--------------------------------------------------------------
2001 # self.sizer_request_optionbuttons = wx.BoxSizer(wxHORIZONTAL)
2002 # self.sizer_request_optionbuttons.Add(self.rb_request_bill_bb,1,wx.EXPAND)
2003 # self.sizer_request_optionbuttons.Add(self.rb_request_bill_private ,1,wx.EXPAND)
2004 # self.sizer_request_optionbuttons.Add(self.rb_request_bill_rebate ,1,wx.EXPAND)
2005 # self.sizer_request_optionbuttons.Add(self.rb_request_bill_wcover ,1,wx.EXPAND)
2006 # self.sizer_line4.Add(self.txt_request_suburb,4,wx.EXPAND)
2007 # self.sizer_line4.Add(self.lbl_companyphone,1,wx.EXPAND)
2008 # self.sizer_line4.Add(self.txt_request_phone,2,wx.EXPAND)
2009 # self.sizer_line7.Add(self.txt_request_medications, 4,wx.EXPAND)
2010 # self.sizer_line7.Add(self.cb_includeallmedications,3,wx.EXPAND)
2011 # self.sizer_line10.AddSizer(self.sizer_request_optionbuttons,3,wx.EXPAND)
2012 # self.sizer_line10.AddSizer(self.szr_buttons,1,wx.EXPAND)
2013 #self.sizer_line10.Add(self.btn_OK,1,wx.EXPAND|wxALL,1)
2014 #self.sizer_line10.Add(self.btn_Clear,1,wx.EXPAND|wxALL,1)
2015 #------------------------------------------------------------------
2016 #add either controls or sizers with controls to vertical grid sizer
2017 #------------------------------------------------------------------
2018 # self.gszr.Add(self.txt_request_type,0,wx.EXPAND) #e.g Pathology
2019 # self.gszr.Add(self.txt_request_company,0,wx.EXPAND) #e.g Douglas Hanly Moir
2020 # self.gszr.Add(self.txt_request_street,0,wx.EXPAND) #e.g 120 Big Street
2021 # self.gszr.AddSizer(self.sizer_line4,0,wx.EXPAND) #e.g RYDE NSW Phone 02 1800 222 365
2022 # self.gszr.Add(self.txt_request_requests,0,wx.EXPAND) #e.g FBC;ESR;UEC;LFTS
2023 # self.gszr.Add(self.txt_request_notes,0,wx.EXPAND) #e.g generally tired;weight loss;
2024 # self.gszr.AddSizer(self.sizer_line7,0,wx.EXPAND) #e.g Lipitor;losec;zyprexa
2025 # self.gszr.Add(self.txt_request_copyto,0,wx.EXPAND) #e.g Dr I'm All Heart, 120 Big Street Smallville
2026 # self.gszr.Add(self.txt_request_progressnotes,0,wx.EXPAND) #emphasised to patient must return for results
2027 # self.sizer_line8.Add(5,0,6)
2028 # self.sizer_line8.Add(self.btn_OK,1,wx.EXPAND|wxALL,2)
2029 # self.sizer_line8.Add(self.btn_Clear,1,wx.EXPAND|wxALL,2)
2030 # self.gszr.Add(self.sizer_line10,0,wx.EXPAND) #options:b/bill private, rebate,w/cover btnok,btnclear
2031
2032
2033 # elif section == gmSECTION_MEASUREMENTS:
2034 # self.combo_measurement_type = wx.ComboBox(self, ID_MEASUREMENT_TYPE, "", wx.DefaultPosition,wx.DefaultSize, ['Blood pressure','INR','Height','Weight','Whatever other measurement you want to put in here'], wx.CB_DROPDOWN)
2035 # self.combo_measurement_type.SetFont(wx.Font(12,wx.SWISS,wx.NORMAL, wx.BOLD,False,''))
2036 # self.combo_measurement_type.SetForegroundColour(wx.Color(255,0,0))
2037 # self.txt_measurement_value = cEditAreaField(self,ID_MEASUREMENT_VALUE,wx.DefaultPosition,wx.DefaultSize)
2038 # self.txt_txt_measurement_date = cEditAreaField(self,ID_MEASUREMENT_DATE,wx.DefaultPosition,wx.DefaultSize)
2039 # self.txt_txt_measurement_comment = cEditAreaField(self,ID_MEASUREMENT_COMMENT,wx.DefaultPosition,wx.DefaultSize)
2040 # self.txt_txt_measurement_progressnote = cEditAreaField(self,ID_PROGRESSNOTES,wx.DefaultPosition,wx.DefaultSize)
2041 # self.sizer_graphnextbtn = wx.BoxSizer(wxHORIZONTAL)
2042 # self.btn_nextvalue = wx.Button(self,ID_MEASUREMENT_NEXTVALUE," Next Value ") #clear fields except type
2043 # self.btn_graph = wx.Button(self,ID_MEASUREMENT_GRAPH," Graph ") #graph all values of this type
2044 # self.sizer_graphnextbtn.Add(self.btn_nextvalue,1,wx.EXPAND|wxALL,2) #put next and graph button
2045 # self.sizer_graphnextbtn.Add(self.btn_graph,1,wx.EXPAND|wxALL,2) #on same sizer
2046 # self.gszr.Add(self.combo_measurement_type,0,wx.EXPAND) #e.g Blood pressure
2047 # self.gszr.Add(self.txt_measurement_value,0,wx.EXPAND) #e.g 120.70
2048 # self.gszr.Add(self.txt_txt_measurement_date,0,wx.EXPAND) #e.g 10/12/2001
2049 # self.gszr.Add(self.txt_txt_measurement_comment,0,wx.EXPAND) #e.g sitting, right arm
2050 # self.gszr.Add(self.txt_txt_measurement_progressnote,0,wx.EXPAND) #e.g given home BP montitor, see 1 week
2051 # self.sizer_line8.Add(5,0,0)
2052 # self.sizer_line8.Add(self.sizer_graphnextbtn,2,wx.EXPAND)
2053 # self.sizer_line8.Add(5,0,2)
2054 # self.sizer_line8.Add(self.btn_OK,1,wx.EXPAND|wxALL,2)
2055 # self.sizer_line8.Add(self.btn_Clear,1,wx.EXPAND|wxALL,2)
2056 # self.gszr.AddSizer(self.sizer_line8,0,wx.EXPAND)
2057
2058
2059 # elif section == gmSECTION_REFERRALS:
2060 # self.btnpreview = wx.Button(self,-1,"Preview")
2061 # self.sizer_btnpreviewok = wx.BoxSizer(wxHORIZONTAL)
2062 #--------------------------------------------------------
2063 #editing area for referral letters, insurance letters etc
2064 #create textboxes, checkboxes etc
2065 #--------------------------------------------------------
2066 # self.txt_referralcategory = cEditAreaField(self,ID_REFERRAL_CATEGORY,wx.DefaultPosition,wx.DefaultSize)
2067 # self.txt_referralname = cEditAreaField(self,ID_REFERRAL_NAME,wx.DefaultPosition,wx.DefaultSize)
2068 # self.txt_referralorganisation = cEditAreaField(self,ID_REFERRAL_ORGANISATION,wx.DefaultPosition,wx.DefaultSize)
2069 # self.txt_referralstreet1 = cEditAreaField(self,ID_REFERRAL_STREET1,wx.DefaultPosition,wx.DefaultSize)
2070 # self.txt_referralstreet2 = cEditAreaField(self,ID_REFERRAL_STREET2,wx.DefaultPosition,wx.DefaultSize)
2071 # self.txt_referralstreet3 = cEditAreaField(self,ID_REFERRAL_STREET3,wx.DefaultPosition,wx.DefaultSize)
2072 # self.txt_referralsuburb = cEditAreaField(self,ID_REFERRAL_SUBURB,wx.DefaultPosition,wx.DefaultSize)
2073 # self.txt_referralpostcode = cEditAreaField(self,ID_REFERRAL_POSTCODE,wx.DefaultPosition,wx.DefaultSize)
2074 # self.txt_referralfor = cEditAreaField(self,ID_REFERRAL_FOR,wx.DefaultPosition,wx.DefaultSize)
2075 # self.txt_referralwphone= cEditAreaField(self,ID_REFERRAL_WPHONE,wx.DefaultPosition,wx.DefaultSize)
2076 # self.txt_referralwfax= cEditAreaField(self,ID_REFERRAL_WFAX,wx.DefaultPosition,wx.DefaultSize)
2077 # self.txt_referralwemail= cEditAreaField(self,ID_REFERRAL_WEMAIL,wx.DefaultPosition,wx.DefaultSize)
2078 #self.txt_referralrequests = cEditAreaField(self,ID_REFERRAL_REQUESTS,wx.DefaultPosition,wx.DefaultSize)
2079 #self.txt_referralnotes = cEditAreaField(self,ID_REFERRAL_FORMNOTES,wx.DefaultPosition,wx.DefaultSize)
2080 #self.txt_referralmedications = cEditAreaField(self,ID_REFERRAL_MEDICATIONS,wx.DefaultPosition,wx.DefaultSize)
2081 # self.txt_referralcopyto = cEditAreaField(self,ID_REFERRAL_COPYTO,wx.DefaultPosition,wx.DefaultSize)
2082 # self.txt_referralprogressnotes = cEditAreaField(self,ID_PROGRESSNOTES,wx.DefaultPosition,wx.DefaultSize)
2083 # self.lbl_referralwphone = cPrompt_edit_area(self,-1," W Phone ")
2084 # self.lbl_referralwfax = cPrompt_edit_area(self,-1," W Fax ")
2085 # self.lbl_referralwemail = cPrompt_edit_area(self,-1," W Email ")
2086 # self.lbl_referralpostcode = cPrompt_edit_area(self,-1," Postcode ")
2087 # self.chkbox_referral_usefirstname = wx.CheckBox(self, -1, " Use Firstname ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2088 # self.chkbox_referral_headoffice = wx.CheckBox(self, -1, " Head Office ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2089 # self.chkbox_referral_medications = wx.CheckBox(self, -1, " Medications ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2090 # self.chkbox_referral_socialhistory = wx.CheckBox(self, -1, " Social History ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2091 # self.chkbox_referral_familyhistory = wx.CheckBox(self, -1, " Family History ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2092 # self.chkbox_referral_pastproblems = wx.CheckBox(self, -1, " Past Problems ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2093 # self.chkbox_referral_activeproblems = wx.CheckBox(self, -1, " Active Problems ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2094 # self.chkbox_referral_habits = wx.CheckBox(self, -1, " Habits ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2095 #self.chkbox_referral_Includeall = wx.CheckBox(self, -1, " Include all of the above ", wx.DefaultPosition,wx.DefaultSize, wx.NO_BORDER)
2096 #--------------------------------------------------------------
2097 #add controls to sizers where multiple controls per editor line
2098 #--------------------------------------------------------------
2099 # self.sizer_line2.Add(self.txt_referralname,2,wx.EXPAND)
2100 # self.sizer_line2.Add(self.chkbox_referral_usefirstname,2,wx.EXPAND)
2101 # self.sizer_line3.Add(self.txt_referralorganisation,2,wx.EXPAND)
2102 # self.sizer_line3.Add(self.chkbox_referral_headoffice,2, wx.EXPAND)
2103 # self.sizer_line4.Add(self.txt_referralstreet1,2,wx.EXPAND)
2104 # self.sizer_line4.Add(self.lbl_referralwphone,1,wx.EXPAND)
2105 # self.sizer_line4.Add(self.txt_referralwphone,1,wx.EXPAND)
2106 # self.sizer_line5.Add(self.txt_referralstreet2,2,wx.EXPAND)
2107 # self.sizer_line5.Add(self.lbl_referralwfax,1,wx.EXPAND)
2108 # self.sizer_line5.Add(self.txt_referralwfax,1,wx.EXPAND)
2109 # self.sizer_line6.Add(self.txt_referralstreet3,2,wx.EXPAND)
2110 # self.sizer_line6.Add(self.lbl_referralwemail,1,wx.EXPAND)
2111 # self.sizer_line6.Add(self.txt_referralwemail,1,wx.EXPAND)
2112 # self.sizer_line7.Add(self.txt_referralsuburb,2,wx.EXPAND)
2113 # self.sizer_line7.Add(self.lbl_referralpostcode,1,wx.EXPAND)
2114 # self.sizer_line7.Add(self.txt_referralpostcode,1,wx.EXPAND)
2115 # self.sizer_line10.Add(self.chkbox_referral_medications,1,wx.EXPAND)
2116 # self.sizer_line10.Add(self.chkbox_referral_socialhistory,1,wx.EXPAND)
2117 # self.sizer_line10.Add(self.chkbox_referral_familyhistory,1,wx.EXPAND)
2118 # self.sizer_line11.Add(self.chkbox_referral_pastproblems ,1,wx.EXPAND)
2119 # self.sizer_line11.Add(self.chkbox_referral_activeproblems ,1,wx.EXPAND)
2120 # self.sizer_line11.Add(self.chkbox_referral_habits ,1,wx.EXPAND)
2121 # self.sizer_btnpreviewok.Add(self.btnpreview,0,wx.EXPAND)
2122 # self.szr_buttons.Add(self.btn_Clear,0, wx.EXPAND)
2123 #------------------------------------------------------------------
2124 #add either controls or sizers with controls to vertical grid sizer
2125 #------------------------------------------------------------------
2126 # self.gszr.Add(self.txt_referralcategory,0,wx.EXPAND) #e.g Othopaedic surgeon
2127 # self.gszr.Add(self.sizer_line2,0,wx.EXPAND) #e.g Dr B Breaker
2128 # self.gszr.Add(self.sizer_line3,0,wx.EXPAND) #e.g General Orthopaedic servies
2129 # self.gszr.Add(self.sizer_line4,0,wx.EXPAND) #e.g street1
2130 # self.gszr.Add(self.sizer_line5,0,wx.EXPAND) #e.g street2
2131 # self.gszr.Add(self.sizer_line6,0,wx.EXPAND) #e.g street3
2132 # self.gszr.Add(self.sizer_line7,0,wx.EXPAND) #e.g suburb and postcode
2133 # self.gszr.Add(self.txt_referralfor,0,wx.EXPAND) #e.g Referral for an opinion
2134 # self.gszr.Add(self.txt_referralcopyto,0,wx.EXPAND) #e.g Dr I'm All Heart, 120 Big Street Smallville
2135 # self.gszr.Add(self.txt_referralprogressnotes,0,wx.EXPAND) #emphasised to patient must return for results
2136 # self.gszr.AddSizer(self.sizer_line10,0,wx.EXPAND) #e.g check boxes to include medications etc
2137 # self.gszr.Add(self.sizer_line11,0,wx.EXPAND) #e.g check boxes to include active problems etc
2138 #self.spacer = wxWindow(self,-1,wx.DefaultPosition,wx.DefaultSize)
2139 #self.spacer.SetBackgroundColour(wx.Color(255,255,255))
2140 # self.sizer_line12.Add(5,0,6)
2141 #self.sizer_line12.Add(self.spacer,6,wx.EXPAND)
2142 # self.sizer_line12.Add(self.btnpreview,1,wx.EXPAND|wxALL,2)
2143 # self.sizer_line12.Add(self.btn_Clear,1,wx.EXPAND|wxALL,2)
2144 # self.gszr.Add(self.sizer_line12,0,wx.EXPAND) #btnpreview and btn clear
2145
2146
2147 # elif section == gmSECTION_RECALLS:
2148 #FIXME remove present options in this combo box #FIXME defaults need to be loaded from database
2149 # self.combo_tosee = wx.ComboBox(self, ID_RECALLS_TOSEE, "", wx.DefaultPosition,wx.DefaultSize, ['Doctor1','Doctor2','Nurse1','Dietition'], wx.CB_READONLY ) #wx.CB_DROPDOWN)
2150 # self.combo_tosee.SetFont(wx.Font(12,wx.SWISS,wx.NORMAL, wx.BOLD,False,''))
2151 # self.combo_tosee.SetForegroundColour(wx.Color(255,0,0))
2152 #FIXME defaults need to be loaded from database
2153 # self.combo_recall_method = wx.ComboBox(self, ID_RECALLS_CONTACTMETHOD, "", wx.DefaultPosition,wx.DefaultSize, ['Letter','Telephone','Email','Carrier pigeon'], wx.CB_READONLY )
2154 # self.combo_recall_method.SetFont(wx.Font(12,wx.SWISS,wx.NORMAL, wx.BOLD,False,''))
2155 # self.combo_recall_method.SetForegroundColour(wx.Color(255,0,0))
2156 #FIXME defaults need to be loaded from database
2157 # self.combo_apptlength = wx.ComboBox(self, ID_RECALLS_APPNTLENGTH, "", wx.DefaultPosition,wx.DefaultSize, ['brief','standard','long','prolonged'], wx.CB_READONLY )
2158 # self.combo_apptlength.SetFont(wx.Font(12,wx.SWISS,wx.NORMAL, wx.BOLD,False,''))
2159 # self.combo_apptlength.SetForegroundColour(wx.Color(255,0,0))
2160 # self.txt_recall_for = cEditAreaField(self,ID_RECALLS_TXT_FOR, wx.DefaultPosition,wx.DefaultSize)
2161 # self.txt_recall_due = cEditAreaField(self,ID_RECALLS_TXT_DATEDUE, wx.DefaultPosition,wx.DefaultSize)
2162 # self.txt_recall_addtext = cEditAreaField(self,ID_RECALLS_TXT_ADDTEXT,wx.DefaultPosition,wx.DefaultSize)
2163 # self.txt_recall_include = cEditAreaField(self,ID_RECALLS_TXT_INCLUDEFORMS,wx.DefaultPosition,wx.DefaultSize)
2164 # self.txt_recall_progressnotes = cEditAreaField(self,ID_PROGRESSNOTES,wx.DefaultPosition,wx.DefaultSize)
2165 # self.lbl_recall_consultlength = cPrompt_edit_area(self,-1," Appointment length ")
2166 #sizer_lkine1 has the method of recall and the appointment length
2167 # self.sizer_line1.Add(self.combo_recall_method,1,wx.EXPAND)
2168 # self.sizer_line1.Add(self.lbl_recall_consultlength,1,wx.EXPAND)
2169 # self.sizer_line1.Add(self.combo_apptlength,1,wx.EXPAND)
2170 #Now add the controls to the grid sizer
2171 # self.gszr.Add(self.combo_tosee,1,wx.EXPAND) #list of personel for patient to see
2172 # self.gszr.Add(self.txt_recall_for,1,wx.EXPAND) #the actual recall may be free text or word wheel
2173 # self.gszr.Add(self.txt_recall_due,1,wx.EXPAND) #date of future recall
2174 # self.gszr.Add(self.txt_recall_addtext,1,wx.EXPAND) #added explanation e.g 'come fasting'
2175 # self.gszr.Add(self.txt_recall_include,1,wx.EXPAND) #any forms to be sent out first eg FBC
2176 # self.gszr.AddSizer(self.sizer_line1,1,wx.EXPAND) #the contact method, appointment length
2177 # self.gszr.Add(self.txt_recall_progressnotes,1,wx.EXPAND) #add any progress notes for consultation
2178 # self.sizer_line8.Add(5,0,6)
2179 # self.sizer_line8.Add(self.btn_OK,1,wx.EXPAND|wxALL,2)
2180 # self.sizer_line8.Add(self.btn_Clear,1,wx.EXPAND|wxALL,2)
2181 # self.gszr.Add(self.sizer_line8,1,wx.EXPAND)
2182 # else:
2183 # pass
2184
2185 #====================================================================
2186 # main
2187 #--------------------------------------------------------------------
2188 if __name__ == "__main__":
2189
2190 #================================================================
2198 # line 1
2199 self.fld_substance = cEditAreaField(parent)
2200 self._add_field(
2201 line = 1,
2202 pos = 1,
2203 widget = self.fld_substance,
2204 weight = 1
2205 )
2206 # line 2
2207 self._add_field(
2208 line = 2,
2209 pos = 1,
2210 widget = self._make_standard_buttons(parent),
2211 weight = 1
2212 )
2213 #================================================================
2214 app = wxPyWidgetTester(size = (400, 200))
2215 app.SetWidget(cTestEditArea)
2216 app.MainLoop()
2217 # app = wxPyWidgetTester(size = (400, 200))
2218 # app.SetWidget(gmFamilyHxEditArea, -1)
2219 # app.MainLoop()
2220 # app = wxPyWidgetTester(size = (400, 200))
2221 # app.SetWidget(gmPastHistoryEditArea, -1)
2222 # app.MainLoop()
2223 #====================================================================
2224
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Nov 29 04:05:26 2010 | http://epydoc.sourceforge.net |