diff --git a/MiRCARTCanvas.py b/MiRCARTCanvas.py index eef5348..03b3b93 100644 --- a/MiRCARTCanvas.py +++ b/MiRCARTCanvas.py @@ -32,6 +32,7 @@ import wx class MiRCARTCanvas(wx.Panel): """XXX""" parentFrame = None + defaultCanvasPos = defaultCanvasSize = defaultCellSize = None canvasMap = canvasPos = canvasSize = None brushColours = brushPos = brushSize = None canvasBackend = canvasJournal = None @@ -155,17 +156,19 @@ class MiRCARTCanvas(wx.Panel): # }}} # - # _init__(self, parent, parentFrame, canvasPos, canvasSize, cellSize): initialisation method - def __init__(self, parent, parentFrame, canvasPos, canvasSize, cellSize): - super().__init__(parent, pos=canvasPos, \ - size=[w*h for w,h in zip(canvasSize, cellSize)]) + # _init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize): initialisation method + def __init__(self, parent, parentFrame, defaultCanvasPos, defaultCanvasSize, defaultCellSize): + super().__init__(parent, pos=defaultCanvasPos, \ + size=[w*h for w,h in zip(defaultCanvasSize, defaultCellSize)]) 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.parentFrame.onCanvasUpdate( \ brushSize=self.brushSize, colours=self.brushColours) - self.canvasBackend = MiRCARTCanvasBackend(canvasSize, cellSize) + self.canvasBackend = MiRCARTCanvasBackend(defaultCanvasSize, defaultCellSize) self.canvasJournal = MiRCARTCanvasJournal() self.canvasExportStore = MiRCARTCanvasExportStore(parentCanvas=self) self.canvasImportStore = MiRCARTCanvasImportStore(parentCanvas=self) diff --git a/MiRCARTCanvasImportStore.py b/MiRCARTCanvasImportStore.py index 6bce3bf..9dc2c54 100644 --- a/MiRCARTCanvasImportStore.py +++ b/MiRCARTCanvasImportStore.py @@ -137,9 +137,9 @@ class MiRCARTCanvasImportStore(): # }}} # {{{ importNew(self, newCanvasSize=None): XXX def importNew(self, newCanvasSize=None): - newMap = [[[(1, 1), 0, " "] \ - for x in range(self.parentCanvas.canvasSize[0])] \ - for y in range(self.parentCanvas.canvasSize[1])] + newMap = [[[[1, 1], 0, " "] \ + for x in range(newCanvasSize[0])] \ + for y in range(newCanvasSize[1])] self.parentCanvas.onStoreUpdate(newCanvasSize, newMap) # }}} diff --git a/MiRCARTCanvasInterface.py b/MiRCARTCanvasInterface.py index 371adc7..e1b0395 100644 --- a/MiRCARTCanvasInterface.py +++ b/MiRCARTCanvasInterface.py @@ -192,7 +192,7 @@ class MiRCARTCanvasInterface(): self.canvasSave() self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT)) if newCanvasSize == None: - newCanvasSize = (100, 30) + newCanvasSize = list(self.parentCanvas.defaultCanvasSize) self.parentCanvas.canvasImportStore.importNew(newCanvasSize) self.canvasPathName = None self.parentCanvas.SetCursor(wx.Cursor(wx.NullCursor)) diff --git a/MiRCARTFrame.py b/MiRCARTFrame.py index 5ad1732..eab5234 100644 --- a/MiRCARTFrame.py +++ b/MiRCARTFrame.py @@ -203,12 +203,14 @@ class MiRCARTFrame(MiRCARTGeneralFrame): # }}} # - # __init__(self, parent, appSize=(840, 630), canvasPos=(25, 50), canvasSize=(125, 35), cellSize=(7, 14)): initialisation method - def __init__(self, parent, appSize=(840, 630), canvasPos=(25, 50), canvasSize=(125, 35), cellSize=(7, 14)): + # __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(25, 50), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)): initialisation method + def __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(25, 50), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)): self._initPaletteToolBitmaps() panelSkin = super().__init__(parent, wx.ID_ANY, "MiRCART", size=appSize) self.panelCanvas = MiRCARTCanvas(panelSkin, parentFrame=self, \ - canvasPos=canvasPos, canvasSize=canvasSize, cellSize=cellSize) + defaultCanvasPos=defaultCanvasPos, \ + defaultCanvasSize=defaultCanvasSize, \ + defaultCellSize=defaultCellSize) self.panelCanvas.canvasInterface.canvasNew(None) # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120