Gnumed.wxpython.gui.gmEMRTimelinePlugin

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

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

     1  # -*- coding: utf-8 -*-
     2  __doc__ = """ This is the EMR Timeline plugin."""
     3
     4  #================================================================
     5  __author__ = "karsten.hilbert@gmx.net"
     6  __license__ = "GPL v2 or later"
     7
     8  import logging
     9
    10
    11  import wx
    12
    13
    14  from Gnumed.wxpython import gmPlugin, gmEMRTimelineWidgets
    15  from Gnumed.wxpython import gmAccessPermissionWidgets
    16
    17  #================================================================
    18 -class gmEMRTimelinePlugin(gmPlugin.cNotebookPlugin):
    19
    20          tab_name = _("EMR Timeline")
    21          required_minimum_role = 'full clinical access'
    22
    23          @gmAccessPermissionWidgets.verify_minimum_required_role (
    24                  required_minimum_role,
    25                  activity = _('loading plugin <%s>') % tab_name,
    26                  return_value_on_failure = False,
    27                  fail_silently = False
    28          )
    29 -        def register(self):
    30                  gmPlugin.cNotebookPlugin.register(self)
    31          #-------------------------------------------------
    32 -        def name (self):
    33                  return gmEMRTimelinePlugin.tab_name
    34          #--------------------------------------------------------
    35 -        def GetWidget (self, parent):
    36                  self._widget = gmEMRTimelineWidgets.cEMRTimelinePluginPnl(parent, -1)
    37                  return self._widget
    38          #--------------------------------------------------------
    39 -        def MenuInfo (self):
    40                  return ('emr', _('EMR &Timeline'))
    41          #--------------------------------------------------------
    42 -        def can_receive_focus(self):
    43                  if not self._verify_patient_avail():
    44                          return None
    45                  return 1
    46          #--------------------------------------------------------
    47 -        def _on_raise_by_signal(self, **kwds):
    48                  if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
    49                          return False
    50                  try:
    51                          pass
    52                  except KeyError:
    53                          pass
    54                  return True
    55  #================================================================
    56  # MAIN
    57  #----------------------------------------------------------------
    58  if __name__ == '__main__':
    59
    60          # stdlib
    61          import sys
    62          sys.path.insert(0, '../../../')
    63
    64          from Gnumed.pycommon import gmI18N
    65          gmI18N.activate_locale()
    66          gmI18N.install_domain()
    67
    68          # GNUmed
    69          from Gnumed.business import gmPersonSearch
    70          from Gnumed.wxpython import gmPatSearchWidgets
    71
    72          _log.info("starting template plugin...")
    73
    74          # obtain patient
    75          patient = gmPersonSearch.ask_for_patient()
    76          if patient is None:
    77                  print("None patient. Exiting gracefully...")
    78                  sys.exit(0)
    79          gmPatSearchWidgets.set_active_patient(patient=patient)
    80
    81          # display the plugin standalone
    82          application = wx.wx.PyWidgetTester(size = (800,600))
    83          widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
    84
    85          application.frame.Show(True)
    86          application.MainLoop()
    87
    88          # clean up
    89          if patient is not None:
    90                  try:
    91                          patient.cleanup()
    92                  except Exception:
    93                          print("error cleaning up patient")
    94
    95          _log.info("closing example plugin...")
    96