From 0e989808aa0a759f989133951a080b47d70e51f1 Mon Sep 17 00:00:00 2001 From: Emanuel Steen Date: Sun, 12 Sep 2010 15:43:00 +0200 Subject: [PATCH 1/3] Fix segmenation fault in shutdown. - Close question dialog before main window when the anser is yes. --- pessheet.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pessheet.py b/pessheet.py index d34d98b..cb44ba6 100644 --- a/pessheet.py +++ b/pessheet.py @@ -312,10 +312,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: From 8b5334d624ed1a447ecec672814706a4598185d1 Mon Sep 17 00:00:00 2001 From: Emanuel Steen Date: Mon, 18 Oct 2010 21:59:10 +0200 Subject: [PATCH 2/3] Create the main_window before the splash screen and make the splash screen have the main_window as parent. This will fix an issue where the main_window would be minimized on start if using GTK as wxwidgets backend. --- pessheet.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pessheet.py b/pessheet.py index cb44ba6..e1b1e45 100644 --- a/pessheet.py +++ b/pessheet.py @@ -501,13 +501,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) @@ -525,6 +520,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__': From 813c5955fe37eed959f37293705f73b77d4eda67 Mon Sep 17 00:00:00 2001 From: Emanuel Steen Date: Mon, 18 Oct 2010 22:49:29 +0200 Subject: [PATCH 3/3] Add delete edit option. This also makes it possible to delete the content of a cell by pressing the 'delete' button on the keyboard. --- pessheet.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pessheet.py b/pessheet.py index e1b1e45..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', @@ -476,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,