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

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

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