diff --git a/pessheet.py b/pessheet.py index d34d98b..f35dff3 100644 --- a/pessheet.py +++ b/pessheet.py @@ -211,6 +211,7 @@ def __init__(self, parent, id, title, size, call_on_destroy, self.Bind(wx.EVT_MENU, self.OnEditCut, id=wx.ID_CUT) self.Bind(wx.EVT_MENU, self.OnEditCopy, id=wx.ID_COPY) self.Bind(wx.EVT_MENU, self.OnEditPaste, id=wx.ID_PASTE) + self.Bind(wx.EVT_MENU, self.OnEditDelete, id=wx.ID_DELETE) self.Bind(wx.EVT_MENU, self.OnOptions, id=wx.ID_PREFERENCES) script_page.Bind(wx.EVT_KILL_FOCUS, self.onEditorLostFocus) @@ -266,6 +267,8 @@ def getMenuBar(self): (wx.ID_CUT, 'Cut\tCtrl-X', 'Cut selection into Clipboard'), (wx.ID_COPY, 'Copy\tCtrl-C', 'Copy selection into Clipboard'), (wx.ID_PASTE, 'Paste\tCtrl-V', 'Paste the content of the Clipboard into the sheet'), + None, #Separator + (wx.ID_DELETE, 'Delete\tDelete', 'Delete selection'), ] ), #('&View', @@ -312,10 +315,11 @@ def OnClose(self, event): dlg = wx.MessageDialog(self, "Want to exit %s?" % getApplicationName(), "Exit", wx.YES_NO | wx.ICON_QUESTION) - if dlg.ShowModal() == wx.ID_YES: + response = dlg.ShowModal() + dlg.Destroy() + if response == wx.ID_YES: self.Destroy() self._call_on_destroy() - dlg.Destroy() def updateTitle(self): if self._filename: @@ -475,6 +479,12 @@ def OnEditPaste(self, event): http://74.125.77.132/search?q=cache:l8ru47_-EuAJ:www.picalo.org/download/picalo-2.32/picalo/gui/Spreadsheet.py+ID_PASTE+wx+bind+TheClipBoard+grid&hl=sv&ct=clnk&cd=1&gl=se&client=firefox-a """ + def OnEditDelete(self, event): + if (wx.GetActiveWindow().FindFocus().GetParent() == + self._sheet_page.grid): + self._sheet_page.grid.cut() + event.Skip() + def OnOptions(self, event): value = '\n'.join(self._additional_paths) d = wx.TextEntryDialog(self, @@ -500,13 +510,8 @@ def main(argv): redirect = True argv.pop() - #app = wx.App() app = wx.App(redirect=redirect) - bmp = wx.Image('resources/pes_splash.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() - wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, - 1000, None, -1) - window_size = wx.GetDisplaySize() window_size.Scale(0.8, 0.8) @@ -524,6 +529,10 @@ def call_on_destroy(): window_size, filename=filename, dirname=path, call_on_destroy=call_on_destroy) + bmp = wx.Image('resources/pes_splash.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() + splash = wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, + 1000, main_window, -1) + app.MainLoop() if __name__ == '__main__':