Package Gnumed :: Package wxpython :: Module gmEMRTimelineWidgets
[frames] | no frames]

Source Code for Module Gnumed.wxpython.gmEMRTimelineWidgets

 1  """GNUmed patient EMR timeline browser. 
 2   
 3  Uses the excellent TheTimlineProject. 
 4  """ 
 5  #================================================================ 
 6  __author__ = "cfmoro1976@yahoo.es, sjtan@swiftdsl.com.au, Karsten.Hilbert@gmx.net" 
 7  __license__ = "GPL" 
 8   
 9  # std lib 
10  import sys 
11  import logging 
12  #os.path, codecs 
13   
14   
15  # 3rd party 
16  import wx 
17   
18   
19  # GNUmed libs 
20  if __name__ == '__main__': 
21          sys.path.insert(0, '../../') 
22  from timelinelib.wxgui.component import TimelineComponent 
23   
24  from Gnumed.exporters import timeline 
25  from Gnumed.business import gmPerson 
26  from Gnumed.wxpython import gmRegetMixin 
27   
28   
29  _log = logging.getLogger('gm.ui') 
30   
31  #============================================================ 
32 -class cEMRTimelinePnl(TimelineComponent):
33
34 - def __init__(self, *args, **kwargs):
35 # TimelineComponent.__init__(self, *args, **kwargs) 36 # def __init__(self, parent): 37 TimelineComponent.__init__(self, args[0])
38 39 #============================================================ 40 from Gnumed.wxGladeWidgets import wxgEMRTimelinePluginPnl 41
42 -class cEMRTimelinePluginPnl(wxgEMRTimelinePluginPnl.wxgEMRTimelinePluginPnl, gmRegetMixin.cRegetOnPaintMixin):
43 """Panel holding a number of widgets. Used as notebook page."""
44 - def __init__(self, *args, **kwargs):
47 # self.__init_ui() 48 # self.__register_interests() 49 #-------------------------------------------------------- 50 # event handling 51 #-------------------------------------------------------- 52 # def __register_interests(self): 53 # gmDispatcher.connect(signal = u'pre_patient_selection', receiver = self._on_pre_patient_selection) 54 # gmDispatcher.connect(signal = u'post_patient_selection', receiver = self._schedule_data_reget) 55 #-------------------------------------------------------- 56 # def _on_pre_patient_selection(self): 57 # wx.CallAfter(self.__on_pre_patient_selection) 58 #-------------------------------------------------------- 59 # def __on_pre_patient_selection(self): 60 # pass 61 #--------------------------------------------------------
62 - def _on_refresh_button_pressed(self, event):
63 self._populate_with_data()
64 #--------------------------------------------------------
65 - def repopulate_ui(self):
66 self._populate_with_data()
67 #-------------------------------------------------------- 68 # internal API 69 #-------------------------------------------------------- 70 # def __init_ui(self): 71 # pass 72 #-------------------------------------------------------- 73 # reget mixin API 74 #-------------------------------------------------------- 75 # remember to call 76 # self._schedule_data_reget() 77 # whenever you learn of data changes from database listener 78 # threads, dispatcher signals etc.
79 - def _populate_with_data(self):
80 pat = gmPerson.gmCurrentPatient() 81 if not pat.connected: 82 return True 83 self._PNL_timeline.open_timeline(timeline.create_timeline_file(patient = pat)) 84 return True
85 #============================================================ 86