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

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

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