Gnumed.wxpython.gui.gmMultiSashedProgressNoteInputPlugin

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

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

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