Package Gnumed :: Package wxpython :: Package gui :: Module gmEMRBrowserPlugin |
[frames] | no frames]

# Source Code for Module Gnumed.wxpython.gui.gmEMRBrowserPlugin

     1  #======================================================================
     2  # GNUmed patient EMR browser plugin
     3  # ----------------------------------------------
     4  #
     5  # this plugin holds patient EMR tree
     6  #
     7  # @copyright: author
     8  #======================================================================
     9  __version__ = "$Revision: 1.19 $"
    10  __author__ = "Carlos Moro"
    11  __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
    12
    13  import logging
    14
    15
    16  from Gnumed.wxpython import gmPlugin, gmEMRBrowser
    17  from Gnumed.pycommon import gmI18N
    18
    19  _log = logging.getLogger('gm.ui')
    20  _log.info(__version__)
    21
    22  #======================================================================
    23 -class gmEMRBrowserPlugin(gmPlugin.cNotebookPlugin):
    24          """Plugin to encapsulate patient EMR browser window."""
    25
    26          tab_name = _('EMR tree')
    27
    28 -        def name(self):
    29                  return gmEMRBrowserPlugin.tab_name
    30          #-------------------------------------------------
    31 -        def GetWidget(self, parent):
    32                  self._widget = gmEMRBrowser.cSplittedEMRTreeBrowserPnl(parent, -1)
    33                  return self._widget
    34          #-------------------------------------------------
    35 -        def MenuInfo(self):
    36                  return ('emr', _('EMR &Tree (topical)'))
    37          #-------------------------------------------------
    38 -        def can_receive_focus(self):
    39                  # need patient
    40                  if not self._verify_patient_avail():
    41                          return None
    42                  return 1
    43  #======================================================================
    44  # main
    45  #----------------------------------------------------------------------
    46  if __name__ == "__main__":
    47
    48      import sys
    49
    50      import wx
    51
    52      from Gnumed.exporters import gmPatientExporter
    53      from Gnumed.business import gmPersonSearch
    54
    55      _log.info("starting emr browser plugin...")
    56
    57      try:
    58          # obtain patient
    59          patient = gmPersonSearch.ask_for_patient()
    60          if patient is None:
    61              print "None patient. Exiting gracefully..."
    62              sys.exit(0)
    63          gmPatSearchWidgets.set_active_patient(patient=patient)
    64
    65          # display standalone browser
    66          application = wx.wxPyWidgetTester(size=(800,600))
    67          emr_browser = gmEMRBrowser.cEMRBrowserPanel(application.frame, -1)
    68          emr_browser.refresh_tree()
    69
    70          application.frame.Show(True)
    71          application.MainLoop()
    72
    73          # clean up
    74          if patient is not None:
    75              try:
    76                  patient.cleanup()
    77              except:
    78                  print "error cleaning up patient"
    79      except StandardError:
    80          _log.exception("unhandled exception caught !")
    81          # but re-raise them
    82          raise
    83
    84      _log.info("closing emr browser plugin...")
    85
    86  #======================================================================
    87