Skip to content
Snippets Groups Projects
Commit ecc61d4e authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Opening new view panel was resetting the display context location -

fixed.

Profile event handlers were refreshing view panels after every event,
resulting in redundant SliceCanvas draws. This has been removed, but
will probably bite me later on.
parent 418e63f5
No related branches found
No related tags found
No related merge requests found
......@@ -100,21 +100,39 @@ class DisplayContext(props.SyncableHasProperties):
parent=parent,
nounbind=['overlayGroups'],
nobind=[ 'syncOverlayDisplay'])
self.__overlayList = overlayList
self.__name = '{}_{}'.format(self.__class__.__name__, id(self))
# Keep track of the overlay list
# length so we can do some things in the
# _overlayListChanged method
self.__prevOverlayListLen = 0
# _overlayListChanged method. This if/else
# is a bit hacky ....
#
# If the __overlayListChanged method detects
# (via the prevOverlayListLen attribute)
# that overlays have been added to an empty
# list, it will reset the DisplayContext.location
# to the centre of the new overlay list world.
#
# But, if this is a new child DisplayContext
# instance, the above behaviour will result in
# the child centering its location, which gets
# propagated back to the parent, clobbering the
# parent's location. So here, if this is a child
# DC, we set this attribute to the length of the
# list, so the overlayListChanged method won't
# reset the location.
if parent is None: self.__prevOverlayListLen = 0
else: self.__prevOverlayListLen = len(overlayList)
# Ensure that a Display object exists
# for every overlay, and that the display
# bounds property is initialised
self.__displays = {}
self.__overlayListChanged()
overlayList.addListener('overlays',
self.__name,
self.__overlayListChanged)
......
......@@ -128,13 +128,6 @@ class Profile(actions.ActionProvider):
see the :class:`.ActionProvider` class.
"""
if actionz is not None:
for name, func in actionz.items():
def wrap(f=func):
f()
viewPanel.Refresh()
actionz[name] = wrap
actions.ActionProvider.__init__(
self, overlayList, displayCtx, actions=actionz)
......@@ -279,7 +272,6 @@ class Profile(actions.ActionProvider):
t.Bind(wx.EVT_MOTION, None)
t.Bind(wx.EVT_MOUSEWHEEL, None)
t.Bind(wx.EVT_CHAR, None)
self._viewPanel.Refresh()
def __getTempMode(self, ev):
......@@ -406,7 +398,6 @@ class Profile(actions.ActionProvider):
wheel, canvas.name))
handler(ev, canvas, wheel, mouseLoc, canvasLoc)
self._viewPanel.Refresh()
def __onMouseDown(self, ev):
......@@ -433,7 +424,6 @@ class Profile(actions.ActionProvider):
mouseLoc, canvasLoc, canvas.name))
handler(ev, canvas, mouseLoc, canvasLoc)
self._viewPanel.Refresh()
self.__lastMousePos = mouseLoc
self.__lastCanvasPos = canvasLoc
......@@ -460,7 +450,6 @@ class Profile(actions.ActionProvider):
mouseLoc, canvasLoc, canvas.name))
handler(ev, canvas, mouseLoc, canvasLoc)
self._viewPanel.Refresh()
self.__mouseDownPos = None
self.__canvasDownPos = None
......@@ -488,7 +477,6 @@ class Profile(actions.ActionProvider):
mouseLoc, canvasLoc, canvas.name))
handler(ev, canvas, mouseLoc, canvasLoc)
self._viewPanel.Refresh()
self.__lastMousePos = mouseLoc
self.__lastCanvasPos = canvasLoc
......@@ -513,7 +501,6 @@ class Profile(actions.ActionProvider):
mouseLoc, canvasLoc, canvas.name))
handler(ev, canvas, mouseLoc, canvasLoc)
self._viewPanel.Refresh()
self.__lastMousePos = mouseLoc
self.__lastCanvasPos = canvasLoc
......@@ -535,7 +522,6 @@ class Profile(actions.ActionProvider):
log.debug('Keyboard event ({}) on canvas {}'.format(key, canvas.name))
handler(ev, canvas, key)
self._viewPanel.Refresh()
class ProfileManager(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment