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

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

     1  # -*- coding: utf-8 -*-
     2  #======================================================================
     3  __author__ = "Karsten Hilbert"
     4  __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
     5
     6
     7  #raise Exception
     8
     9
    10  # stdlib
    11  import logging
    12
    13
    14  # GNUmed
    15  if __name__ == '__main__':
    16          # stdlib
    17          import sys
    18          sys.path.insert(0, '../../../')
    19          from Gnumed.pycommon import gmI18N
    20          gmI18N.activate_locale()
    21          gmI18N.install_domain()
    22  from Gnumed.wxpython import gmPlugin
    23  from Gnumed.wxpython import gmNarrativeWidgets
    24  from Gnumed.wxpython import gmAccessPermissionWidgets
    25
    26
    27  _log = logging.getLogger('gm.ui')
    28  #======================================================================
    29 -class gmSimpleSoapPlugin(gmPlugin.cNotebookPlugin):
    30
    31          tab_name = _('SimpleNotes')
    32          required_minimum_role = 'full clinical access'
    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
    44 -        def name (self):
    45                  return gmSimpleSoapPlugin.tab_name
    46
    47 -        def GetWidget (self, parent):
    48                  self._widget = gmNarrativeWidgets.cSimpleSoapPluginPnl(parent, -1)
    49                  return self._widget
    50
    51 -        def MenuInfo (self):
    52                  return ('emr', _('&SimpleNotes'))
    53
    54 -        def can_receive_focus(self):
    55                  # need patient
    56                  if not self._verify_patient_avail():
    57                          return None
    58                  return True
    59  #======================================================================
    60  # main
    61  #----------------------------------------------------------------------
    62  if __name__ == "__main__":
    63
    64          # 3rd party
    65          import wx
    66
    67          # GNUmed
    68          from Gnumed.business import gmPersonSearch
    69
    70          try:
    71                  # obtain patient
    72                  patient = gmPersonSearch.ask_for_patient()
    73                  if patient is None:
    74                          print("None patient. Exiting gracefully...")
    75                          sys.exit(0)
    76                  gmPatSearchWidgets.set_active_patient(patient=patient)
    77
    78                  # display standalone multisash progress notes input
    79                  application = wx.wx.PyWidgetTester(size = (800,600))
    80                  multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)
    81
    82                  application.frame.Show(True)
    83                  application.MainLoop()
    84
    85                  # clean up
    86                  if patient is not None:
    87                          try:
    88                                  patient.cleanup()
    89                          except:
    90                                  print("error cleaning up patient")
    91          except Exception:
    92                  _log.exception("unhandled exception caught !")
    93                  # but re-raise them
    94                  raise
    95  #======================================================================
    96