mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 07:16:38 +00:00
MiRCART.py:MiRCARTFrame.accel{UndoId,Table}: added.
MiRCART.py:MiRCARTFrame.onAccelUndo(): call self.panelCanvas.undo(). MiRCART.py:MiRCARTFrame.__init__(): create self.menuFileUndo w/ wx.ID_UNDO. MiRCART.py:MiRCARTFrame.__init__(): bind ^Z accelerator to self.onAccelUndo().
This commit is contained in:
parent
423f923b4e
commit
8b6d7ab445
16
MiRCART.py
16
MiRCART.py
@ -299,7 +299,7 @@ class MiRCARTFrame(wx.Frame):
|
||||
"""XXX"""
|
||||
menuFile = menuFileUndo = menuFileSaveAs = menuFileExit = menuBar = None
|
||||
panelSkin = panelCanvas = panelPalette = None
|
||||
statusBar = None
|
||||
accelUndoId = accelTable = statusBar = None
|
||||
|
||||
# {{{ _updateStatusBar(): XXX
|
||||
def _updateStatusBar(self):
|
||||
@ -310,6 +310,10 @@ class MiRCARTFrame(wx.Frame):
|
||||
text += " " + str(self.panelCanvas.getBackgroundColour())
|
||||
self.statusBar.SetStatusText(text)
|
||||
# }}}
|
||||
# {{{ onAccelUndo(): XXX
|
||||
def onAccelUndo(self, event):
|
||||
self.panelCanvas.undo()
|
||||
# }}}
|
||||
# {{{ onFileUndo(): XXX
|
||||
def onFileUndo(self, event):
|
||||
self.panelCanvas.undo()
|
||||
@ -355,11 +359,12 @@ class MiRCARTFrame(wx.Frame):
|
||||
super().__init__(parent, wx.ID_ANY, "MiRCART", size=appSize)
|
||||
|
||||
self.menuFile = wx.Menu()
|
||||
self.menuFileUndo = self.menuFile.Append(wx.ID_SAVE, "&Undo", "Undo")
|
||||
self.menuFileUndo = self.menuFile.Append(wx.ID_UNDO, "&Undo", "Undo")
|
||||
self.menuFileSaveAs = self.menuFile.Append(wx.ID_SAVE, "Save &As...", "Save As...")
|
||||
self.menuFileExit = self.menuFile.Append(wx.ID_EXIT, "E&xit", "Exit")
|
||||
self.menuBar = wx.MenuBar()
|
||||
self.menuBar.Append(self.menuFile, "&File")
|
||||
self.SetMenuBar(self.menuBar)
|
||||
|
||||
self.panelSkin = wx.Panel(self, wx.ID_ANY)
|
||||
self.panelCanvas = MiRCARTCanvas(self.panelSkin, \
|
||||
@ -368,13 +373,18 @@ class MiRCARTFrame(wx.Frame):
|
||||
self.panelPalette = MiRCARTPalette(self.panelSkin, \
|
||||
(25, (canvasSize[1] + 3) * cellSize[1]), cellSize, self.onPaletteEvent)
|
||||
|
||||
self.accelUndoId = wx.NewId()
|
||||
self.accelTable = wx.AcceleratorTable([( \
|
||||
wx.ACCEL_CTRL, ord('Z'), self.accelUndoId)])
|
||||
self.SetAcceleratorTable(self.accelTable)
|
||||
self.statusBar = self.CreateStatusBar()
|
||||
self._updateStatusBar()
|
||||
self.SetFocus()
|
||||
|
||||
self.Bind(wx.EVT_MENU, self.onAccelUndo, id=self.accelUndoId)
|
||||
self.Bind(wx.EVT_MENU, self.onFileExit, self.menuFileExit)
|
||||
self.Bind(wx.EVT_MENU, self.onFileSaveAs, self.menuFileSaveAs)
|
||||
self.Bind(wx.EVT_MENU, self.onFileUndo, self.menuFileUndo)
|
||||
self.SetMenuBar(self.menuBar)
|
||||
self.Show(True)
|
||||
# }}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user