Gnumed.wxpython.gmExamplePluginWidgets

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
     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 = 'pre_patient_unselection', receiver = self._on_pre_patient_unselection)
    40                  gmDispatcher.connect(signal = 'post_patient_selection', receiver = self._schedule_data_reget)
    41          #--------------------------------------------------------
    42 -        def _on_pre_patient_unselection(self):
    43                  pass
    44          #--------------------------------------------------------
    45 -        def repopulate_ui(self):
    46                  _log.info('repopulate ui')
    47                  self._populate_with_data()
    48          #--------------------------------------------------------
    49          # internal API
    50          #--------------------------------------------------------
    51 -        def __init_ui(self):
    52                  pass
    53          #--------------------------------------------------------
    54          # reget mixin API
    55          #--------------------------------------------------------
    56 -        def _populate_with_data(self):
    57                  """ uncomment the following lines if you need the current patient in your plugin"""
    58  #               pat = gmPerson.gmCurrentPatient()
    59  #               if not pat.connected:
    60  #                       return True
    61
    62  #               pat = gmPerson.gmCurrentPatient()
    63
    64                  self._TCTRL_template.SetValue('you did it!')
    65                  return True
    66  #================================================================
    67  # main
    68  #----------------------------------------------------------------
    69  if __name__ == '__main__':
    70
    71          from Gnumed.pycommon import gmLog2, gmDateTime, gmI18N
    72
    73          gmI18N.activate_locale()
    74          gmI18N.install_domain()
    75          gmDateTime.init()
    76
    77 -def show_template_pnl():
    78          pass
    79
    80          #------------------------------------------------------------
    81          if (len(sys.argv) > 1) and (sys.argv[1] == 'test'):
    82                  show_template_pnl()
    83