| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
cGenericEditAreaMixin
Mixin for edit area panels providing generic functionality.
#====================================================================
# Class definition:
from Gnumed.wxGladeWidgets import wxgXxxEAPnl
class cXxxEAPnl(wxgXxxEAPnl.wxgXxxEAPnl, gmEditArea.cGenericEditAreaMixin):
def __init__(self, *args, **kwargs):
try:
data = kwargs['xxx']
del kwargs['xxx']
except KeyError:
data = None
wxgXxxEAPnl.wxgXxxEAPnl.__init__(self, *args, **kwargs)
gmEditArea.cGenericEditAreaMixin.__init__(self)
# Code using this mixin should set mode and data
# after instantiating the class:
self.mode = 'new'
self.data = data
if data is not None:
self.mode = 'edit'
#self.__init_ui()
#----------------------------------------------------------------
# def __init_ui(self):
# # adjust phrasewheels etc
#----------------------------------------------------------------
# generic Edit Area mixin API
#----------------------------------------------------------------
def _valid_for_save(self):
return False
return True
#----------------------------------------------------------------
def _save_as_new(self):
# save the data as a new instance
data =
data[''] =
data[''] =
data.save()
# must be done very late or else the property access
# will refresh the display such that later field
# access will return empty values
self.data = data
return False
return True
#----------------------------------------------------------------
def _save_as_update(self):
# update self.data and save the changes
self.data[''] =
self.data[''] =
self.data[''] =
self.data.save()
return True
#----------------------------------------------------------------
def _refresh_as_new(self):
pass
#----------------------------------------------------------------
def _refresh_from_existing(self):
pass
#----------------------------------------------------------------
def _refresh_as_new_from_existing(self):
pass
#----------------------------------------------------------------
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
| Properties | |
| data | |
| mode | |
|
Inherited from |
|
| Method Details |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
Invoked from the generic edit area dialog.
Invokes
_refresh_as_new
_refresh_from_existing
_refresh_as_new_from_existing
on the implementing edit area as needed.
|
Invoked from the generic edit area dialog.
Invokes
_valid_for_save,
_save_as_new,
_save_as_update
on the implementing edit area as needed.
_save_as_* must set self.__data and return True/False
|
| Property Details |
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Nov 29 04:04:29 2010 | http://epydoc.sourceforge.net |