MiRCART{CanvasInterface,Frame,Tool*}.py: include current tool name in status bar text.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-01-10 05:05:59 +01:00
parent a320c904fe
commit 402e542137
6 changed files with 15 additions and 3 deletions

View File

@ -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):

View File

@ -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:

View File

@ -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

View File

@ -26,6 +26,7 @@ from MiRCARTTool import MiRCARTTool
class MiRCARTToolLine(MiRCARTTool):
"""XXX"""
name = "Line"
toolOriginPoint = toolState = None
TS_NONE = 0

View File

@ -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

View File

@ -27,6 +27,7 @@ import wx
class MiRCARTToolText(MiRCARTTool):
"""XXX"""
name = "Text"
textColours = textPos = None
#