MiRCART{Canvas{,Interface},Frame}.py: remove undo level & show brush size in status bar.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-01-10 05:00:52 +01:00
parent 7acb234404
commit 62ff843d03
3 changed files with 15 additions and 8 deletions

View File

@ -163,7 +163,8 @@ class MiRCARTCanvas(wx.Panel):
self.parentFrame = parentFrame self.parentFrame = parentFrame
self.canvasMap = None; self.canvasPos = canvasPos; self.canvasSize = canvasSize; self.canvasMap = None; self.canvasPos = canvasPos; self.canvasSize = canvasSize;
self.brushColours = [4, 1]; self.brushPos = [0, 0]; self.brushSize = [1, 1]; self.brushColours = [4, 1]; self.brushPos = [0, 0]; self.brushSize = [1, 1];
self.parentFrame.onCanvasUpdate(newColours=self.brushColours) self.parentFrame.onCanvasUpdate( \
newBrushSize=self.brushSize, newColours=self.brushColours)
self.canvasBackend = MiRCARTCanvasBackend(canvasSize, cellSize) self.canvasBackend = MiRCARTCanvasBackend(canvasSize, cellSize)
self.canvasJournal = MiRCARTCanvasJournal() self.canvasJournal = MiRCARTCanvasJournal()
self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self) self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self)

View File

@ -85,6 +85,7 @@ class MiRCARTCanvasInterface():
and self.parentCanvas.brushSize[1] > 1: and self.parentCanvas.brushSize[1] > 1:
self.parentCanvas.brushSize = \ self.parentCanvas.brushSize = \
[a-1 for a in self.parentCanvas.brushSize] [a-1 for a in self.parentCanvas.brushSize]
self.parentFrame.onCanvasUpdate(newBrushSize=self.parentCanvas.brushSize)
# }}} # }}}
# {{{ canvasDecrCanvasHeight(self, event): XXX # {{{ canvasDecrCanvasHeight(self, event): XXX
def canvasDecrCanvasHeight(self, event): def canvasDecrCanvasHeight(self, event):
@ -165,6 +166,7 @@ class MiRCARTCanvasInterface():
def canvasIncrBrush(self, event): def canvasIncrBrush(self, event):
self.parentCanvas.brushSize = \ self.parentCanvas.brushSize = \
[a+1 for a in self.parentCanvas.brushSize] [a+1 for a in self.parentCanvas.brushSize]
self.parentFrame.onCanvasUpdate(newBrushSize=self.parentCanvas.brushSize)
# }}} # }}}
# {{{ canvasIncrCanvasHeight(self, event): XXX # {{{ canvasIncrCanvasHeight(self, event): XXX
def canvasIncrCanvasHeight(self, event): def canvasIncrCanvasHeight(self, event):

View File

@ -34,7 +34,7 @@ import os, wx
class MiRCARTFrame(MiRCARTGeneralFrame): class MiRCARTFrame(MiRCARTGeneralFrame):
"""XXX""" """XXX"""
panelCanvas = None panelCanvas = None
lastCellPos = lastColours = lastPathName = lastSize = lastUndoLevel = None lastBrushSize = lastCellPos = lastColours = lastPathName = lastSize = 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,10 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
else: else:
self.itemsById[eventId][7](self.panelCanvas.canvasInterface, event) self.itemsById[eventId][7](self.panelCanvas.canvasInterface, event)
# }}} # }}}
# {{{ onCanvasUpdate(self, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): XXX # {{{ onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): XXX
def onCanvasUpdate(self, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): def onCanvasUpdate(self, newBrushSize=None, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None):
if newBrushSize != None:
self.lastBrushSize = newBrushSize
if newCellPos != None: if newCellPos != None:
self.lastCellPos = newCellPos self.lastCellPos = newCellPos
if newColours != None: if newColours != None:
@ -175,7 +177,11 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
textItems.append("X: {:03d} Y: {:03d}".format( \ textItems.append("X: {:03d} Y: {:03d}".format( \
*self.lastCellPos)) *self.lastCellPos))
if self.lastSize != None: if self.lastSize != None:
textItems.append("W: {:03d} H: {:03d}".format(*self.lastSize)) textItems.append("W: {:03d} H: {:03d}".format( \
*self.lastSize))
if self.lastBrushSize != None:
textItems.append("Brush: {:02d}x{:02d}".format( \
*self.lastBrushSize))
if self.lastColours != None: if self.lastColours != None:
textItems.append("FG: {:02d}, BG: {:02d}".format( \ textItems.append("FG: {:02d}, BG: {:02d}".format( \
*self.lastColours)) *self.lastColours))
@ -189,8 +195,6 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
self.SetTitle("{} - MiRCART".format(basePathName)) self.SetTitle("{} - MiRCART".format(basePathName))
else: else:
self.SetTitle("MiRCART") self.SetTitle("MiRCART")
if self.lastUndoLevel != None:
textItems.append("Undo level: {}".format(self.lastUndoLevel))
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: