mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 23:36:36 +00:00
libroar/RoarCanvasInterface.py, libgui/GuiCanvasInterface.py: split from libgui/GuiCanvasInterface.py.
libroar/RoarClientAboutWindow.py: merged from libgui/GuiCanvasInterfaceAbout.py. libgui/GuiFrame.py:Gui{Command{,List},Select}Decorator(): moved from libroar/RoarCanvasInterface.py. libroar/RoarClient.py: updated.
This commit is contained in:
parent
0aceb126f3
commit
41e070803a
@ -6,6 +6,40 @@
|
|||||||
|
|
||||||
import os, sys, wx
|
import os, sys, wx
|
||||||
|
|
||||||
|
#
|
||||||
|
# Decorators
|
||||||
|
# {{{ GuiCommandDecorator(targetObject)
|
||||||
|
def GuiCommandDecorator(caption, label, icon, accel, initialState):
|
||||||
|
def GuiCommandDecoratorOuter(targetObject):
|
||||||
|
if callable(targetObject):
|
||||||
|
if not hasattr(targetObject, "attrDict"):
|
||||||
|
setattr(targetObject, "attrDict", [])
|
||||||
|
targetObject.attrDict = {"caption": caption, "label": label, "icon": icon, "accel": accel, "initialState": initialState, "id": None}
|
||||||
|
return targetObject
|
||||||
|
return GuiCommandDecoratorOuter
|
||||||
|
# }}}
|
||||||
|
# {{{ GuiCommandListDecorator(targetObject)
|
||||||
|
def GuiCommandListDecorator(idx, caption, label, icon, accel, initialState):
|
||||||
|
def GuiCommandListDecoratorOuter(targetObject):
|
||||||
|
if callable(targetObject):
|
||||||
|
if not hasattr(targetObject, "attrList"):
|
||||||
|
setattr(targetObject, "attrList", [])
|
||||||
|
targetObject.attrList.insert(0, {"caption": caption, "label": label, "icon": icon, "accel": accel, "initialState": initialState, "id": None, "idx": idx})
|
||||||
|
return targetObject
|
||||||
|
return GuiCommandListDecoratorOuter
|
||||||
|
# }}}
|
||||||
|
# {{{ GuiSelectDecorator(targetObject)
|
||||||
|
def GuiSelectDecorator(idx, caption, label, icon, accel, initialState):
|
||||||
|
def GuiSelectDecoratorOuter(targetObject):
|
||||||
|
if callable(targetObject):
|
||||||
|
if not hasattr(targetObject, "attrList"):
|
||||||
|
setattr(targetObject, "attrList", [])
|
||||||
|
setattr(targetObject, "isSelect", True)
|
||||||
|
targetObject.attrList.insert(0, {"caption": caption, "label": label, "icon": icon, "accel": accel, "initialState": initialState, "id": None, "idx": idx})
|
||||||
|
return targetObject
|
||||||
|
return GuiSelectDecoratorOuter
|
||||||
|
# }}}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Non-items (0xf000-0xffff)
|
# Non-items (0xf000-0xffff)
|
||||||
NID_MENU_SEP = 0xf000
|
NID_MENU_SEP = 0xf000
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# GuiCanvasInterface.py
|
# RoarCanvasInterface.py
|
||||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -25,11 +25,11 @@ from ToolSelectMove import ToolSelectMove
|
|||||||
from ToolText import ToolText
|
from ToolText import ToolText
|
||||||
|
|
||||||
from GuiCanvasColours import Colours
|
from GuiCanvasColours import Colours
|
||||||
from GuiCanvasInterfaceAbout import GuiCanvasInterfaceAbout
|
from GuiFrame import GuiCommandDecorator, GuiCommandListDecorator, GuiSelectDecorator, NID_MENU_SEP, NID_TOOLBAR_HSEP
|
||||||
from GuiFrame import NID_MENU_SEP, NID_TOOLBAR_HSEP
|
from RoarClientAboutWindow import RoarClientAboutWindow
|
||||||
import io, os, sys, wx
|
import io, os, sys, wx
|
||||||
|
|
||||||
class GuiCanvasInterface():
|
class RoarCanvasInterface():
|
||||||
# {{{ _import(self, f, newDirty, pathName)
|
# {{{ _import(self, f, newDirty, pathName)
|
||||||
def _import(self, f, newDirty, pathName):
|
def _import(self, f, newDirty, pathName):
|
||||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||||
@ -98,45 +98,13 @@ class GuiCanvasInterface():
|
|||||||
return True
|
return True
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# {{{ CommandDecoratorOuter(targetObject)
|
|
||||||
def CommandDecorator(caption, label, icon, accel, initialState):
|
|
||||||
def CommandDecoratorOuter(targetObject):
|
|
||||||
if callable(targetObject):
|
|
||||||
if not hasattr(targetObject, "attrDict"):
|
|
||||||
setattr(targetObject, "attrDict", [])
|
|
||||||
targetObject.attrDict = {"caption": caption, "label": label, "icon": icon, "accel": accel, "initialState": initialState, "id": None}
|
|
||||||
return targetObject
|
|
||||||
return CommandDecoratorOuter
|
|
||||||
# }}}
|
|
||||||
# {{{ CommandListDecoratorOuter(targetObject)
|
|
||||||
def CommandListDecorator(idx, caption, label, icon, accel, initialState):
|
|
||||||
def CommandListDecoratorOuter(targetObject):
|
|
||||||
if callable(targetObject):
|
|
||||||
if not hasattr(targetObject, "attrList"):
|
|
||||||
setattr(targetObject, "attrList", [])
|
|
||||||
targetObject.attrList.insert(0, {"caption": caption, "label": label, "icon": icon, "accel": accel, "initialState": initialState, "id": None, "idx": idx})
|
|
||||||
return targetObject
|
|
||||||
return CommandListDecoratorOuter
|
|
||||||
# }}}
|
|
||||||
# {{{ SelectDecoratorOuter(targetObject)
|
|
||||||
def SelectDecorator(idx, caption, label, icon, accel, initialState):
|
|
||||||
def SelectDecoratorOuter(targetObject):
|
|
||||||
if callable(targetObject):
|
|
||||||
if not hasattr(targetObject, "attrList"):
|
|
||||||
setattr(targetObject, "attrList", [])
|
|
||||||
setattr(targetObject, "isSelect", True)
|
|
||||||
targetObject.attrList.insert(0, {"caption": caption, "label": label, "icon": icon, "accel": accel, "initialState": initialState, "id": None, "idx": idx})
|
|
||||||
return targetObject
|
|
||||||
return SelectDecoratorOuter
|
|
||||||
# }}}
|
|
||||||
|
|
||||||
# {{{ canvasAbout(self, event)
|
# {{{ canvasAbout(self, event)
|
||||||
@CommandDecorator("About", "&About", None, None, True)
|
@GuiCommandDecorator("About", "&About", None, None, True)
|
||||||
def canvasAbout(self, event):
|
def canvasAbout(self, event):
|
||||||
GuiCanvasInterfaceAbout(self.parentFrame)
|
RoarClientAboutWindow(self.parentFrame)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasBrush(self, f, idx)
|
# {{{ canvasBrush(self, f, idx)
|
||||||
@SelectDecorator(0, "Solid brush", "Solid brush", None, None, True)
|
@GuiSelectDecorator(0, "Solid brush", "Solid brush", None, None, True)
|
||||||
def canvasBrush(self, f, idx):
|
def canvasBrush(self, f, idx):
|
||||||
def canvasBrush_(self, event):
|
def canvasBrush_(self, event):
|
||||||
pass
|
pass
|
||||||
@ -145,22 +113,22 @@ class GuiCanvasInterface():
|
|||||||
return canvasBrush_
|
return canvasBrush_
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasColour(self, f, idx)
|
# {{{ canvasColour(self, f, idx)
|
||||||
@SelectDecorator(0, "Colour #00", "Colour #00 (Bright White)", None, None, False)
|
@GuiSelectDecorator(0, "Colour #00", "Colour #00 (Bright White)", None, None, False)
|
||||||
@SelectDecorator(1, "Colour #01", "Colour #01 (Black)", None, None, False)
|
@GuiSelectDecorator(1, "Colour #01", "Colour #01 (Black)", None, None, False)
|
||||||
@SelectDecorator(2, "Colour #02", "Colour #02 (Blue)", None, None, False)
|
@GuiSelectDecorator(2, "Colour #02", "Colour #02 (Blue)", None, None, False)
|
||||||
@SelectDecorator(3, "Colour #03", "Colour #03 (Green)", None, None, False)
|
@GuiSelectDecorator(3, "Colour #03", "Colour #03 (Green)", None, None, False)
|
||||||
@SelectDecorator(4, "Colour #04", "Colour #04 (Red)", None, None, False)
|
@GuiSelectDecorator(4, "Colour #04", "Colour #04 (Red)", None, None, False)
|
||||||
@SelectDecorator(5, "Colour #05", "Colour #05 (Light Red)", None, None, False)
|
@GuiSelectDecorator(5, "Colour #05", "Colour #05 (Light Red)", None, None, False)
|
||||||
@SelectDecorator(6, "Colour #06", "Colour #06 (Pink)", None, None, False)
|
@GuiSelectDecorator(6, "Colour #06", "Colour #06 (Pink)", None, None, False)
|
||||||
@SelectDecorator(7, "Colour #07", "Colour #07 (Yellow)", None, None, False)
|
@GuiSelectDecorator(7, "Colour #07", "Colour #07 (Yellow)", None, None, False)
|
||||||
@SelectDecorator(8, "Colour #08", "Colour #08 (Light Yellow)", None, None, False)
|
@GuiSelectDecorator(8, "Colour #08", "Colour #08 (Light Yellow)", None, None, False)
|
||||||
@SelectDecorator(9, "Colour #09", "Colour #09 (Light Green)", None, None, False)
|
@GuiSelectDecorator(9, "Colour #09", "Colour #09 (Light Green)", None, None, False)
|
||||||
@SelectDecorator(10, "Colour #10", "Colour #10 (Cyan)", None, None, False)
|
@GuiSelectDecorator(10, "Colour #10", "Colour #10 (Cyan)", None, None, False)
|
||||||
@SelectDecorator(11, "Colour #11", "Colour #11 (Light Cyan)", None, None, False)
|
@GuiSelectDecorator(11, "Colour #11", "Colour #11 (Light Cyan)", None, None, False)
|
||||||
@SelectDecorator(12, "Colour #12", "Colour #12 (Light Blue)", None, None, False)
|
@GuiSelectDecorator(12, "Colour #12", "Colour #12 (Light Blue)", None, None, False)
|
||||||
@SelectDecorator(13, "Colour #13", "Colour #13 (Light Pink)", None, None, False)
|
@GuiSelectDecorator(13, "Colour #13", "Colour #13 (Light Pink)", None, None, False)
|
||||||
@SelectDecorator(14, "Colour #14", "Colour #14 (Grey)", None, None, False)
|
@GuiSelectDecorator(14, "Colour #14", "Colour #14 (Grey)", None, None, False)
|
||||||
@SelectDecorator(15, "Colour #15", "Colour #15 (Light Grey)", None, None, False)
|
@GuiSelectDecorator(15, "Colour #15", "Colour #15 (Light Grey)", None, None, False)
|
||||||
def canvasColour(self, f, idx):
|
def canvasColour(self, f, idx):
|
||||||
def canvasColour_(self, event):
|
def canvasColour_(self, event):
|
||||||
if event.GetEventType() == wx.wxEVT_TOOL:
|
if event.GetEventType() == wx.wxEVT_TOOL:
|
||||||
@ -173,7 +141,7 @@ class GuiCanvasInterface():
|
|||||||
return canvasColour_
|
return canvasColour_
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasColourAlpha(self, f, idx)
|
# {{{ canvasColourAlpha(self, f, idx)
|
||||||
@SelectDecorator(0, "Transparent colour", "Transparent colour", None, None, False)
|
@GuiSelectDecorator(0, "Transparent colour", "Transparent colour", None, None, False)
|
||||||
def canvasColourAlpha(self, f, idx):
|
def canvasColourAlpha(self, f, idx):
|
||||||
def canvasColourAlpha_(self, event):
|
def canvasColourAlpha_(self, event):
|
||||||
if event.GetEventType() == wx.wxEVT_TOOL:
|
if event.GetEventType() == wx.wxEVT_TOOL:
|
||||||
@ -186,28 +154,28 @@ class GuiCanvasInterface():
|
|||||||
return canvasColourAlpha_
|
return canvasColourAlpha_
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasCopy(self, event)
|
# {{{ canvasCopy(self, event)
|
||||||
@CommandDecorator("Copy", "&Copy", ["", wx.ART_COPY], None, False)
|
@GuiCommandDecorator("Copy", "&Copy", ["", wx.ART_COPY], None, False)
|
||||||
def canvasCopy(self, event):
|
def canvasCopy(self, event):
|
||||||
pass
|
pass
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasCut(self, event)
|
# {{{ canvasCut(self, event)
|
||||||
@CommandDecorator("Cut", "Cu&t", ["", wx.ART_CUT], None, False)
|
@GuiCommandDecorator("Cut", "Cu&t", ["", wx.ART_CUT], None, False)
|
||||||
def canvasCut(self, event):
|
def canvasCut(self, event):
|
||||||
pass
|
pass
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasDelete(self, event)
|
# {{{ canvasDelete(self, event)
|
||||||
@CommandDecorator("Delete", "De&lete", ["", wx.ART_DELETE], None, False)
|
@GuiCommandDecorator("Delete", "De&lete", ["", wx.ART_DELETE], None, False)
|
||||||
def canvasDelete(self, event):
|
def canvasDelete(self, event):
|
||||||
pass
|
pass
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasExit(self, event)
|
# {{{ canvasExit(self, event)
|
||||||
@CommandDecorator("Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None)
|
@GuiCommandDecorator("Exit", "E&xit", None, [wx.ACCEL_CTRL, ord("X")], None)
|
||||||
def canvasExit(self, event):
|
def canvasExit(self, event):
|
||||||
if self._promptSaveChanges():
|
if self._promptSaveChanges():
|
||||||
self.parentFrame.Close(True)
|
self.parentFrame.Close(True)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasNew(self, event, newCanvasSize=None)
|
# {{{ canvasNew(self, event, newCanvasSize=None)
|
||||||
@CommandDecorator("New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None)
|
@GuiCommandDecorator("New", "&New", ["", wx.ART_NEW], [wx.ACCEL_CTRL, ord("N")], None)
|
||||||
def canvasNew(self, event, newCanvasSize=None):
|
def canvasNew(self, event, newCanvasSize=None):
|
||||||
def canvasImportEmpty(pathName):
|
def canvasImportEmpty(pathName):
|
||||||
nonlocal newCanvasSize
|
nonlocal newCanvasSize
|
||||||
@ -219,7 +187,7 @@ class GuiCanvasInterface():
|
|||||||
self._import(canvasImportEmpty, False, None)
|
self._import(canvasImportEmpty, False, None)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasOpen(self, event)
|
# {{{ canvasOpen(self, event)
|
||||||
@CommandDecorator("Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None)
|
@GuiCommandDecorator("Open", "&Open", ["", wx.ART_FILE_OPEN], [wx.ACCEL_CTRL, ord("O")], None)
|
||||||
def canvasOpen(self, event):
|
def canvasOpen(self, event):
|
||||||
def canvasImportmIRC(pathName):
|
def canvasImportmIRC(pathName):
|
||||||
rc, error = self.parentCanvas.canvas.importStore.importTextFile(pathName)
|
rc, error = self.parentCanvas.canvas.importStore.importTextFile(pathName)
|
||||||
@ -227,18 +195,18 @@ class GuiCanvasInterface():
|
|||||||
self._importFile(canvasImportmIRC, False, "mIRC art files (*.txt)|*.txt|All Files (*.*)|*.*")
|
self._importFile(canvasImportmIRC, False, "mIRC art files (*.txt)|*.txt|All Files (*.*)|*.*")
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasPaste(self, event)
|
# {{{ canvasPaste(self, event)
|
||||||
@CommandDecorator("Paste", "&Paste", ["", wx.ART_PASTE], None, False)
|
@GuiCommandDecorator("Paste", "&Paste", ["", wx.ART_PASTE], None, False)
|
||||||
def canvasPaste(self, event):
|
def canvasPaste(self, event):
|
||||||
pass
|
pass
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasRedo(self, event)
|
# {{{ canvasRedo(self, event)
|
||||||
@CommandDecorator("Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False)
|
@GuiCommandDecorator("Redo", "&Redo", ["", wx.ART_REDO], [wx.ACCEL_CTRL, ord("Y")], False)
|
||||||
def canvasRedo(self, event):
|
def canvasRedo(self, event):
|
||||||
self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popRedo())
|
self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popRedo())
|
||||||
self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel)
|
self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasSave(self, event)
|
# {{{ canvasSave(self, event)
|
||||||
@CommandDecorator("Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None)
|
@GuiCommandDecorator("Save", "&Save", ["", wx.ART_FILE_SAVE], [wx.ACCEL_CTRL, ord("S")], None)
|
||||||
def canvasSave(self, event):
|
def canvasSave(self, event):
|
||||||
if self.canvasPathName == None:
|
if self.canvasPathName == None:
|
||||||
if self.canvasSaveAs(event) == False:
|
if self.canvasSaveAs(event) == False:
|
||||||
@ -255,7 +223,7 @@ class GuiCanvasInterface():
|
|||||||
return False
|
return False
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasSaveAs(self, event)
|
# {{{ canvasSaveAs(self, event)
|
||||||
@CommandDecorator("Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None)
|
@GuiCommandDecorator("Save As...", "Save &As...", ["", wx.ART_FILE_SAVE_AS], None, None)
|
||||||
def canvasSaveAs(self, event):
|
def canvasSaveAs(self, event):
|
||||||
with wx.FileDialog(self.parentCanvas, "Save As", os.getcwd(), "", "mIRC art files (*.txt)|*.txt|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
with wx.FileDialog(self.parentCanvas, "Save As", os.getcwd(), "", "mIRC art files (*.txt)|*.txt|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
||||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||||
@ -265,19 +233,19 @@ class GuiCanvasInterface():
|
|||||||
return self.canvasSave(event)
|
return self.canvasSave(event)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasUndo(self, event)
|
# {{{ canvasUndo(self, event)
|
||||||
@CommandDecorator("Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False)
|
@GuiCommandDecorator("Undo", "&Undo", ["", wx.ART_UNDO], [wx.ACCEL_CTRL, ord("Z")], False)
|
||||||
def canvasUndo(self, event):
|
def canvasUndo(self, event):
|
||||||
self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popUndo())
|
self.parentCanvas.dispatchDeltaPatches(self.parentCanvas.canvas.journal.popUndo())
|
||||||
self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel)
|
self.update(size=self.parentCanvas.canvas.size, undoLevel=self.parentCanvas.canvas.journal.patchesUndoLevel)
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# {{{ canvasBrushSize(self, f, dimension, incrFlag)
|
# {{{ canvasBrushSize(self, f, dimension, incrFlag)
|
||||||
@CommandListDecorator(0, "Decrease brush width", "Decrease brush width", ["toolDecrBrushW.png"], None, None)
|
@GuiCommandListDecorator(0, "Decrease brush width", "Decrease brush width", ["toolDecrBrushW.png"], None, None)
|
||||||
@CommandListDecorator(1, "Decrease brush height", "Decrease brush height", ["toolDecrBrushH.png"], None, None)
|
@GuiCommandListDecorator(1, "Decrease brush height", "Decrease brush height", ["toolDecrBrushH.png"], None, None)
|
||||||
@CommandListDecorator(2, "Decrease brush size", "Decrease brush size", ["toolDecrBrushHW.png"], None, None)
|
@GuiCommandListDecorator(2, "Decrease brush size", "Decrease brush size", ["toolDecrBrushHW.png"], None, None)
|
||||||
@CommandListDecorator(3, "Increase brush width", "Increase brush width", ["toolIncrBrushW.png"], None, None)
|
@GuiCommandListDecorator(3, "Increase brush width", "Increase brush width", ["toolIncrBrushW.png"], None, None)
|
||||||
@CommandListDecorator(4, "Increase brush height", "Increase brush height", ["toolIncrBrushH.png"], None, None)
|
@GuiCommandListDecorator(4, "Increase brush height", "Increase brush height", ["toolIncrBrushH.png"], None, None)
|
||||||
@CommandListDecorator(5, "Increase brush size", "Increase brush size", ["toolIncrBrushHW.png"], None, None)
|
@GuiCommandListDecorator(5, "Increase brush size", "Increase brush size", ["toolIncrBrushHW.png"], None, None)
|
||||||
def canvasBrushSize(self, f, dimension, incrFlag):
|
def canvasBrushSize(self, f, dimension, incrFlag):
|
||||||
def canvasBrushSize_(self, event):
|
def canvasBrushSize_(self, event):
|
||||||
if (dimension < 2) and not incrFlag:
|
if (dimension < 2) and not incrFlag:
|
||||||
@ -293,12 +261,12 @@ class GuiCanvasInterface():
|
|||||||
return canvasBrushSize_
|
return canvasBrushSize_
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasCanvasSize(self, f, dimension, incrFlag)
|
# {{{ canvasCanvasSize(self, f, dimension, incrFlag)
|
||||||
@CommandListDecorator(0, "Decrease canvas height", "Decrease canvas height", ["toolDecrCanvasH.png"], None, None)
|
@GuiCommandListDecorator(0, "Decrease canvas height", "Decrease canvas height", ["toolDecrCanvasH.png"], None, None)
|
||||||
@CommandListDecorator(1, "Decrease canvas width", "Decrease canvas width", ["toolDecrCanvasW.png"], None, None)
|
@GuiCommandListDecorator(1, "Decrease canvas width", "Decrease canvas width", ["toolDecrCanvasW.png"], None, None)
|
||||||
@CommandListDecorator(2, "Decrease canvas size", "Decrease canvas size", ["toolDecrCanvasHW.png"], None, None)
|
@GuiCommandListDecorator(2, "Decrease canvas size", "Decrease canvas size", ["toolDecrCanvasHW.png"], None, None)
|
||||||
@CommandListDecorator(3, "Increase canvas height", "Increase canvas height", ["toolIncrCanvasH.png"], None, None)
|
@GuiCommandListDecorator(3, "Increase canvas height", "Increase canvas height", ["toolIncrCanvasH.png"], None, None)
|
||||||
@CommandListDecorator(4, "Increase canvas width", "Increase canvas width", ["toolIncrCanvasW.png"], None, None)
|
@GuiCommandListDecorator(4, "Increase canvas width", "Increase canvas width", ["toolIncrCanvasW.png"], None, None)
|
||||||
@CommandListDecorator(5, "Increase canvas size", "Increase canvas size", ["toolIncrCanvasHW.png"], None, None)
|
@GuiCommandListDecorator(5, "Increase canvas size", "Increase canvas size", ["toolIncrCanvasHW.png"], None, None)
|
||||||
def canvasCanvasSize(self, f, dimension, incrFlag):
|
def canvasCanvasSize(self, f, dimension, incrFlag):
|
||||||
def canvasCanvasSize_(self, event):
|
def canvasCanvasSize_(self, event):
|
||||||
if (dimension < 2) and not incrFlag:
|
if (dimension < 2) and not incrFlag:
|
||||||
@ -319,13 +287,13 @@ class GuiCanvasInterface():
|
|||||||
return canvasCanvasSize_
|
return canvasCanvasSize_
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasTool(self, f, idx)
|
# {{{ canvasTool(self, f, idx)
|
||||||
@SelectDecorator(0, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False)
|
@GuiSelectDecorator(0, "Circle", "&Circle", ["toolCircle.png"], [wx.ACCEL_CTRL, ord("C")], False)
|
||||||
@SelectDecorator(1, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False)
|
@GuiSelectDecorator(1, "Clone", "Cl&one", ["toolClone.png"], [wx.ACCEL_CTRL, ord("E")], False)
|
||||||
@SelectDecorator(2, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False)
|
@GuiSelectDecorator(2, "Fill", "&Fill", ["toolFill.png"], [wx.ACCEL_CTRL, ord("F")], False)
|
||||||
@SelectDecorator(3, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False)
|
@GuiSelectDecorator(3, "Line", "&Line", ["toolLine.png"], [wx.ACCEL_CTRL, ord("L")], False)
|
||||||
@SelectDecorator(4, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False)
|
@GuiSelectDecorator(4, "Move", "&Move", ["toolMove.png"], [wx.ACCEL_CTRL, ord("M")], False)
|
||||||
@SelectDecorator(5, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True)
|
@GuiSelectDecorator(5, "Rectangle", "&Rectangle", ["toolRect.png"], [wx.ACCEL_CTRL, ord("R")], True)
|
||||||
@SelectDecorator(6, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False)
|
@GuiSelectDecorator(6, "Text", "&Text", ["toolText.png"], [wx.ACCEL_CTRL, ord("T")], False)
|
||||||
def canvasTool(self, f, idx):
|
def canvasTool(self, f, idx):
|
||||||
def canvasTool_(self, event):
|
def canvasTool_(self, event):
|
||||||
self.currentTool = [ToolCircle, ToolSelectClone, ToolFill, ToolLine, ToolSelectMove, ToolRect, ToolText][idx](self.parentCanvas)
|
self.currentTool = [ToolCircle, ToolSelectClone, ToolFill, ToolLine, ToolSelectMove, ToolRect, ToolText][idx](self.parentCanvas)
|
||||||
@ -342,7 +310,7 @@ class GuiCanvasInterface():
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# {{{ canvasExportAsAnsi(self, event)
|
# {{{ canvasExportAsAnsi(self, event)
|
||||||
@CommandDecorator("Export as ANSI...", "Export as ANSI...", None, None, None)
|
@GuiCommandDecorator("Export as ANSI...", "Export as ANSI...", None, None, None)
|
||||||
def canvasExportAsAnsi(self, event):
|
def canvasExportAsAnsi(self, event):
|
||||||
with wx.FileDialog(self.parentFrame, "Save As...", os.getcwd(), "", "ANSI files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
with wx.FileDialog(self.parentFrame, "Save As...", os.getcwd(), "", "ANSI files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
||||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||||
@ -356,7 +324,7 @@ class GuiCanvasInterface():
|
|||||||
return True
|
return True
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasExportAsPng(self, event)
|
# {{{ canvasExportAsPng(self, event)
|
||||||
@CommandDecorator("Export as PNG...", "Export as PN&G...", None, None, None)
|
@GuiCommandDecorator("Export as PNG...", "Export as PN&G...", None, None, None)
|
||||||
def canvasExportAsPng(self, event):
|
def canvasExportAsPng(self, event):
|
||||||
with wx.FileDialog(self.parentFrame, "Save As...", os.getcwd(), "", "PNG (*.png)|*.png|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
with wx.FileDialog(self.parentFrame, "Save As...", os.getcwd(), "", "PNG (*.png)|*.png|All Files (*.*)|*.*", wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dialog:
|
||||||
if dialog.ShowModal() == wx.ID_CANCEL:
|
if dialog.ShowModal() == wx.ID_CANCEL:
|
||||||
@ -369,7 +337,7 @@ class GuiCanvasInterface():
|
|||||||
return True
|
return True
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasExportImgur(self, event)
|
# {{{ canvasExportImgur(self, event)
|
||||||
@CommandDecorator("Export to Imgur...", "Export to I&mgur...", None, None, haveImgurApiKey and haveUrllib)
|
@GuiCommandDecorator("Export to Imgur...", "Export to I&mgur...", None, None, haveImgurApiKey and haveUrllib)
|
||||||
def canvasExportImgur(self, event):
|
def canvasExportImgur(self, event):
|
||||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||||
rc, status, result = self.parentCanvas.canvas.exportStore.exportBitmapToImgur(self.imgurApiKey, self.parentCanvas.backend.canvasBitmap, "", "", wx.BITMAP_TYPE_PNG)
|
rc, status, result = self.parentCanvas.canvas.exportStore.exportBitmapToImgur(self.imgurApiKey, self.parentCanvas.backend.canvasBitmap, "", "", wx.BITMAP_TYPE_PNG)
|
||||||
@ -382,7 +350,7 @@ class GuiCanvasInterface():
|
|||||||
wx.MessageBox("Failed to export to Imgur: {}".format(result), "Export to Imgur", wx.ICON_EXCLAMATION | wx.OK)
|
wx.MessageBox("Failed to export to Imgur: {}".format(result), "Export to Imgur", wx.ICON_EXCLAMATION | wx.OK)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasExportPastebin(self, event)
|
# {{{ canvasExportPastebin(self, event)
|
||||||
@CommandDecorator("Export to Pastebin...", "Export to Pasteb&in...", None, None, haveUrllib)
|
@GuiCommandDecorator("Export to Pastebin...", "Export to Pasteb&in...", None, None, haveUrllib)
|
||||||
def canvasExportPastebin(self, event):
|
def canvasExportPastebin(self, event):
|
||||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||||
pasteStatus, pasteResult = self.parentCanvas.canvas.exportStore.exportPastebin("253ce2f0a45140ee0a44ca99aa49260", self.parentCanvas.canvas.map, self.parentCanvas.canvas.size)
|
pasteStatus, pasteResult = self.parentCanvas.canvas.exportStore.exportPastebin("253ce2f0a45140ee0a44ca99aa49260", self.parentCanvas.canvas.map, self.parentCanvas.canvas.size)
|
||||||
@ -397,7 +365,7 @@ class GuiCanvasInterface():
|
|||||||
wx.MessageBox("Failed to export to Pastebin: " + pasteResult, "Export to Pastebin", wx.OK|wx.ICON_EXCLAMATION)
|
wx.MessageBox("Failed to export to Pastebin: " + pasteResult, "Export to Pastebin", wx.OK|wx.ICON_EXCLAMATION)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasExportToClipboard(self, event)
|
# {{{ canvasExportToClipboard(self, event)
|
||||||
@CommandDecorator("Export to clipboard", "&Export to clipboard", None, None, None)
|
@GuiCommandDecorator("Export to clipboard", "&Export to clipboard", None, None, None)
|
||||||
def canvasExportToClipboard(self, event):
|
def canvasExportToClipboard(self, event):
|
||||||
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
|
||||||
rc, outBuffer = self.parentCanvas.canvas.exportStore.exportTextBuffer(self.parentCanvas.canvas.map, self.parentCanvas.canvas.size)
|
rc, outBuffer = self.parentCanvas.canvas.exportStore.exportTextBuffer(self.parentCanvas.canvas.map, self.parentCanvas.canvas.size)
|
||||||
@ -408,7 +376,7 @@ class GuiCanvasInterface():
|
|||||||
return True
|
return True
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasImportAnsi(self, event)
|
# {{{ canvasImportAnsi(self, event)
|
||||||
@CommandDecorator("Import ANSI...", "Import ANSI...", None, None, None)
|
@GuiCommandDecorator("Import ANSI...", "Import ANSI...", None, None, None)
|
||||||
def canvasImportAnsi(self, event):
|
def canvasImportAnsi(self, event):
|
||||||
def canvasImportAnsi_(pathName):
|
def canvasImportAnsi_(pathName):
|
||||||
rc, error = self.parentCanvas.canvas.importStore.importAnsiFile(pathName)
|
rc, error = self.parentCanvas.canvas.importStore.importAnsiFile(pathName)
|
||||||
@ -416,7 +384,7 @@ class GuiCanvasInterface():
|
|||||||
self._importFile(canvasImportAnsi_, True, "ANSI files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*")
|
self._importFile(canvasImportAnsi_, True, "ANSI files (*.ans;*.txt)|*.ans;*.txt|All Files (*.*)|*.*")
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasImportFromClipboard(self, event)
|
# {{{ canvasImportFromClipboard(self, event)
|
||||||
@CommandDecorator("Import from clipboard", "&Import from clipboard", None, None, None)
|
@GuiCommandDecorator("Import from clipboard", "&Import from clipboard", None, None, None)
|
||||||
def canvasImportFromClipboard(self, event):
|
def canvasImportFromClipboard(self, event):
|
||||||
def canvasImportFromClipboard_(pathName):
|
def canvasImportFromClipboard_(pathName):
|
||||||
if wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_TEXT)) \
|
if wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_TEXT)) \
|
||||||
@ -433,7 +401,7 @@ class GuiCanvasInterface():
|
|||||||
self._import(canvasImportFromClipboard_, True, None)
|
self._import(canvasImportFromClipboard_, True, None)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ canvasImportSauce(self, event)
|
# {{{ canvasImportSauce(self, event)
|
||||||
@CommandDecorator("Import SAUCE...", "Import SAUCE...", None, None, None)
|
@GuiCommandDecorator("Import SAUCE...", "Import SAUCE...", None, None, None)
|
||||||
def canvasImportSauce(self, event):
|
def canvasImportSauce(self, event):
|
||||||
def canvasImportSauce_(pathName):
|
def canvasImportSauce_(pathName):
|
||||||
rc, error = self.parentCanvas.canvas.importStore.importSauceFile(pathName)
|
rc, error = self.parentCanvas.canvas.importStore.importSauceFile(pathName)
|
@ -5,9 +5,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from Canvas import Canvas
|
from Canvas import Canvas
|
||||||
from GuiCanvasInterface import GuiCanvasInterface
|
|
||||||
from GuiCanvasWxBackend import GuiCanvasWxBackend
|
from GuiCanvasWxBackend import GuiCanvasWxBackend
|
||||||
from GuiFrame import GuiFrame, NID_TOOLBAR_HSEP
|
from GuiFrame import GuiFrame, NID_TOOLBAR_HSEP
|
||||||
|
from RoarCanvasInterface import RoarCanvasInterface
|
||||||
from RoarCanvasWindow import RoarCanvasWindow
|
from RoarCanvasWindow import RoarCanvasWindow
|
||||||
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
@ -45,7 +45,7 @@ class RoarClient(GuiFrame):
|
|||||||
def __init__(self, parent, defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14), size=(840, 630), title=""):
|
def __init__(self, parent, defaultCanvasPos=(0, 75), defaultCanvasSize=(100, 30), defaultCellSize=(7, 14), size=(840, 630), title=""):
|
||||||
super().__init__(self._getIconPathName(), size, parent, title)
|
super().__init__(self._getIconPathName(), size, parent, title)
|
||||||
self.canvas = Canvas(defaultCanvasSize)
|
self.canvas = Canvas(defaultCanvasSize)
|
||||||
self.canvasPanel = RoarCanvasWindow(GuiCanvasWxBackend, self.canvas, defaultCellSize, GuiCanvasInterface, self.panelSkin, self, defaultCanvasPos, defaultCellSize, defaultCanvasSize)
|
self.canvasPanel = RoarCanvasWindow(GuiCanvasWxBackend, self.canvas, defaultCellSize, RoarCanvasInterface, self.panelSkin, self, defaultCanvasPos, defaultCellSize, defaultCanvasSize)
|
||||||
self.loadAccels(self.canvasPanel.interface.accels)
|
self.loadAccels(self.canvasPanel.interface.accels)
|
||||||
self.loadMenus(self.canvasPanel.interface.menus)
|
self.loadMenus(self.canvasPanel.interface.menus)
|
||||||
self._initToolBitmaps(self.canvasPanel.interface.toolBars)
|
self._initToolBitmaps(self.canvasPanel.interface.toolBars)
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# GuiCanvasInterfaceAbout.py
|
# RoarClientAboutWindow.py
|
||||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import os, random, wx, wx.adv
|
import os, random, wx, wx.adv
|
||||||
|
|
||||||
class GuiCanvasInterfaceAbout(wx.Dialog):
|
class RoarClientAboutWindow(wx.Dialog):
|
||||||
# {{{ onButtonRoar(self, event)
|
# {{{ onButtonRoar(self, event)
|
||||||
def onButtonRoar(self, event):
|
def onButtonRoar(self, event):
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
@ -16,7 +16,7 @@ class GuiCanvasInterfaceAbout(wx.Dialog):
|
|||||||
#
|
#
|
||||||
# __init__(self, parent, size=(320, 240), title="About roar")
|
# __init__(self, parent, size=(320, 240), title="About roar")
|
||||||
def __init__(self, parent, size=(320, 240), title="About roar"):
|
def __init__(self, parent, size=(320, 240), title="About roar"):
|
||||||
super(GuiCanvasInterfaceAbout, self).__init__(parent, size=size, title=title)
|
super().__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)
|
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"))
|
logoPathNames = glob(os.path.join("assets", "images", "logo*.bmp"))
|
Loading…
Reference in New Issue
Block a user