mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-26 08:56:36 +00:00
MiRCART{anvas{,ImportStore,Interface},Frame}.py: pass & initialise from default canvas position, size, and cell size.
This commit is contained in:
parent
2330eb8c69
commit
cd9a81dbf4
@ -32,6 +32,7 @@ import wx
|
|||||||
class MiRCARTCanvas(wx.Panel):
|
class MiRCARTCanvas(wx.Panel):
|
||||||
"""XXX"""
|
"""XXX"""
|
||||||
parentFrame = None
|
parentFrame = None
|
||||||
|
defaultCanvasPos = defaultCanvasSize = defaultCellSize = None
|
||||||
canvasMap = canvasPos = canvasSize = None
|
canvasMap = canvasPos = canvasSize = None
|
||||||
brushColours = brushPos = brushSize = None
|
brushColours = brushPos = brushSize = None
|
||||||
canvasBackend = canvasJournal = None
|
canvasBackend = canvasJournal = None
|
||||||
@ -155,17 +156,19 @@ class MiRCARTCanvas(wx.Panel):
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
#
|
#
|
||||||
# _init__(self, parent, parentFrame, canvasPos, canvasSize, cellSize): initialisation method
|
# _init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize): initialisation method
|
||||||
def __init__(self, parent, parentFrame, canvasPos, canvasSize, cellSize):
|
def __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize):
|
||||||
super().__init__(parent, pos=canvasPos, \
|
super().__init__(parent, pos=defaultCanvasPos, \
|
||||||
size=[w*h for w,h in zip(canvasSize, cellSize)])
|
size=[w*h for w,h in zip(defaultCanvasSize, defaultCellSize)])
|
||||||
|
|
||||||
self.parentFrame = parentFrame
|
self.parentFrame = parentFrame
|
||||||
self.canvasMap = None; self.canvasPos = canvasPos; self.canvasSize = canvasSize;
|
self.canvasMap = None
|
||||||
|
self.canvasPos = defaultCanvasPos; self.canvasSize = defaultCanvasSize;
|
||||||
|
self.defaultCanvasPos = defaultCanvasPos; self.defaultCanvasSize = defaultCanvasSize;
|
||||||
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( \
|
self.parentFrame.onCanvasUpdate( \
|
||||||
brushSize=self.brushSize, colours=self.brushColours)
|
brushSize=self.brushSize, colours=self.brushColours)
|
||||||
self.canvasBackend = MiRCARTCanvasBackend(canvasSize, cellSize)
|
self.canvasBackend = MiRCARTCanvasBackend(defaultCanvasSize, defaultCellSize)
|
||||||
self.canvasJournal = MiRCARTCanvasJournal()
|
self.canvasJournal = MiRCARTCanvasJournal()
|
||||||
self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self)
|
self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self)
|
||||||
self.canvasImportStore = MiRCARTCanvasImportStore(parentCanvas=self)
|
self.canvasImportStore = MiRCARTCanvasImportStore(parentCanvas=self)
|
||||||
|
@ -137,9 +137,9 @@ class MiRCARTCanvasImportStore():
|
|||||||
# }}}
|
# }}}
|
||||||
# {{{ importNew(self, newCanvasSize=None): XXX
|
# {{{ importNew(self, newCanvasSize=None): XXX
|
||||||
def importNew(self, newCanvasSize=None):
|
def importNew(self, newCanvasSize=None):
|
||||||
newMap = [[[(1, 1), 0, " "] \
|
newMap = [[[[1, 1], 0, " "] \
|
||||||
for x in range(self.parentCanvas.canvasSize[0])] \
|
for x in range(newCanvasSize[0])] \
|
||||||
for y in range(self.parentCanvas.canvasSize[1])]
|
for y in range(newCanvasSize[1])]
|
||||||
self.parentCanvas.onStoreUpdate(newCanvasSize, newMap)
|
self.parentCanvas.onStoreUpdate(newCanvasSize, newMap)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ class MiRCARTCanvasInterface():
|
|||||||
self.canvasSave()
|
self.canvasSave()
|
||||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||||
if newCanvasSize == None:
|
if newCanvasSize == None:
|
||||||
newCanvasSize = (100, 30)
|
newCanvasSize = list(self.parentCanvas.defaultCanvasSize)
|
||||||
self.parentCanvas.canvasImportStore.importNew(newCanvasSize)
|
self.parentCanvas.canvasImportStore.importNew(newCanvasSize)
|
||||||
self.canvasPathName = None
|
self.canvasPathName = None
|
||||||
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor))
|
||||||
|
@ -203,12 +203,14 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
#
|
#
|
||||||
# __init__(self, parent, appSize=(840, 630), canvasPos=(25, 50), canvasSize=(125, 35), cellSize=(7, 14)): initialisation method
|
# __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(25, 50), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)): initialisation method
|
||||||
def __init__(self, parent, appSize=(840, 630), canvasPos=(25, 50), canvasSize=(125, 35), cellSize=(7, 14)):
|
def __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(25, 50), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)):
|
||||||
self._initPaletteToolBitmaps()
|
self._initPaletteToolBitmaps()
|
||||||
panelSkin = super().__init__(parent, wx.ID_ANY, "MiRCART", size=appSize)
|
panelSkin = super().__init__(parent, wx.ID_ANY, "MiRCART", size=appSize)
|
||||||
self.panelCanvas = MiRCARTCanvas(panelSkin, parentFrame=self, \
|
self.panelCanvas = MiRCARTCanvas(panelSkin, parentFrame=self, \
|
||||||
canvasPos=canvasPos, canvasSize=canvasSize, cellSize=cellSize)
|
defaultCanvasPos=defaultCanvasPos, \
|
||||||
|
defaultCanvasSize=defaultCanvasSize, \
|
||||||
|
defaultCellSize=defaultCellSize)
|
||||||
self.panelCanvas.canvasInterface.canvasNew(None)
|
self.panelCanvas.canvasInterface.canvasNew(None)
|
||||||
|
|
||||||
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|
||||||
|
Loading…
Reference in New Issue
Block a user