Gnumed.wxpython.gui.gmCardiacDevicePlugin

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

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

     1  # -*- coding: utf-8 -*-
     2  """This is a cardiac device interrogation management plugin """
     3  __author__ = "Karsten Hilbert <Karsten.Hilbert@gmx.net>"
     4  #================================================================
     5  import os.path, sys, logging
     6
     7
     8  import wx
     9
    10
    11  from Gnumed.wxpython import gmPlugin, gmDeviceWidgets
    12
    13  if __name__ == '__main__':
    14          # stdlib
    15          import sys
    16          sys.path.insert(0, '../../../')
    17
    18          from Gnumed.pycommon import gmI18N
    19          gmI18N.activate_locale()
    20          gmI18N.install_domain()
    21
    22
    23
    24  _log = logging.getLogger('gm.ui')
    25  #================================================================
    26 -class gmCardiacDevicePlugin(gmPlugin.cNotebookPlugin):
    27          """Plugin to encapsulate document tree."""
    28
    29          tab_name = _("Cardiac Devices")
    30
    31 -        def name (self):
    32                  return gmCardiacDevicePlugin.tab_name
    33          #--------------------------------------------------------
    34 -        def GetWidget (self, parent):
    35                  self._widget = gmDeviceWidgets.cCardiacDevicePluginPnl(parent, -1)
    36                  return self._widget
    37          #--------------------------------------------------------
    38 -        def MenuInfo (self):
    39                  return ('emr', _('Show &cardiac devices'))
    40          #--------------------------------------------------------
    41 -        def can_receive_focus(self):
    42                  # need patient
    43                  if not self._verify_patient_avail():
    44                          return None
    45                  return 1
    46          #--------------------------------------------------------
    47 -        def _on_raise_by_signal(self, **kwds):
    48                  if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
    49                          return False
    50                  try:
    51                          if kwds['sort_mode'] == 'review':
    52                                  self._widget._on_sort_by_review_selected(None)
    53                  except KeyError:
    54                          pass
    55                  return True
    56  #================================================================
    57  # MAIN
    58  #----------------------------------------------------------------
    59  if __name__ == '__main__':
    60
    61          # GNUmed
    62          from Gnumed.business import gmPersonSearch
    63          from Gnumed.wxpython import gmMeasurementWidgets,gmPatSearchWidgets
    64
    65          _log.info("starting Notebooked cardiac device input plugin...")
    66
    67          try:
    68                  # obtain patient
    69                  patient = gmPersonSearch.ask_for_patient()
    70                  if patient is None:
    71                          print "None patient. Exiting gracefully..."
    72                          sys.exit(0)
    73                  gmPatSearchWidgets.set_active_patient(patient=patient)
    74
    75                  # display standalone multisash progress notes input
    76                  application = wx.wx.PyWidgetTester(size = (800,600))
    77                  multisash_notes = gmMeasurementWidgets.cCardiacDeviceMeasurementsPnl(application.frame, -1)
    78
    79                  application.frame.Show(True)
    80                  application.MainLoop()
    81
    82                  # clean up
    83                  if patient is not None:
    84                          try:
    85                                  patient.cleanup()
    86                          except:
    87                                  print "error cleaning up patient"
    88          except Exception:
    89                  _log.exception("unhandled exception caught !")
    90                  # but re-raise them
    91                  raise
    92
    93          _log.info("closing Notebooked cardiac device input plugin...")
    94  #================================================================
    95