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

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

      1  #======================================================================
      2  # GNUmed patient overview plugin
      3  # ------------------------------
      4  #
      5  # @copyright: author
      6  #======================================================================
      7  __author__ = "Carlos Moro, Karsten Hilbert"
      8  __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
      9
     10  import logging
     11
     12
     13  if __name__ == '__main__':
     14          # stdlib
     15          import sys
     16          sys.path.insert(0, '../../../')
     17
     18          from Gnumed.pycommon import gmI18N
     19          gmI18N.activate_locale()
     20          gmI18N.install_domain()
     21
     22  # GNUmed
     23  from Gnumed.wxpython import gmPlugin, gmPatOverviewWidgets
     24  from Gnumed.wxpython import gmAccessPermissionWidgets
     25
     26
     27  _log = logging.getLogger('gm.ui')
     28  #======================================================================
     29 -class gmPatientOverviewPlugin(gmPlugin.cNotebookPlugin):
     30
     31          tab_name = _('Overview')
     32          required_minimum_role = 'doctor'
     33
     34          @gmAccessPermissionWidgets.verify_minimum_required_role (
     35                  required_minimum_role,
     36                  activity = _('loading plugin <%s>') % tab_name,
     37                  return_value_on_failure = False,
     38                  fail_silently = False
     39          )
     40 -        def register(self):
     41                  gmPlugin.cNotebookPlugin.register(self)
     42          #-------------------------------------------------
     43 -        def name (self):
     44                  return gmPatientOverviewPlugin.tab_name
     45
     46 -        def GetWidget (self, parent):
     47                  self._widget = gmPatOverviewWidgets.cPatientOverviewPnl(parent, -1)
     48                  return self._widget
     49
     50 -        def MenuInfo (self):
     51                  return ('emr', _('&Overview'))
     52
     53 -        def can_receive_focus(self):
     54                  # need patient
     55                  if not self._verify_patient_avail():
     56                          return None
     57                  return True
     58  #======================================================================
     59  # main
     60  #----------------------------------------------------------------------
     61  if __name__ == "__main__":
     62
     63          # 3rd party
     64          import wx
     65
     66          # GNUmed
     67          from Gnumed.business import gmPersonSearch
     68          from Gnumed.wxpython import gmSOAPWidgets
     69
     70          _log.info("starting Notebooked progress notes input plugin...")
     71
     72          try:
     73                  # obtain patient
     74                  patient = gmPersonSearch.ask_for_patient()
     75                  if patient is None:
     76                          print "None patient. Exiting gracefully..."
     77                          sys.exit(0)
     78                  gmPatSearchWidgets.set_active_patient(patient=patient)
     79
     80                  # display standalone multisash progress notes input
     81                  application = wx.wx.PyWidgetTester(size = (800,600))
     82                  multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)
     83
     84                  application.frame.Show(True)
     85                  application.MainLoop()
     86
     87                  # clean up
     88                  if patient is not None:
     89                          try:
     90                                  patient.cleanup()
     91                          except:
     92                                  print "error cleaning up patient"
     93          except StandardError:
     94                  _log.exception("unhandled exception caught !")
     95                  # but re-raise them
     96                  raise
     97
     98          _log.info("closing Notebooked progress notes input plugin...")
     99  #======================================================================
    100