libtools/ToolSelect.py: fix function signatures.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-12 16:55:03 +02:00
parent 31b45d1076
commit 3e4644122b

View File

@ -12,8 +12,8 @@ class ToolSelect(Tool):
TS_SELECT = 2 TS_SELECT = 2
TS_TARGET = 3 TS_TARGET = 3
# {{{ _dispatchSelectEvent(self, mapPoint, dispatchFn, eventDc, mouseLeftDown, mouseRightDown, selectRect, viewRect) # {{{ _dispatchSelectEvent(self, dispatchFn, eventDc, mapPoint, mouseLeftDown, mouseRightDown, selectRect, viewRect)
def _dispatchSelectEvent(self, mapPoint, dispatchFn, eventDc, mouseLeftDown, mouseRightDown, selectRect, viewRect): def _dispatchSelectEvent(self, dispatchFn, eventDc, mapPoint, mouseLeftDown, mouseRightDown, selectRect, viewRect):
if mouseLeftDown: if mouseLeftDown:
disp, isCursor = [mapPoint[m] - self.lastAtPoint[m] for m in [0, 1]], True disp, isCursor = [mapPoint[m] - self.lastAtPoint[m] for m in [0, 1]], True
newTargetRect = [[selectRect[n][m] + disp[m] for m in [0, 1]] for n in [0, 1]] newTargetRect = [[selectRect[n][m] + disp[m] for m in [0, 1]] for n in [0, 1]]
@ -44,16 +44,16 @@ class ToolSelect(Tool):
dispatchFn(eventDc, True, [rectFrame[0][0], rectY, *curColours, 0, " "], viewRect) dispatchFn(eventDc, True, [rectFrame[0][0], rectY, *curColours, 0, " "], viewRect)
dispatchFn(eventDc, True, [rectFrame[1][0], rectY, *curColours, 0, " "], viewRect) dispatchFn(eventDc, True, [rectFrame[1][0], rectY, *curColours, 0, " "], viewRect)
# }}} # }}}
# {{{ _mouseEventTsNone(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) # {{{ _mouseEventTsNone(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
def _mouseEventTsNone(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect): def _mouseEventTsNone(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect):
if mouseLeftDown: if mouseLeftDown:
self.targetRect, self.toolState = [list(mapPoint), []], self.TS_ORIGIN self.targetRect, self.toolState = [list(mapPoint), []], self.TS_ORIGIN
else: else:
dispatchFn(eventDc, True, [*mapPoint, *brushColours, 0, " "], viewRect) dispatchFn(eventDc, True, [*mapPoint, *brushColours, 0, " "], viewRect)
return False return False
# }}} # }}}
# {{{ _mouseEventTsOrigin(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) # {{{ _mouseEventTsOrigin(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
def _mouseEventTsOrigin(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect): def _mouseEventTsOrigin(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect):
if mouseLeftDown: if mouseLeftDown:
self.targetRect[1] = list(mapPoint) self.targetRect[1] = list(mapPoint)
if self.targetRect[0][0] > self.targetRect[1][0]: if self.targetRect[0][0] > self.targetRect[1][0]:
@ -74,8 +74,8 @@ class ToolSelect(Tool):
self._drawSelectRect(self.targetRect, dispatchFn, eventDc, viewRect) self._drawSelectRect(self.targetRect, dispatchFn, eventDc, viewRect)
return False return False
# }}} # }}}
# {{{ _mouseEventTsSelect(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) # {{{ _mouseEventTsSelect(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
def _mouseEventTsSelect(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect): def _mouseEventTsSelect(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect):
dirty = False dirty = False
if mouseLeftDown \ if mouseLeftDown \
and (mapPoint[0] >= (self.targetRect[0][0] - 1)) \ and (mapPoint[0] >= (self.targetRect[0][0] - 1)) \
@ -84,20 +84,20 @@ class ToolSelect(Tool):
and (mapPoint[1] <= (self.targetRect[1][1] + 1)): and (mapPoint[1] <= (self.targetRect[1][1] + 1)):
self.lastAtPoint, self.toolState = list(mapPoint), self.TS_TARGET self.lastAtPoint, self.toolState = list(mapPoint), self.TS_TARGET
elif mouseRightDown: elif mouseRightDown:
dirty = self._dispatchSelectEvent(mapPoint, dispatchFn, eventDc, mouseLeftDown, mouseRightDown, self.targetRect, viewRect) dirty = self._dispatchSelectEvent(dispatchFn, eventDc, mapPoint, mouseLeftDown, mouseRightDown, self.targetRect, viewRect)
self.targetRect, self.toolState = None, self.TS_NONE self.targetRect, self.toolState = None, self.TS_NONE
else: else:
dirty = self._dispatchSelectEvent(mapPoint, dispatchFn, eventDc, mouseLeftDown, mouseRightDown, self.targetRect, viewRect) dirty = self._dispatchSelectEvent(dispatchFn, eventDc, mapPoint, mouseLeftDown, mouseRightDown, self.targetRect, viewRect)
return dirty return dirty
# }}} # }}}
# {{{ _mouseEventTsTarget(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) # {{{ _mouseEventTsTarget(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
def _mouseEventTsTarget(self, mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect): def _mouseEventTsTarget(self, brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect):
dirty = False dirty = False
if mouseLeftDown: if mouseLeftDown:
self.toolState = self.TS_TARGET self.toolState = self.TS_TARGET
dirty = self._dispatchSelectEvent(mapPoint, dispatchFn, eventDc, mouseLeftDown, mouseRightDown, self.targetRect, viewRect) dirty = self._dispatchSelectEvent(dispatchFn, eventDc, mapPoint, mouseLeftDown, mouseRightDown, self.targetRect, viewRect)
elif mouseRightDown: elif mouseRightDown:
dirty = self._dispatchSelectEvent(mapPoint, dispatchFn, eventDc, mouseLeftDown, mouseRightDown, self.targetRect, viewRect) dirty = self._dispatchSelectEvent(dispatchFn, eventDc, mapPoint, mouseLeftDown, mouseRightDown, self.targetRect, viewRect)
self.targetRect, self.toolState = None, self.TS_NONE self.targetRect, self.toolState = None, self.TS_NONE
else: else:
self.toolState = self.TS_SELECT self.toolState = self.TS_SELECT
@ -109,13 +109,13 @@ class ToolSelect(Tool):
def onMouseEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect): def onMouseEvent(self, brushColours, brushSize, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect):
dirty = False dirty = False
if self.toolState == self.TS_NONE: if self.toolState == self.TS_NONE:
dirty = self._mouseEventTsNone(mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) dirty = self._mouseEventTsNone(brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
elif self.toolState == self.TS_ORIGIN: elif self.toolState == self.TS_ORIGIN:
dirty = self._mouseEventTsOrigin(mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) dirty = self._mouseEventTsOrigin(brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
elif self.toolState == self.TS_SELECT: elif self.toolState == self.TS_SELECT:
dirty = self._mouseEventTsSelect(mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) dirty = self._mouseEventTsSelect(brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
elif self.toolState == self.TS_TARGET: elif self.toolState == self.TS_TARGET:
dirty = self._mouseEventTsTarget(mapPoint, brushColours, dispatchFn, eventDc, mouseDragging, mouseLeftDown, mouseRightDown, viewRect) dirty = self._mouseEventTsTarget(brushColours, canvas, dispatchFn, eventDc, mapPoint, mouseDragging, mouseLeftDown, mouseRightDown, viewRect)
else: else:
return False, dirty return False, dirty
return True, dirty return True, dirty