Gnumed.wxpython.gui.gmPatientOverviewPlugin

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

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

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