Gnumed.wxpython.gui.gmPrintManagerPlugin

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

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

     1  # -*- coding: utf-8 -*-
     2  """A print manager plugin"""
     3
     4  __author__ = "karsten.hilbert@gmx.net"
     5  __license__ = "GPL v2 or later"
     6
     7  #================================================================
     8  import os.path, sys, logging
     9  import wx
    10
    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
    19  from Gnumed.wxpython import gmPlugin
    20  from Gnumed.wxpython import gmExportAreaWidgets
    21
    22
    23  _log = logging.getLogger('gm.ui')
    24  #================================================================
    25 -class gmPrintManagerPlugin(gmPlugin.cNotebookPlugin):
    26          tab_name = _("Print Manager")
    27
    28 -        def name (self):
    29                  return gmPrintManagerPlugin.tab_name
    30          #--------------------------------------------------------
    31 -        def GetWidget (self, parent):
    32                  self._widget = gmExportAreaWidgets.cPrintMgrPluginPnl(parent, -1)
    33                  return self._widget
    34          #--------------------------------------------------------
    35 -        def MenuInfo (self):
    36                  return ('paperwork', _('&Print Manager'))
    37          #--------------------------------------------------------
    38 -        def can_receive_focus(self):
    39                  #if not self._verify_patient_avail():
    40                  #       return None
    41                  return 1
    42          #--------------------------------------------------------
    43 -        def _on_raise_by_signal(self, **kwds):
    44                  if not gmPlugin.cNotebookPlugin._on_raise_by_signal(self, **kwds):
    45                          return False
    46  #               try:
    47  #                       # add here any code you for the plugin executed after
    48  #                       # raising the pugin
    49  #                       pass
    50  #               except KeyError:
    51  #                       pass
    52                  return True
    53  #================================================================
    54  # MAIN
    55  #----------------------------------------------------------------
    56  if __name__ == '__main__':
    57
    58          # GNUmed
    59          from Gnumed.business import gmPersonSearch
    60          from Gnumed.wxpython import gmPatSearchWidgets
    61
    62          _log.info("starting template plugin...")
    63
    64          # obtain patient
    65          patient = gmPersonSearch.ask_for_patient()
    66          if patient is None:
    67                  print("None patient. Exiting gracefully...")
    68                  sys.exit(0)
    69          gmPatSearchWidgets.set_active_patient(patient=patient)
    70
    71          # display the plugin standalone
    72          application = wx.wx.PyWidgetTester(size = (800,600))
    73          widgets = gmExamplePluginWidgets.cExamplePluginPnl(application.frame, -1)
    74
    75          application.frame.Show(True)
    76          application.MainLoop()
    77
    78          # clean up
    79          if patient is not None:
    80                  try:
    81                          patient.cleanup()
    82                  except Exception:
    83                          print("error cleaning up patient")
    84
    85          _log.info("closing example plugin...")
    86