Gnumed.wxpython.gui.gmSimpleSoapPlugin

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          # obtain patient
    71          patient = gmPersonSearch.ask_for_patient()
    72          if patient is None:
    73                  print("None patient. Exiting gracefully...")
    74                  sys.exit(0)
    75          gmPatSearchWidgets.set_active_patient(patient=patient)
    76
    77          # display standalone multisash progress notes input
    78          application = wx.wx.PyWidgetTester(size = (800,600))
    79          multisash_notes = gmSOAPWidgets.cNotebookedProgressNoteInputPanel(application.frame, -1)
    80
    81          application.frame.Show(True)
    82          application.MainLoop()
    83
    84          # clean up
    85          if patient is not None:
    86                  try:
    87                          patient.cleanup()
    88                  except Exception:
    89                          print("error cleaning up patient")
    90