mirror of
https://github.com/lalbornoz/roar.git
synced 2024-12-23 12:56:37 +00:00
MiRCART{Canvas{,Interface},Frame}.py: remove undo level & show brush size in status bar.
This commit is contained in:
parent
7acb234404
commit
62ff843d03
@ -163,7 +163,8 @@ class MiRCARTCanvas(wx.Panel):
|
||||
self.parentFrame = parentFrame
|
||||
self.canvasMap = None; self.canvasPos = canvasPos; self.canvasSize = canvasSize;
|
||||
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.canvasJournal = MiRCARTCanvasJournal()
|
||||
self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self)
|
||||
|
@ -85,6 +85,7 @@ class MiRCARTCanvasInterface():
|
||||
and self.parentCanvas.brushSize[1] > 1:
|
||||
self.parentCanvas.brushSize = \
|
||||
[a-1 for a in self.parentCanvas.brushSize]
|
||||
self.parentFrame.onCanvasUpdate(newBrushSize=self.parentCanvas.brushSize)
|
||||
# }}}
|
||||
# {{{ canvasDecrCanvasHeight(self, event): XXX
|
||||
def canvasDecrCanvasHeight(self, event):
|
||||
@ -165,6 +166,7 @@ class MiRCARTCanvasInterface():
|
||||
def canvasIncrBrush(self, event):
|
||||
self.parentCanvas.brushSize = \
|
||||
[a+1 for a in self.parentCanvas.brushSize]
|
||||
self.parentFrame.onCanvasUpdate(newBrushSize=self.parentCanvas.brushSize)
|
||||
# }}}
|
||||
# {{{ canvasIncrCanvasHeight(self, event): XXX
|
||||
def canvasIncrCanvasHeight(self, event):
|
||||
|
@ -34,7 +34,7 @@ import os, wx
|
||||
class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
"""XXX"""
|
||||
panelCanvas = None
|
||||
lastCellPos = lastColours = lastPathName = lastSize = lastUndoLevel = None
|
||||
lastBrushSize = lastCellPos = lastColours = lastPathName = lastSize = lastUndoLevel = None
|
||||
|
||||
# {{{ Commands
|
||||
# Id Type Id Labels Icon bitmap Accelerator [Initial state]
|
||||
@ -158,8 +158,10 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
else:
|
||||
self.itemsById[eventId][7](self.panelCanvas.canvasInterface, event)
|
||||
# }}}
|
||||
# {{{ onCanvasUpdate(self, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None): XXX
|
||||
def onCanvasUpdate(self, newCellPos=None, newColours=None, newPathName=None, newSize=None, newUndoLevel=None):
|
||||
# {{{ 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):
|
||||
if newBrushSize != None:
|
||||
self.lastBrushSize = newBrushSize
|
||||
if newCellPos != None:
|
||||
self.lastCellPos = newCellPos
|
||||
if newColours != None:
|
||||
@ -175,22 +177,24 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
||||
textItems.append("X: {:03d} Y: {:03d}".format( \
|
||||
*self.lastCellPos))
|
||||
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:
|
||||
textItems.append("FG: {:02d}, BG: {:02d}".format( \
|
||||
*self.lastColours))
|
||||
textItems.append("{} on {}".format( \
|
||||
MiRCARTColours[self.lastColours[0]][4], \
|
||||
MiRCARTColours[self.lastColours[1]][4]))
|
||||
if self.lastPathName != None:
|
||||
if self.lastPathName != None:
|
||||
if self.lastPathName != "":
|
||||
basePathName = os.path.basename(self.lastPathName)
|
||||
textItems.append("Current file: {}".format(basePathName))
|
||||
self.SetTitle("{} - MiRCART".format(basePathName))
|
||||
else:
|
||||
self.SetTitle("MiRCART")
|
||||
if self.lastUndoLevel != None:
|
||||
textItems.append("Undo level: {}".format(self.lastUndoLevel))
|
||||
self.statusBar.SetStatusText(" | ".join(textItems))
|
||||
if self.lastUndoLevel != None:
|
||||
if self.lastUndoLevel >= 0:
|
||||
|
Loading…
Reference in New Issue
Block a user