From b486d3966ec3e8ef7a0ecc5b6ed2c75cca7c9819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Wed, 10 Jan 2018 05:05:59 +0100 Subject: [PATCH] MiRCART{CanvasInterface,Frame,Tool*}.py: include current tool name in status bar text. --- MiRCARTCanvasInterface.py | 4 ++++ MiRCARTFrame.py | 10 +++++++--- MiRCARTToolCircle.py | 1 + MiRCARTToolLine.py | 1 + MiRCARTToolRect.py | 1 + MiRCARTToolText.py | 1 + 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/MiRCARTCanvasInterface.py b/MiRCARTCanvasInterface.py index 1b3b8cb..4b32b3c 100644 --- a/MiRCARTCanvasInterface.py +++ b/MiRCARTCanvasInterface.py @@ -261,18 +261,22 @@ class MiRCARTCanvasInterface(): # {{{ canvasToolCircle(self, event): XXX def canvasToolCircle(self, event): self.canvasTool = MiRCARTToolCircle(self.parentCanvas) + self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name) # }}} # {{{ canvasToolLine(self, event): XXX def canvasToolLine(self, event): self.canvasTool = MiRCARTToolLine(self.parentCanvas) + self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name) # }}} # {{{ canvasToolRect(self, event): XXX def canvasToolRect(self, event): self.canvasTool = MiRCARTToolRect(self.parentCanvas) + self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name) # }}} # {{{ canvasToolText(self, event): XXX def canvasToolText(self, event): self.canvasTool = MiRCARTToolText(self.parentCanvas) + self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name) # }}} # {{{ canvasUndo(self, event): XXX def canvasUndo(self, event): diff --git a/MiRCARTFrame.py b/MiRCARTFrame.py index e2278b5..8a92dbf 100644 --- a/MiRCARTFrame.py +++ b/MiRCARTFrame.py @@ -34,7 +34,7 @@ import os, wx class MiRCARTFrame(MiRCARTGeneralFrame): """XXX""" panelCanvas = None - lastBrushSize = lastCellPos = lastColours = lastPathName = lastSize = lastUndoLevel = None + lastBrushSize = lastCellPos = lastColours = lastPathName = lastSize = lastToolName = lastUndoLevel = None # {{{ Commands # Id Type Id Labels Icon bitmap Accelerator [Initial state] @@ -158,8 +158,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame): else: self.itemsById[eventId][7](self.panelCanvas.canvasInterface, event) # }}} - # {{{ onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): XXX - def onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): + # {{{ onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newToolName=None, newUndoLevel=None): XXX + def onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newToolName=None, newUndoLevel=None): if newBrushSize != None: self.lastBrushSize = newBrushSize if newCellPos != None: @@ -170,6 +170,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame): self.lastPathName = newPathName if newSize != None: self.lastSize = newSize + if newToolName != None: + self.lastToolName = newToolName if newUndoLevel != None: self.lastUndoLevel = newUndoLevel textItems = [] @@ -195,6 +197,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame): self.SetTitle("{} - MiRCART".format(basePathName)) else: self.SetTitle("MiRCART") + if self.lastToolName != None: + textItems.append("Current tool: {}".format(self.lastToolName)) self.statusBar.SetStatusText(" | ".join(textItems)) if self.lastUndoLevel != None: if self.lastUndoLevel >= 0: diff --git a/MiRCARTToolCircle.py b/MiRCARTToolCircle.py index 52497e3..0fc5fb7 100644 --- a/MiRCARTToolCircle.py +++ b/MiRCARTToolCircle.py @@ -26,6 +26,7 @@ from MiRCARTTool import MiRCARTTool class MiRCARTToolCircle(MiRCARTTool): """XXX""" + name = "Circle" # # onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX diff --git a/MiRCARTToolLine.py b/MiRCARTToolLine.py index aeabc43..d22f1ad 100644 --- a/MiRCARTToolLine.py +++ b/MiRCARTToolLine.py @@ -26,6 +26,7 @@ from MiRCARTTool import MiRCARTTool class MiRCARTToolLine(MiRCARTTool): """XXX""" + name = "Line" toolOriginPoint = toolState = None TS_NONE = 0 diff --git a/MiRCARTToolRect.py b/MiRCARTToolRect.py index a1455a3..d4250ba 100644 --- a/MiRCARTToolRect.py +++ b/MiRCARTToolRect.py @@ -26,6 +26,7 @@ from MiRCARTTool import MiRCARTTool class MiRCARTToolRect(MiRCARTTool): """XXX""" + name = "Rectangle" # # onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX diff --git a/MiRCARTToolText.py b/MiRCARTToolText.py index ebb58fb..a3eb686 100644 --- a/MiRCARTToolText.py +++ b/MiRCARTToolText.py @@ -27,6 +27,7 @@ import wx class MiRCARTToolText(MiRCARTTool): """XXX""" + name = "Text" textColours = textPos = None #