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