Gnumed.wxpython.gui.gmSoapPlugin

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  from Gnumed.wxpython import gmAccessPermissionWidgets
     29
     30
     31  _log = logging.getLogger('gm.ui')
     32  _log.info(__version__)
     33
     34  #======================================================================
     35 -class gmSoapPlugin(gmPlugin.cNotebookPlugin):
     36          """Plugin to encapsulate notebook based progress note input window."""
     37
     38          tab_name = _('Notes')
     39          required_minimum_role = 'full clinical access'
     40
     41          @gmAccessPermissionWidgets.verify_minimum_required_role (
     42                  required_minimum_role,
     43                  activity = _('loading plugin <%s>') % tab_name,
     44                  return_value_on_failure = False,
     45                  fail_silently = False
     46          )
     47 -        def register(self):
     48                  gmPlugin.cNotebookPlugin.register(self)
     49          #-------------------------------------------------
     50
     51 -        def name (self):
     52                  return gmSoapPlugin.tab_name
     53
     54 -        def GetWidget (self, parent):
     55                  self._widget = gmNarrativeWidgets.cSoapPluginPnl(parent, -1)
     56                  return self._widget
     57
     58 -        def MenuInfo (self):
     59                  return ('emr', _('&Notes'))
     60                  #return None
     61
     62 -        def can_receive_focus(self):
     63                  # need patient
     64                  if not self._verify_patient_avail():
     65                          return None
     66                  return True
     67  #======================================================================
     68  # main
     69  #----------------------------------------------------------------------
     70  if __name__ == "__main__":
     71
     72          # 3rd party
     73          import wx
     74
     75          # GNUmed
     76          from Gnumed.business import gmPersonSearch
     77          from Gnumed.wxpython import gmSOAPWidgets
     78
     79          _log.info("starting Notebooked progress notes input plugin...")
     80
     81          try:
     82                  # obtain patient
     83                  patient = gmPersonSearch.ask_for_patient()
     84                  if patient is None:
     85                          print "None patient. Exiting gracefully..."
     86                          sys.exit(0)
     87                  gmPatSearchWidgets.set_active_patient(patient=patient)
     88
     89                  # display standalone multisash progress notes input
     90                  application = wx.wx.PyWidgetTester(size = (800,600))
     91                  multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)
     92
     93                  application.frame.Show(True)
     94                  application.MainLoop()
     95
     96                  # clean up
     97                  if patient is not None:
     98                          try:
     99                                  patient.cleanup()
    100                          except:
    101                                  print "error cleaning up patient"
    102          except StandardError:
    103                  _log.exception("unhandled exception caught !")
    104                  # but re-raise them
    105                  raise
    106
    107          _log.info("closing Notebooked progress notes input plugin...")
    108  #======================================================================
    109