ChangeHistory¶
Keep track of buffer change history.
Plugin Type: Global
ChangeHistory
is a global plugin. Only one instance can be opened.
This plugin is used to log any changes to data buffer. For example,
a change log would appear here if a new image is added to a mosaic via the
Mosaic
plugin. Like Contents
,
the log is sorted by channel, and then by image name.
Usage
History should stay no matter what channel or image is active. New history can be added, but old history cannot be deleted, unless the image/channel itself is deleted.
The redo()
method picks up an 'add-image-info'
event and displays
related metadata here. The metadata is obtained as follows:
channel = self.fv.get_channel_info(chname)
iminfo = channel.get_image_info(imname)
timestamp = iminfo.time_modified
description = iminfo.reason_modified # Optional
Both 'time_modified'
and 'reason_modified'
have to be explicitly set
by the calling plugin in the same method that issues the
'add-image-info'
callback, like this:
# This changes the data buffer
image.set_data(new_data, ...)
# Add description for ChangeHistory
info = dict(time_modified=datetime.utcnow(),
reason_modified='Data has changed')
self.fv.update_image_info(image, info)