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

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

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