Gnumed.wxpython.gui.gmExportAreaPlugin

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

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

     1  # -*- coding: utf-8 -*-
     2  """ This is the Export Area plugin."""
     3
     4  __author__ = "karsten.hilbert@gmx.net"
     5  __license__ = "GPL v2 or later"
     6
     7  #================================================================
     8  import logging
     9
    10
    11  import wx
    12
    13
    14  from Gnumed.wxpython import gmPlugin, gmExportAreaWidgets
    15  from Gnumed.wxpython import gmAccessPermissionWidgets
    16
    17
    18  _log = logging.getLogger('gm.ui')
    19  #================================================================
    20 -class gmExportAreaPlugin(gmPlugin.cNotebookPlugin):
    21          tab_name = _("Export Area")
    22          required_minimum_role = 'limited clinical access'
    23
    24          @gmAccessPermissionWidgets.verify_minimum_required_role (
    25                  required_minimum_role,
    26                  activity = _('loading plugin <%s>') % tab_name,
    27                  return_value_on_failure = False,
    28                  fail_silently = False
    29          )
    30 -        def register(self):
    31                  gmPlugin.cNotebookPlugin.register(self)
    32          #-------------------------------------------------
    33 -        def name (self):
    34                  return gmExportAreaPlugin.tab_name
    35          #--------------------------------------------------------
    36 -        def GetWidget (self, parent):
    37                  self._widget = gmExportAreaWidgets.cExportAreaPluginPnl(parent, -1)
    38                  return self._widget
    39          #--------------------------------------------------------
    40 -        def MenuInfo (self):
    41                  return ('paperwork', _('E&xport area'))
    42          #--------------------------------------------------------
    43 -        def can_receive_focus(self):
    44                  if not self._verify_patient_avail():
    45                          return None
    46                  return 1
    47          #--------------------------------------------------------
    48 -        def _on_raise_by_signal(self, **kwds):
    49                  if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
    50                          return False
    51                  try:
    52                          pass
    53                  except KeyError:
    54                          pass
    55                  return True
    56  #================================================================
    57  # MAIN
    58  #----------------------------------------------------------------
    59  if __name__ == '__main__':
    60
    61          # stdlib
    62          import sys
    63          sys.path.insert(0, '../../../')
    64
    65          from Gnumed.pycommon import gmI18N
    66          gmI18N.activate_locale()
    67          gmI18N.install_domain()
    68
    69          # GNUmed
    70          from Gnumed.business import gmPersonSearch
    71          from Gnumed.wxpython import gmPatSearchWidgets
    72
    73          _log.info("starting template 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 the plugin standalone
    83          application = wx.wx.PyWidgetTester(size = (800,600))
    84          widgets = gmExamplePluginWidgets.cExamplePluginPnl(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 example plugin...")
    97