Bug correction
* Menu now working again * App close working
This commit is contained in:
parent
a66e3a51ff
commit
f89727ea93
1
boards/README.md
Normal file
1
boards/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
`boards` dir contain saved boards as images.
|
12
piboard.py
12
piboard.py
@ -87,9 +87,7 @@ class PaintWindow(wx.Window):
|
|||||||
(wx.EVT_RIGHT_UP, self.onRightUp),
|
(wx.EVT_RIGHT_UP, self.onRightUp),
|
||||||
(wx.EVT_SIZE, self.onSize),
|
(wx.EVT_SIZE, self.onSize),
|
||||||
(wx.EVT_IDLE, self.onIdle),
|
(wx.EVT_IDLE, self.onIdle),
|
||||||
(wx.EVT_PAINT, self.onPaint),
|
(wx.EVT_PAINT, self.onPaint)]:
|
||||||
# creates event to close window after 'x' is selected
|
|
||||||
(wx.EVT_WINDOW_DESTROY, self.cleanup)]:
|
|
||||||
self.Bind(event, handler)
|
self.Bind(event, handler)
|
||||||
|
|
||||||
def initBuffer(self):
|
def initBuffer(self):
|
||||||
@ -139,6 +137,7 @@ class PaintWindow(wx.Window):
|
|||||||
self.Bind(event, handler, id=firstId, id2=lastId)
|
self.Bind(event, handler, id=firstId, id2=lastId)
|
||||||
|
|
||||||
def button_exit_handle(self, event):
|
def button_exit_handle(self, event):
|
||||||
|
self.menu.Destroy()
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
wx.App.ExitMainLoop(app)
|
wx.App.ExitMainLoop(app)
|
||||||
|
|
||||||
@ -240,7 +239,9 @@ class PaintWindow(wx.Window):
|
|||||||
ret = wx.MessageBox('Are you sure to quit?', 'Question',
|
ret = wx.MessageBox('Are you sure to quit?', 'Question',
|
||||||
wx.YES_NO | wx.NO_DEFAULT, self)
|
wx.YES_NO | wx.NO_DEFAULT, self)
|
||||||
if ret == wx.YES:
|
if ret == wx.YES:
|
||||||
|
self.menu.Destroy()
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
|
wx.App.ExitMainLoop(app)
|
||||||
else:
|
else:
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
@ -270,11 +271,6 @@ class PaintWindow(wx.Window):
|
|||||||
def onPaint(self, event):
|
def onPaint(self, event):
|
||||||
dc = wx.BufferedPaintDC(self, self.buffer)
|
dc = wx.BufferedPaintDC(self, self.buffer)
|
||||||
|
|
||||||
def cleanup(self, event):
|
|
||||||
if hasattr(self, "menu"):
|
|
||||||
self.menu.Destroy()
|
|
||||||
del self.menu
|
|
||||||
|
|
||||||
def onCheckMenuColours(self, event):
|
def onCheckMenuColours(self, event):
|
||||||
colour = self.idToColourMap[event.GetId()]
|
colour = self.idToColourMap[event.GetId()]
|
||||||
event.Check(colour == self.currentColour)
|
event.Check(colour == self.currentColour)
|
||||||
|
Loading…
Reference in New Issue
Block a user