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

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

      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.18 $"
     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, gmSOAPWidgets
     29  from Gnumed.wxpython import gmAccessPermissionWidgets
     30
     31
     32  _log = logging.getLogger('gm.ui')
     33  _log.info(__version__)
     34
     35  #======================================================================
     36 -class gmNotebookedProgressNoteInputPlugin(gmPlugin.cNotebookPlugin):
     37          """Plugin to encapsulate notebook based progress note input window."""
     38
     39          tab_name = _('Progress 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 -        def name (self):
     52                  return gmNotebookedProgressNoteInputPlugin.tab_name
     53
     54 -        def GetWidget (self, parent):
     55                  self._widget = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(parent, -1)
     56                  return self._widget
     57
     58 -        def MenuInfo (self):
     59                  return None
     60                  #return ('emr', _('&Progress notes editor'))
     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
     78          _log.info("starting Notebooked progress notes input plugin...")
     79
     80          try:
     81                  # obtain patient
     82                  patient = gmPersonSearch.ask_for_patient()
     83                  if patient is None:
     84                          print "None patient. Exiting gracefully..."
     85                          sys.exit(0)
     86                  gmPatSearchWidgets.set_active_patient(patient=patient)
     87
     88                  # display standalone multisash progress notes input
     89                  application = wx.wx.PyWidgetTester(size=(800,600))
     90                  multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)
     91
     92                  application.frame.Show(True)
     93                  application.MainLoop()
     94
     95                  # clean up
     96                  if patient is not None:
     97                          try:
     98                                  patient.cleanup()
     99                          except:
    100                                  print "error cleaning up patient"
    101          except Exception:
    102                  _log.exception("unhandled exception caught !")
    103                  # but re-raise them
    104                  raise
    105
    106          _log.info("closing Notebooked progress notes input plugin...")
    107  #======================================================================
    108