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

Module gmRegetMixin

source code

gmRegetMixin - GNUmed data change callback mixin.

Widget code can mix in this class as a base class and
thus gain the infrastructure to update it's display
when data changes. If the widget is not visible it will
only schedule refetching data from the business layer.
If it *is* visible it will immediately fetch and redisplay.

You must call cRegetOnPaintMixin.__init__() in your own
__init__() after calling __init__() on the appropriate
wx.Widgets class your widget inherits from.

You must then make sure to call _schedule_data_reget()
whenever you learn of backend data changes. This will
in most cases happen after you receive a gmDispatcher
signal indicating a change in the backend.

The _populate_with_data(self) method must be overriden in the
including class and must return True if the UI was successfully
repopulated with content.

@copyright: authors

Template for users:

        #-----------------------------------------------------
        # reget-on-paint mixin API
        #
        # remember to call
        #       self._schedule_data_reget()
        # whenever you learn of data changes from database
        # listener threads, dispatcher signals etc.
        #-----------------------------------------------------
        def _populate_with_data(self):
                # fill the UI with data
                print "need to implement _populate_with_data"
                return False
                return True
        #-----------------------------------------------------


Author: K.Hilbert <Karsten.Hilbert@gmx.net>

License: GPL v2 or later (details at http://www.gnu.org)

Classes
  cRegetOnPaintMixin
Mixin to add redisplay_data-on-wx.EVT_PAINT aspect.
Variables
  __package__ = 'Gnumed.wxpython'

Imports: wx