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

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

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