From c8429b3db28ba22287c1c18f98d7aee361749fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Wed, 4 Sep 2019 11:47:09 +0200 Subject: [PATCH] libgui/GuiCanvasInterface.py: merged from libcanvas/CanvasInterface.py. libgui/GuiCanvasInterfaceAbout.py: split from libgui/GuiCanvasInterface.py. libcanvas/Canvas.py, libgui/GuiFrame.py: updated. assets/text/TODO: updated. --- assets/text/TODO | 23 ++-- libcanvas/Canvas.py | 31 ++--- .../GuiCanvasInterface.py | 56 ++------- libgui/GuiCanvasInterfaceAbout.py | 52 ++++++++ libgui/GuiFrame.py | 111 +++++++++--------- 5 files changed, 136 insertions(+), 137 deletions(-) rename libcanvas/CanvasInterface.py => libgui/GuiCanvasInterface.py (85%) create mode 100644 libgui/GuiCanvasInterfaceAbout.py diff --git a/assets/text/TODO b/assets/text/TODO index 837d06e..ad80458 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -1,17 +1,16 @@ 1) Scrollbar 2) Allow {un,re}doing resizing -3) Don't use ^C, encoding -4) {Copy to,Paste from} clipboard -5) Incremental auto{load,save} & {backup,restore} -6) Open and toggle a reference image in the background -7) Client-Server or Peer-to-Peer realtime collaboration -8) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) -9) Hotkey & graphical interfaces to {composed,parametrised} tools -10) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits -11) Im- and exporting from/to ANSI, Blender, GIF, HTML, mIRC, Pastebin/..., PNG, printer, SAUCE, WEBM, etc. -12) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers -13) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) -14) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools: +3) {Copy to,Paste from} clipboard +4) Incremental auto{load,save} & {backup,restore} +5) Open and toggle a reference image in the background +6) Client-Server or Peer-to-Peer realtime collaboration +7) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) +8) Hotkey & graphical interfaces to {composed,parametrised} tools +9) Layer, layout (e.g. for comics, zines, etc.) & {re,un}do canvas traits +10) Im- and exporting from/to ANSI, Blender, GIF, HTML, mIRC, Pastebin/..., PNG, printer, SAUCE, WEBM, etc. +11) Asset management (e.g. kade, lion, etc.) & traits w/ simple linking & synchronised editing respecting layers +12) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) +13) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools: a) geometric primitives (arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star) b) regions (crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate) c) text (edit, Unicode sets) diff --git a/libcanvas/Canvas.py b/libcanvas/Canvas.py index 7521c8e..743c784 100644 --- a/libcanvas/Canvas.py +++ b/libcanvas/Canvas.py @@ -8,19 +8,11 @@ from CanvasBackend import CanvasBackend from CanvasJournal import CanvasJournal from CanvasExportStore import CanvasExportStore, haveToPngFile, haveUrllib from CanvasImportStore import CanvasImportStore -from CanvasInterface import CanvasInterface from ImgurApiKey import ImgurApiKey import wx class Canvas(wx.Panel): """XXX""" - parentFrame = None - defaultCanvasPos = defaultCanvasSize = defaultCellSize = None - canvasMap = canvasPos = canvasSize = None - brushColours = brushPos = brushSize = None - canvasBackend = canvasJournal = None - canvasExportStore = canvasImportStore = None - canvasInterface = None imgurApiKey = ImgurApiKey.imgurApiKey # {{{ _commitPatch(self, patch): XXX @@ -172,31 +164,28 @@ class Canvas(wx.Panel): # }}} # - # __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)]) + # __init__(self, parent, parentFrame, canvasInterface, defaultCanvasPos, defaultCanvasSize, defaultCellSize): initialisation method + def __init__(self, parent, parentFrame, canvasInterface, defaultCanvasPos, defaultCanvasSize, defaultCellSize): + super().__init__(parent, pos=defaultCanvasPos, size=[w * h for w, h in zip(defaultCanvasSize, defaultCellSize)]) + self.brushColours, self.brushPos, self.brushSize = [4, 1], [0, 0], [1, 1] + self.canvasMap, self.canvasPos, self.canvasSize, = None, defaultCanvasPos, defaultCanvasSize + self.defaultCanvasPos, self.defaultCanvasSize, self.defaultCellSize = defaultCanvasPos, defaultCanvasSize, defaultCellSize self.parentFrame = parentFrame - 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.parentFrame.onCanvasUpdate(brushSize=self.brushSize, colours=self.brushColours) + self.canvasBackend = CanvasBackend(defaultCanvasSize, defaultCellSize) self.canvasJournal = CanvasJournal() self.canvasExportStore = CanvasExportStore(parentCanvas=self) self.canvasImportStore = CanvasImportStore(parentCanvas=self) - self.canvasInterface = CanvasInterface(self, parentFrame) + self.canvasInterface = canvasInterface(self, parentFrame) # Bind event handlers self.Bind(wx.EVT_CLOSE, self.onPanelClose) self.Bind(wx.EVT_ENTER_WINDOW, self.onPanelEnterWindow) self.Bind(wx.EVT_LEAVE_WINDOW, self.onPanelLeaveWindow) self.parentFrame.Bind(wx.EVT_CHAR, self.onPanelInput) - for eventType in( \ - wx.EVT_LEFT_DOWN, wx.EVT_MOTION, wx.EVT_RIGHT_DOWN): + for eventType in (wx.EVT_LEFT_DOWN, wx.EVT_MOTION, wx.EVT_RIGHT_DOWN): self.Bind(eventType, self.onPanelInput) self.Bind(wx.EVT_PAINT, self.onPanelPaint) diff --git a/libcanvas/CanvasInterface.py b/libgui/GuiCanvasInterface.py similarity index 85% rename from libcanvas/CanvasInterface.py rename to libgui/GuiCanvasInterface.py index 55a07ba..9d1e64e 100644 --- a/libcanvas/CanvasInterface.py +++ b/libgui/GuiCanvasInterface.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# CanvasInterface.py -- XXX +# GuiCanvasInterface.py -- XXX # Copyright (c) 2018 Lucio Andrés Illanes Albornoz # @@ -11,56 +11,14 @@ from ToolSelectClone import ToolSelectClone from ToolSelectMove import ToolSelectMove from ToolRect import ToolRect from ToolText import ToolText - + from glob import glob +from GuiCanvasInterfaceAbout import GuiCanvasInterfaceAbout import os, random, wx, wx.adv -class CanvasInterfaceAbout(wx.Dialog): +class GuiCanvasInterface(): """XXX""" - # {{{ onButtonRoar(self, event): XXX - def onButtonRoar(self, event): - self.Destroy() - # }}} - # {{{ __init__(self, parent, size=(320, 240), title="About roar"): XXX - def __init__(self, parent, size=(320, 240), title="About roar"): - super(CanvasInterfaceAbout, self).__init__(parent, size=size, title=title) - self.panel, self.sizer, self.sizerH1, self.sizerH2 = wx.Panel(self), wx.BoxSizer(wx.VERTICAL), wx.BoxSizer(wx.HORIZONTAL), wx.BoxSizer(wx.HORIZONTAL) - - logoPathNames = glob(os.path.join("assets", "images", "logo*.bmp")) - logoPathName = logoPathNames[random.randint(0, len(logoPathNames) - 1)] - self.logo = wx.StaticBitmap(self, -1, wx.Bitmap(logoPathName)) - self.sizerH1.Add(self.logo, 0, wx.CENTER) - - self.title = wx.StaticText(self.panel, label="roar -- mIRC art editor for Windows & Linux (Git revision __ROAR_RELEASE_GIT_SHORT_REV__)\nhttps://www.github.com/lalbornoz/roar/\nCopyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz ", style=wx.ALIGN_CENTER) - self.title.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=False)) - self.sizer.Add(self.title) - - labelsText = ["roar!", "ROAR!", "roaaaaaaar!", "ROAROARAOR", "_ROAR_"] - labelText = labelsText[random.randint(0, len(labelsText) - 1)] - self.buttonRoar = wx.Button(self.panel, label=labelText, pos=(75, 10)) - self.buttonRoar.Bind(wx.EVT_BUTTON, self.onButtonRoar) - self.sizerH2.Add(self.buttonRoar, 0, wx.CENTER) - - self.sizer.Add(self.sizerH1, 0, wx.CENTER) - self.sizer.Add(self.sizerH2, 0, wx.CENTER) - self.SetSizer(self.sizer); self.sizer.Fit(self.panel); - self.SetSize(size); self.SetTitle(title); self.Center(); - - soundBitePathNames = glob(os.path.join("assets", "audio", "roar*.wav")) - soundBitePathName = soundBitePathNames[random.randint(0, len(logoPathNames) - 1)] - self.soundBite = wx.adv.Sound(soundBitePathName) - if self.soundBite.IsOk(): - self.soundBite.Play(wx.adv.SOUND_ASYNC) - - self.ShowModal() - # }}} - -class CanvasInterface(): - """XXX""" - imgurApiKey = None - parentCanvas = parentFrame = canvasPathName = canvasTool = None - # {{{ _dialogSaveChanges(self) def _dialogSaveChanges(self): with wx.MessageDialog(self.parentCanvas, \ @@ -73,7 +31,7 @@ class CanvasInterface(): # {{{ canvasAbout(self, event): XXX def canvasAbout(self, event): - CanvasInterfaceAbout(self.parentFrame) + GuiCanvasInterfaceAbout(self.parentFrame) # }}} # {{{ canvasBrushSolid(self, event): XXX def canvasBrushSolid(self, event): @@ -374,8 +332,8 @@ class CanvasInterface(): # # __init__(self, parentCanvas, parentFrame): def __init__(self, parentCanvas, parentFrame): - self.parentCanvas = parentCanvas; self.parentFrame = parentFrame; - self.canvasPathName = None + self.canvasPathName, self.imgurApiKey = None, None + self.parentCanvas, self.parentFrame = parentCanvas, parentFrame self.canvasToolRect(None) # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libgui/GuiCanvasInterfaceAbout.py b/libgui/GuiCanvasInterfaceAbout.py new file mode 100644 index 0000000..dfad725 --- /dev/null +++ b/libgui/GuiCanvasInterfaceAbout.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# +# GuiCanvasInterfaceAbout.py -- XXX +# Copyright (c) 2018 Lucio Andrés Illanes Albornoz +# + +from glob import glob +import os, random, wx, wx.adv + +class GuiCanvasInterfaceAbout(wx.Dialog): + """XXX""" + + # {{{ onButtonRoar(self, event): XXX + def onButtonRoar(self, event): + self.Destroy() + # }}} + + # + # __init__(self, parent, size=(320, 240), title="About roar"): XXX + def __init__(self, parent, size=(320, 240), title="About roar"): + super(GuiCanvasInterfaceAbout, self).__init__(parent, size=size, title=title) + self.panel, self.sizer, self.sizerH1, self.sizerH2 = wx.Panel(self), wx.BoxSizer(wx.VERTICAL), wx.BoxSizer(wx.HORIZONTAL), wx.BoxSizer(wx.HORIZONTAL) + + logoPathNames = glob(os.path.join("assets", "images", "logo*.bmp")) + logoPathName = logoPathNames[random.randint(0, len(logoPathNames) - 1)] + self.logo = wx.StaticBitmap(self, -1, wx.Bitmap(logoPathName)) + self.sizerH1.Add(self.logo, 0, wx.CENTER) + + self.title = wx.StaticText(self.panel, label="roar -- mIRC art editor for Windows & Linux (Git revision __ROAR_RELEASE_GIT_SHORT_REV__)\nhttps://www.github.com/lalbornoz/roar/\nCopyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz ", style=wx.ALIGN_CENTER) + self.title.SetFont(wx.Font(8, wx.DEFAULT, wx.NORMAL, wx.NORMAL, underline=False)) + self.sizer.Add(self.title) + + labelsText = ["roar!", "ROAR!", "roaaaaaaar!", "ROAROARAOR", "_ROAR_"] + labelText = labelsText[random.randint(0, len(labelsText) - 1)] + self.buttonRoar = wx.Button(self.panel, label=labelText, pos=(75, 10)) + self.buttonRoar.Bind(wx.EVT_BUTTON, self.onButtonRoar) + self.sizerH2.Add(self.buttonRoar, 0, wx.CENTER) + + self.sizer.Add(self.sizerH1, 0, wx.CENTER) + self.sizer.Add(self.sizerH2, 0, wx.CENTER) + self.SetSizer(self.sizer); self.sizer.Fit(self.panel); + self.SetSize(size); self.SetTitle(title); self.Center(); + + soundBitePathNames = glob(os.path.join("assets", "audio", "roar*.wav")) + soundBitePathName = soundBitePathNames[random.randint(0, len(logoPathNames) - 1)] + self.soundBite = wx.adv.Sound(soundBitePathName) + if self.soundBite.IsOk(): + self.soundBite.Play(wx.adv.SOUND_ASYNC) + + self.ShowModal() + +# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libgui/GuiFrame.py b/libgui/GuiFrame.py index a1f4bab..5dd9c9d 100644 --- a/libgui/GuiFrame.py +++ b/libgui/GuiFrame.py @@ -5,8 +5,8 @@ # from Canvas import Canvas, haveUrllib -from CanvasInterface import CanvasInterface from Colours import Colours +from GuiCanvasInterface import GuiCanvasInterface from GuiGeneralFrame import GuiGeneralFrame, \ TID_ACCELS, TID_COMMAND, TID_LIST, TID_MENU, TID_NOTHING, TID_SELECT, TID_TOOLBAR, \ NID_MENU_SEP, NID_TOOLBAR_HSEP, NID_TOOLBAR_VSEP @@ -20,75 +20,75 @@ class GuiFrame(GuiGeneralFrame): # {{{ Commands # Id Type Id Labels Icon bitmap Accelerator [Initial state] - CID_NEW = [0x100, TID_COMMAND, "New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None, CanvasInterface.canvasNew] - CID_OPEN = [0x101, TID_COMMAND, "Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None, CanvasInterface.canvasOpen] - CID_SAVE = [0x102, TID_COMMAND, "Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None, CanvasInterface.canvasSave] - CID_SAVEAS = [0x103, TID_COMMAND, "Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None, CanvasInterface.canvasSaveAs] + CID_NEW = [0x100, TID_COMMAND, "New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None, GuiCanvasInterface.canvasNew] + CID_OPEN = [0x101, TID_COMMAND, "Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None, GuiCanvasInterface.canvasOpen] + CID_SAVE = [0x102, TID_COMMAND, "Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None, GuiCanvasInterface.canvasSave] + CID_SAVEAS = [0x103, TID_COMMAND, "Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None, GuiCanvasInterface.canvasSaveAs] CID_EXPORT_AS_PNG = [0x104, TID_COMMAND, "Export as PNG...", \ - "Export as PN&G...", None, None, None, CanvasInterface.canvasExportAsPng] + "Export as PN&G...", None, None, None, GuiCanvasInterface.canvasExportAsPng] CID_EXPORT_IMGUR = [0x105, TID_COMMAND, "Export to Imgur...", \ - "Export to I&mgur...", None, None, haveUrllib, CanvasInterface.canvasExportImgur] + "Export to I&mgur...", None, None, haveUrllib, GuiCanvasInterface.canvasExportImgur] CID_EXPORT_PASTEBIN = [0x106, TID_COMMAND, "Export to Pastebin...", \ - "Export to Pasteb&in...", None, None, haveUrllib, CanvasInterface.canvasExportPastebin] - CID_EXIT = [0x107, TID_COMMAND, "Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None, CanvasInterface.canvasExit] - CID_UNDO = [0x108, TID_COMMAND, "Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False, CanvasInterface.canvasUndo] - CID_REDO = [0x109, TID_COMMAND, "Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False, CanvasInterface.canvasRedo] - CID_CUT = [0x10a, TID_COMMAND, "Cut", "Cu&t", ["", wx.ART_CUT], None, False, CanvasInterface.canvasCut] - CID_COPY = [0x10b, TID_COMMAND, "Copy", "&Copy", ["", wx.ART_COPY], None, False, CanvasInterface.canvasCopy] - CID_PASTE = [0x10c, TID_COMMAND, "Paste", "&Paste", ["", wx.ART_PASTE], None, False, CanvasInterface.canvasPaste] - CID_DELETE = [0x10d, TID_COMMAND, "Delete", "De&lete", ["", wx.ART_DELETE], None, False, CanvasInterface.canvasDelete] + "Export to Pasteb&in...", None, None, haveUrllib, GuiCanvasInterface.canvasExportPastebin] + CID_EXIT = [0x107, TID_COMMAND, "Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None, GuiCanvasInterface.canvasExit] + CID_UNDO = [0x108, TID_COMMAND, "Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False, GuiCanvasInterface.canvasUndo] + CID_REDO = [0x109, TID_COMMAND, "Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False, GuiCanvasInterface.canvasRedo] + CID_CUT = [0x10a, TID_COMMAND, "Cut", "Cu&t", ["", wx.ART_CUT], None, False, GuiCanvasInterface.canvasCut] + CID_COPY = [0x10b, TID_COMMAND, "Copy", "&Copy", ["", wx.ART_COPY], None, False, GuiCanvasInterface.canvasCopy] + CID_PASTE = [0x10c, TID_COMMAND, "Paste", "&Paste", ["", wx.ART_PASTE], None, False, GuiCanvasInterface.canvasPaste] + CID_DELETE = [0x10d, TID_COMMAND, "Delete", "De&lete", ["", wx.ART_DELETE], None, False, GuiCanvasInterface.canvasDelete] CID_INCRW_CANVAS = [0x10e, TID_COMMAND, "Increase canvas width", \ - "Increase canvas width", ["toolIncrCanvasW.png"], None, None, CanvasInterface.canvasIncrCanvasWidth] + "Increase canvas width", ["toolIncrCanvasW.png"], None, None, GuiCanvasInterface.canvasIncrCanvasWidth] CID_DECRW_CANVAS = [0x10f, TID_COMMAND, "Decrease canvas width", \ - "Decrease canvas width", ["toolDecrCanvasW.png"], None, None, CanvasInterface.canvasDecrCanvasWidth] + "Decrease canvas width", ["toolDecrCanvasW.png"], None, None, GuiCanvasInterface.canvasDecrCanvasWidth] CID_INCRH_CANVAS = [0x110, TID_COMMAND, "Increase canvas height", \ - "Increase canvas height", ["toolIncrCanvasH.png"], None, None, CanvasInterface.canvasIncrCanvasHeight] + "Increase canvas height", ["toolIncrCanvasH.png"], None, None, GuiCanvasInterface.canvasIncrCanvasHeight] CID_DECRH_CANVAS = [0x111, TID_COMMAND, "Decrease canvas height", \ - "Decrease canvas height", ["toolDecrCanvasH.png"], None, None, CanvasInterface.canvasDecrCanvasHeight] + "Decrease canvas height", ["toolDecrCanvasH.png"], None, None, GuiCanvasInterface.canvasDecrCanvasHeight] CID_INCRHW_CANVAS = [0x112, TID_COMMAND, "Increase canvas size", \ - "Increase canvas size", ["toolIncrCanvasHW.png"], None, None, CanvasInterface.canvasIncrCanvasHeightWidth] + "Increase canvas size", ["toolIncrCanvasHW.png"], None, None, GuiCanvasInterface.canvasIncrCanvasHeightWidth] CID_DECRHW_CANVAS = [0x113, TID_COMMAND, "Decrease canvas size", \ - "Decrease canvas size", ["toolDecrCanvasHW.png"], None, None, CanvasInterface.canvasDecrCanvasHeightWidth] + "Decrease canvas size", ["toolDecrCanvasHW.png"], None, None, GuiCanvasInterface.canvasDecrCanvasHeightWidth] CID_INCRW_BRUSH = [0x114, TID_COMMAND, "Increase brush width", \ - "Increase brush width", ["toolIncrBrushW.png"], None, None, CanvasInterface.canvasIncrBrushWidth] + "Increase brush width", ["toolIncrBrushW.png"], None, None, GuiCanvasInterface.canvasIncrBrushWidth] CID_DECRW_BRUSH = [0x115, TID_COMMAND, "Decrease brush width", \ - "Decrease brush width", ["toolDecrBrushW.png"], None, None, CanvasInterface.canvasDecrBrushWidth] + "Decrease brush width", ["toolDecrBrushW.png"], None, None, GuiCanvasInterface.canvasDecrBrushWidth] CID_INCRH_BRUSH = [0x116, TID_COMMAND, "Increase brush height", \ - "Increase brush height", ["toolIncrBrushH.png"], None, None, CanvasInterface.canvasIncrBrushHeight] + "Increase brush height", ["toolIncrBrushH.png"], None, None, GuiCanvasInterface.canvasIncrBrushHeight] CID_DECRH_BRUSH = [0x117, TID_COMMAND, "Decrease brush height", \ - "Decrease brush height", ["toolDecrBrushH.png"], None, None, CanvasInterface.canvasDecrBrushHeight] + "Decrease brush height", ["toolDecrBrushH.png"], None, None, GuiCanvasInterface.canvasDecrBrushHeight] CID_INCRHW_BRUSH = [0x118, TID_COMMAND, "Increase brush size", \ - "Increase brush size", ["toolIncrBrushHW.png"], None, None, CanvasInterface.canvasIncrBrushHeightWidth] + "Increase brush size", ["toolIncrBrushHW.png"], None, None, GuiCanvasInterface.canvasIncrBrushHeightWidth] CID_DECRHW_BRUSH = [0x119, TID_COMMAND, "Decrease brush size", \ - "Decrease brush size", ["toolDecrBrushHW.png"], None, None, CanvasInterface.canvasDecrBrushHeightWidth] - CID_SOLID_BRUSH = [0x11a, TID_SELECT, "Solid brush", "Solid brush", None, None, True, CanvasInterface.canvasBrushSolid] + "Decrease brush size", ["toolDecrBrushHW.png"], None, None, GuiCanvasInterface.canvasDecrBrushHeightWidth] + CID_SOLID_BRUSH = [0x11a, TID_SELECT, "Solid brush", "Solid brush", None, None, True, GuiCanvasInterface.canvasBrushSolid] - CID_RECT = [0x150, TID_SELECT, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True, CanvasInterface.canvasToolRect] - CID_CIRCLE = [0x151, TID_SELECT, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False, CanvasInterface.canvasToolCircle] - CID_FILL = [0x152, TID_SELECT, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False, CanvasInterface.canvasToolFill] - CID_LINE = [0x153, TID_SELECT, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False, CanvasInterface.canvasToolLine] - CID_TEXT = [0x154, TID_SELECT, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False, CanvasInterface.canvasToolText] - CID_CLONE_SELECT = [0x155, TID_SELECT, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False, CanvasInterface.canvasToolSelectClone] - CID_MOVE_SELECT = [0x156, TID_SELECT, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False, CanvasInterface.canvasToolSelectMove] + CID_RECT = [0x150, TID_SELECT, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True, GuiCanvasInterface.canvasToolRect] + CID_CIRCLE = [0x151, TID_SELECT, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False, GuiCanvasInterface.canvasToolCircle] + CID_FILL = [0x152, TID_SELECT, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False, GuiCanvasInterface.canvasToolFill] + CID_LINE = [0x153, TID_SELECT, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False, GuiCanvasInterface.canvasToolLine] + CID_TEXT = [0x154, TID_SELECT, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False, GuiCanvasInterface.canvasToolText] + CID_CLONE_SELECT = [0x155, TID_SELECT, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False, GuiCanvasInterface.canvasToolSelectClone] + CID_MOVE_SELECT = [0x156, TID_SELECT, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False, GuiCanvasInterface.canvasToolSelectMove] - CID_COLOUR00 = [0x1a0, TID_SELECT, "Colour #00", "Colour #00", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, True, CanvasInterface.canvasColour] - CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, CanvasInterface.canvasColour] - CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", None, None, False, CanvasInterface.canvasColour] + CID_COLOUR00 = [0x1a0, TID_SELECT, "Colour #00", "Colour #00", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR01 = [0x1a1, TID_SELECT, "Colour #01", "Colour #01", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR02 = [0x1a2, TID_SELECT, "Colour #02", "Colour #02", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR03 = [0x1a3, TID_SELECT, "Colour #03", "Colour #03", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR04 = [0x1a4, TID_SELECT, "Colour #04", "Colour #04", None, None, True, GuiCanvasInterface.canvasColour] + CID_COLOUR05 = [0x1a5, TID_SELECT, "Colour #05", "Colour #05", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR06 = [0x1a6, TID_SELECT, "Colour #06", "Colour #06", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR07 = [0x1a7, TID_SELECT, "Colour #07", "Colour #07", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR08 = [0x1a8, TID_SELECT, "Colour #08", "Colour #08", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR09 = [0x1a9, TID_SELECT, "Colour #09", "Colour #09", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR10 = [0x1aa, TID_SELECT, "Colour #10", "Colour #10", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR11 = [0x1ab, TID_SELECT, "Colour #11", "Colour #11", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR12 = [0x1ac, TID_SELECT, "Colour #12", "Colour #12", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR13 = [0x1ad, TID_SELECT, "Colour #13", "Colour #13", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR14 = [0x1ae, TID_SELECT, "Colour #14", "Colour #14", None, None, False, GuiCanvasInterface.canvasColour] + CID_COLOUR15 = [0x1af, TID_SELECT, "Colour #15", "Colour #15", None, None, False, GuiCanvasInterface.canvasColour] - CID_ABOUT = [0x1b0, TID_COMMAND, "About", "&About", None, None, True, CanvasInterface.canvasAbout] + CID_ABOUT = [0x1b0, TID_COMMAND, "About", "&About", None, None, True, GuiCanvasInterface.canvasAbout] # }}} # {{{ Menus MID_FILE = (0x300, TID_MENU, "File", "&File", ( \ @@ -225,9 +225,10 @@ class GuiFrame(GuiGeneralFrame): def __init__(self, parent, appSize=(840, 630), defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14)): self._initPaletteToolBitmaps() self.panelSkin = super().__init__(parent, wx.ID_ANY, "", size=appSize) - self.panelCanvas = Canvas(self.panelSkin, parentFrame=self, \ - defaultCanvasPos=defaultCanvasPos, \ - defaultCanvasSize=defaultCanvasSize, \ + self.panelCanvas = Canvas(self.panelSkin, parentFrame=self, \ + canvasInterface=GuiCanvasInterface, \ + defaultCanvasPos=defaultCanvasPos, \ + defaultCanvasSize=defaultCanvasSize, \ defaultCellSize=defaultCellSize) self.panelCanvas.canvasInterface.canvasNew(None) self.sizerSkin.AddSpacer(5)