Gnumed.wxpython.gui.gmCardiacDevicePlugin

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

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

     1  """This is a cardiac device interrogation management plugin """
     2  __version__ = "$Revision: 1.9 $"
     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  _log.info(__version__)
    26  #================================================================
    27 -class gmCardiacDevicePlugin(gmPlugin.cNotebookPlugin):
    28          """Plugin to encapsulate document tree."""
    29
    30          tab_name = _("Cardiac Devices")
    31
    32 -        def name (self):
    33                  return gmCardiacDevicePlugin.tab_name
    34          #--------------------------------------------------------
    35 -        def GetWidget (self, parent):
    36                  self._widget = gmDeviceWidgets.cCardiacDevicePluginPnl(parent, -1)
    37                  return self._widget
    38          #--------------------------------------------------------
    39 -        def MenuInfo (self):
    40                  return ('emr', _('Show &cardiac devices'))
    41          #--------------------------------------------------------
    42 -        def can_receive_focus(self):
    43                  # need patient
    44                  if not self._verify_patient_avail():
    45                          return None
    46                  return 1
    47          #--------------------------------------------------------
    48 -        def _on_raise_by_signal(self, **kwds):
    49                  if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
    50                          return False
    51                  try:
    52                          if kwds['sort_mode'] == 'review':
    53                                  self._widget._on_sort_by_review_selected(None)
    54                  except KeyError:
    55                          pass
    56                  return True
    57  #================================================================
    58  # MAIN
    59  #----------------------------------------------------------------
    60  if __name__ == '__main__':
    61
    62          # GNUmed
    63          from Gnumed.business import gmPersonSearch
    64          from Gnumed.wxpython import gmMeasurementWidgets,gmPatSearchWidgets
    65
    66          _log.info("starting Notebooked cardiac device input plugin...")
    67
    68          try:
    69                  # obtain patient
    70                  patient = gmPersonSearch.ask_for_patient()
    71                  if patient is None:
    72                          print "None patient. Exiting gracefully..."
    73                          sys.exit(0)
    74                  gmPatSearchWidgets.set_active_patient(patient=patient)
    75
    76                  # display standalone multisash progress notes input
    77                  application = wx.wx.PyWidgetTester(size = (800,600))
    78                  multisash_notes = gmMeasurementWidgets.cCardiacDeviceMeasurementsPnl(application.frame, -1)
    79
    80                  application.frame.Show(True)
    81                  application.MainLoop()
    82
    83                  # clean up
    84                  if patient is not None:
    85                          try:
    86                                  patient.cleanup()
    87                          except:
    88                                  print "error cleaning up patient"
    89          except StandardError:
    90                  _log.exception("unhandled exception caught !")
    91                  # but re-raise them
    92                  raise
    93
    94          _log.info("closing Notebooked cardiac device input plugin...")
    95  #================================================================
    96