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

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

     1  #======================================================================
     2  # GNUmed notebook based progress note input plugin
     3  # ------------------------------------------------
     4  #
     5  # this plugin displays the list of patient problems
     6  # together whith a notebook container for progress notes
     7  #
     8  # @copyright: author
     9  #======================================================================
    10  __version__ = "$Revision: 1.7 $"
    11  __author__ = "Carlos Moro, Karsten Hilbert"
    12  __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
    13
    14  import logging
    15
    16
    17  if __name__ == '__main__':
    18          # stdlib
    19          import sys
    20          sys.path.insert(0, '../../../')
    21
    22          from Gnumed.pycommon import gmI18N
    23          gmI18N.activate_locale()
    24          gmI18N.install_domain()
    25
    26  # GNUmed
    27  from Gnumed.wxpython import gmPlugin, gmNarrativeWidgets
    28
    29
    30  _log = logging.getLogger('gm.ui')
    31  _log.info(__version__)
    32
    33  #======================================================================
    34 -class gmSoapPlugin(gmPlugin.cNotebookPlugin):
    35          """Plugin to encapsulate notebook based progress note input window."""
    36
    37          tab_name = _('Notes')
    38
    39 -        def name (self):
    40                  return gmSoapPlugin.tab_name
    41
    42 -        def GetWidget (self, parent):
    43                  self._widget = gmNarrativeWidgets.cSoapPluginPnl(parent, -1)
    44                  return self._widget
    45
    46 -        def MenuInfo (self):
    47                  return ('emr', _('&Notes'))
    48                  #return None
    49
    50 -        def can_receive_focus(self):
    51                  # need patient
    52                  if not self._verify_patient_avail():
    53                          return None
    54                  return True
    55  #======================================================================
    56  # main
    57  #----------------------------------------------------------------------
    58  if __name__ == "__main__":
    59
    60          # 3rd party
    61          import wx
    62
    63          # GNUmed
    64          from Gnumed.business import gmPersonSearch
    65          from Gnumed.wxpython import gmSOAPWidgets
    66
    67          _log.info("starting Notebooked progress notes input plugin...")
    68
    69          try:
    70                  # obtain patient
    71                  patient = gmPersonSearch.ask_for_patient()
    72                  if patient is None:
    73                          print "None patient. Exiting gracefully..."
    74                          sys.exit(0)
    75                  gmPatSearchWidgets.set_active_patient(patient=patient)
    76
    77                  # display standalone multisash progress notes input
    78                  application = wx.wx.PyWidgetTester(size = (800,600))
    79                  multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)
    80
    81                  application.frame.Show(True)
    82                  application.MainLoop()
    83
    84                  # clean up
    85                  if patient is not None:
    86                          try:
    87                                  patient.cleanup()
    88                          except:
    89                                  print "error cleaning up patient"
    90          except StandardError:
    91                  _log.exception("unhandled exception caught !")
    92                  # but re-raise them
    93                  raise
    94
    95          _log.info("closing Notebooked progress notes input plugin...")
    96  #======================================================================
    97