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 # {{{ canvasToolCircle(self, event): XXX
def canvasToolCircle(self, event): def canvasToolCircle(self, event):
self.canvasTool = MiRCARTToolCircle(self.parentCanvas) self.canvasTool = MiRCARTToolCircle(self.parentCanvas)
self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name)
# }}} # }}}
# {{{ canvasToolLine(self, event): XXX # {{{ canvasToolLine(self, event): XXX
def canvasToolLine(self, event): def canvasToolLine(self, event):
self.canvasTool = MiRCARTToolLine(self.parentCanvas) self.canvasTool = MiRCARTToolLine(self.parentCanvas)
self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name)
# }}} # }}}
# {{{ canvasToolRect(self, event): XXX # {{{ canvasToolRect(self, event): XXX
def canvasToolRect(self, event): def canvasToolRect(self, event):
self.canvasTool = MiRCARTToolRect(self.parentCanvas) self.canvasTool = MiRCARTToolRect(self.parentCanvas)
self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name)
# }}} # }}}
# {{{ canvasToolText(self, event): XXX # {{{ canvasToolText(self, event): XXX
def canvasToolText(self, event): def canvasToolText(self, event):
self.canvasTool = MiRCARTToolText(self.parentCanvas) self.canvasTool = MiRCARTToolText(self.parentCanvas)
self.parentFrame.onCanvasUpdate(newToolName=self.canvasTool.name)
# }}} # }}}
# {{{ canvasUndo(self, event): XXX # {{{ canvasUndo(self, event): XXX
def canvasUndo(self, event): def canvasUndo(self, event):

View File

@ -34,7 +34,7 @@ import os, wx
class MiRCARTFrame(MiRCARTGeneralFrame): class MiRCARTFrame(MiRCARTGeneralFrame):
"""XXX""" """XXX"""
panelCanvas = None panelCanvas = None
lastBrushSize = lastCellPos = lastColours = lastPathName = lastSize = lastUndoLevel = None lastBrushSize = lastCellPos = lastColours = lastPathName = lastSize = lastToolName = lastUndoLevel = None
# {{{ Commands # {{{ Commands
# Id Type Id Labels Icon bitmap Accelerator [Initial state] # Id Type Id Labels Icon bitmap Accelerator [Initial state]
@ -158,8 +158,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
else: else:
self.itemsById[eventId][7](self.panelCanvas.canvasInterface, event) self.itemsById[eventId][7](self.panelCanvas.canvasInterface, event)
# }}} # }}}
# {{{ onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): XXX # {{{ 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, newUndoLevel=None): def onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newToolName=None, newUndoLevel=None):
if newBrushSize != None: if newBrushSize != None:
self.lastBrushSize = newBrushSize self.lastBrushSize = newBrushSize
if newCellPos != None: if newCellPos != None:
@ -170,6 +170,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
self.lastPathName = newPathName self.lastPathName = newPathName
if newSize != None: if newSize != None:
self.lastSize = newSize self.lastSize = newSize
if newToolName != None:
self.lastToolName = newToolName
if newUndoLevel != None: if newUndoLevel != None:
self.lastUndoLevel = newUndoLevel self.lastUndoLevel = newUndoLevel
textItems = [] textItems = []
@ -195,6 +197,8 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
self.SetTitle("{} - MiRCART".format(basePathName)) self.SetTitle("{} - MiRCART".format(basePathName))
else: else:
self.SetTitle("MiRCART") self.SetTitle("MiRCART")
if self.lastToolName != None:
textItems.append("Current tool: {}".format(self.lastToolName))
self.statusBar.SetStatusText(" | ".join(textItems)) self.statusBar.SetStatusText(" | ".join(textItems))
if self.lastUndoLevel != None: if self.lastUndoLevel != None:
if self.lastUndoLevel >= 0: if self.lastUndoLevel >= 0:

View File

@ -26,6 +26,7 @@ from MiRCARTTool import MiRCARTTool
class MiRCARTToolCircle(MiRCARTTool): class MiRCARTToolCircle(MiRCARTTool):
"""XXX""" """XXX"""
name = "Circle"
# #
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX # 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): class MiRCARTToolLine(MiRCARTTool):
"""XXX""" """XXX"""
name = "Line"
toolOriginPoint = toolState = None toolOriginPoint = toolState = None
TS_NONE = 0 TS_NONE = 0

View File

@ -26,6 +26,7 @@ from MiRCARTTool import MiRCARTTool
class MiRCARTToolRect(MiRCARTTool): class MiRCARTToolRect(MiRCARTTool):
"""XXX""" """XXX"""
name = "Rectangle"
# #
# onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX # onMouseEvent(self, event, atPoint, brushColours, brushSize, isDragging, isLeftDown, isRightDown, dispatchFn, eventDc): XXX

View File

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