Package Gnumed :: Package wxpython :: Module gmExamplePluginWidgets |
[frames] | no frames]

# Source Code for Module Gnumed.wxpython.gmExamplePluginWidgets

     1  """GNUmed measurement widgets.
     2  """
     3  #================================================================
     4  __version__ = "$Revision: 0.1 $"
     5  __author__ = "Sebastian Hilbert <Sebastian.Hilbert@gmx.net>"
     6  __license__ = "GPL"
     7
     8  import sys, logging, datetime as pyDT, decimal, StringIO
     9
    10  import wx       #, wx.grid
    11
    12  if __name__ == '__main__':
    13          sys.path.insert(0, '../../')
    14
    15  from Gnumed.business import gmPerson
    16  from Gnumed.pycommon import gmDispatcher, gmMatchProvider
    17  from Gnumed.wxpython import gmRegetMixin, gmGuiHelpers, gmPatSearchWidgets
    18  """
    19  Now import the Panel that holds your widgets you designed with wxglade
    20  adapt the name of the files and panel to match those you define in
    21  wxglade
    22  """
    23  from Gnumed.wxGladeWidgets import wxgExamplePluginPnl
    24
    25  _log = logging.getLogger('gm.ui')
    26  _log.info(__version__)
    27  #================================================================
    28 -class cExamplePluginPnl(wxgExamplePluginPnl.wxgExamplePluginPnl, gmRegetMixin.cRegetOnPaintMixin):
    29          """Panel holding a number of widgets. Used as notebook page."""
    30 -        def __init__(self, *args, **kwargs):
    31                  wxgExamplePluginPnl.wxgExamplePluginPnl.__init__(self, *args, **kwargs)
    32                  gmRegetMixin.cRegetOnPaintMixin.__init__(self)
    33                  self.__init_ui()
    34                  self.__register_interests()
    35          #--------------------------------------------------------
    36          # event handling
    37          #--------------------------------------------------------
    38 -        def __register_interests(self):
    39                  gmDispatcher.connect(signal = u'pre_patient_selection', receiver = self._on_pre_patient_selection)
    40                  gmDispatcher.connect(signal = u'post_patient_selection', receiver = self._schedule_data_reget)
    41          #--------------------------------------------------------
    42 -        def _on_pre_patient_selection(self):
    43                  wx.CallAfter(self.__on_pre_patient_selection)
    44          #--------------------------------------------------------
    45 -        def __on_pre_patient_selection(self):
    46                  pass
    47          #--------------------------------------------------------
    48 -        def repopulate_ui(self):
    49                  _log.info('repopulate ui')
    50                  self._populate_with_data()
    51          #--------------------------------------------------------
    52          # internal API
    53          #--------------------------------------------------------
    54 -        def __init_ui(self):
    55                  pass
    56
    57          #--------------------------------------------------------
    58          # reget mixin API
    59          #--------------------------------------------------------
    60 -        def _populate_with_data(self):
    61                  """ uncomment the following lines if you need the current patient in your plugin"""
    62  #               pat = gmPerson.gmCurrentPatient()
    63  #               if not pat.connected:
    64  #                       return True
    65
    66  #               pat = gmPerson.gmCurrentPatient()
    67
    68                  self._TCTRL_template.SetValue('you did it!')
    69                  return True
    70  #================================================================
    71  # main
    72  #----------------------------------------------------------------
    73  if __name__ == '__main__':
    74
    75          from Gnumed.pycommon import gmLog2, gmDateTime, gmI18N
    76
    77          gmI18N.activate_locale()
    78          gmI18N.install_domain()
    79          gmDateTime.init()
    80
    81 -def show_template_pnl():
    82          pass
    83
    84          #------------------------------------------------------------
    85          if (len(sys.argv) > 1) and (sys.argv[1] == 'test'):
    86                  show_template_pnl()
    87