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

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

     1  #======================================================================
     2  # GNUmed notebook based patient edition plugin
     3  # ------------------------------------------------
     4  #
     5  # this plugin displays a notebook container for patient edition
     6  # current pages (0.1): identity, contacts, occupation
     7  #
     8  # @copyright: author
     9  #======================================================================
    10  __version__ = "$Revision: 1.15 $"
    11  __author__ = "Carlos Moro, Karsten Hilbert"
    12  __license__ = 'GPL v2 or later (details at http://www.gnu.org)'
    13
    14  import logging
    15
    16
    17  if __name__ == '__main__':
    18
    19          # stdlib
    20          import sys
    21          sys.path.insert(0, '../../../')
    22
    23          from Gnumed.pycommon import gmI18N
    24          gmI18N.activate_locale()
    25          gmI18N.install_domain()
    26
    27  # GNUmed
    28  from Gnumed.wxpython import gmPlugin, gmDemographicsWidgets
    29
    30
    31  _log = logging.getLogger('gm.ui')
    32  _log.info(__version__)
    33  #======================================================================
    34 -class gmNotebookedPatientEditionPlugin(gmPlugin.cNotebookPlugin):
    35          """Plugin to encapsulate notebooked patient edition window."""
    36
    37          tab_name = _('Demographics')
    38
    39 -        def name (self):
    40                  return gmNotebookedPatientEditionPlugin.tab_name
    41
    42 -        def GetWidget (self, parent):
    43                  self._widget = gmDemographicsWidgets.cNotebookedPatEditionPanel(parent, -1)
    44                  return self._widget
    45
    46 -        def MenuInfo (self):
    47                  return ('patient', _('&Demographics'))
    48
    49 -        def can_receive_focus(self):
    50                  # need patient
    51                  if not self._verify_patient_avail():
    52                          return None
    53                  return 1
    54
    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          _log.info("starting Notebooked patient edition plugin...")
    67
    68          try:
    69                  # obtain patient
    70                  patient = gmPersonSearch.ask_for_patient()
    71                  if patient is None:
    72                          print "None patient. Exiting gracefully..."
    73                          sys.exit(0)
    74                  gmPatSearchWidgets.set_active_patient(patient=patient)
    75
    76                  # display standalone notebooked patient editor
    77                  application = wx.PyWidgetTester(size=(800,600))
    78                  application.SetWidget(gmDemographicsWidgets.cNotebookedPatEditionPanel, -1)
    79
    80                  application.frame.Show(True)
    81                  application.MainLoop()
    82
    83                  # clean up
    84                  if patient is not None:
    85                          try:
    86                                  patient.cleanup()
    87                          except:
    88                                  print "error cleaning up patient"
    89          except StandardError:
    90                  _log.exception("unhandled exception caught !")
    91                  # but re-raise them
    92                  raise
    93
    94          _log.info("closing Notebooked progress notes input plugin...")
    95
    96  #======================================================================
    97