Gnumed.wxpython.gui.gmSoapPlugin

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          # 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 Exception:
    101                          print("error cleaning up patient")
    102
    103          _log.info("closing Notebooked progress notes input plugin...")
    104  #======================================================================
    105