Thread: [PyCrust] clipboard destroyed on program exit
Brought to you by:
pobrien
From: Kevin A. <al...@se...> - 2001-11-12 03:19:15
|
For a long time I've been annoyed that the clipboard appears to be destroyed when exiting a PythonCard app when PyCrust is running. Until tonight I didn't think to investigate this problem. This typically shows up for me when I copy some text from the PyCrust shell and then exit the app and then try and paste into Notepad or email only to find that the text is not in the clipboard. If you do the copy/paste before the app exits, the text is okay. Patrick thought I should bring this up here to see if Neil or Robin have any ideas what causes this? Is there something in wxPython or Scintilla that is messing with the clipboard when the app exits? I've never seen this issue when copying text from a wxTextCtrl and then exiting an app, it only happens with the PyCrust shell. ka |
From: Neil H. <ne...@sc...> - 2001-11-12 08:46:10
|
Kevin: > Patrick thought I should bring this up here to see if Neil or Robin have > any ideas what causes this? Is there something in wxPython or > Scintilla that is messing with the clipboard when the app exits? I've > never seen this issue when copying text from a wxTextCtrl and > then exiting an app, it only happens with the PyCrust shell. This is on Windows? On X/Linux this is hard to fix as you only provide 'promises' (in Mac terms) of your clipboard value. Then when another app wants to paste, you are sent a message and you provide the full contents of the clipboard. On Windows, you can either provide promises or data. The reason for promises is the cost in rendering and storing the selection in all possibly required formats when processing the copy/cut commands. Because of this deep platform difference (and even worse, the asynchrony required on X), Scintilla leaves it up to the platform adaptation layer to handle clipboard operations. So it is up to Robin ;) Neil |
From: Patrick K. O'B. <po...@or...> - 2001-11-12 13:04:45
|
Here is how I have coded the cut and copy operations: def Cut(self): """Remove selection and place it on the clipboard.""" if self.CanCut() and self.CanCopy(): if self.AutoCompActive(): self.AutoCompCancel() if self.CallTipActive: self.CallTipCancel() self.Copy() self.ReplaceSelection('') def Copy(self): """Copy selection and place it on the clipboard.""" if self.CanCopy(): command = self.GetSelectedText() command = command.replace(os.linesep + sys.ps2, os.linesep) command = command.replace(os.linesep + sys.ps1, os.linesep) command = self.lstripPrompt(text=command) data = wxTextDataObject(command) if wxTheClipboard.Open(): wxTheClipboard.SetData(data) wxTheClipboard.Close() def CopyWithPrompts(self): """Copy selection, including prompts, and place it on the clipboard.""" if self.CanCopy(): command = self.GetSelectedText() data = wxTextDataObject(command) if wxTheClipboard.Open(): wxTheClipboard.SetData(data) wxTheClipboard.Close() --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: pyc...@li... [mailto:pyc...@li...]On Behalf Of Neil Hodgson Sent: Monday, November 12, 2001 2:46 AM To: Pycrust-Users Subject: Re: [PyCrust] clipboard destroyed on program exit Kevin: > Patrick thought I should bring this up here to see if Neil or Robin have > any ideas what causes this? Is there something in wxPython or > Scintilla that is messing with the clipboard when the app exits? I've > never seen this issue when copying text from a wxTextCtrl and > then exiting an app, it only happens with the PyCrust shell. This is on Windows? On X/Linux this is hard to fix as you only provide 'promises' (in Mac terms) of your clipboard value. Then when another app wants to paste, you are sent a message and you provide the full contents of the clipboard. On Windows, you can either provide promises or data. The reason for promises is the cost in rendering and storing the selection in all possibly required formats when processing the copy/cut commands. Because of this deep platform difference (and even worse, the asynchrony required on X), Scintilla leaves it up to the platform adaptation layer to handle clipboard operations. So it is up to Robin ;) Neil _______________________________________________ PyCrust-users mailing list PyC...@li... https://lists.sourceforge.net/lists/listinfo/pycrust-users |
From: Robin D. <ro...@al...> - 2001-11-12 16:09:25
|
I believe wxWindows uses the promise method. --Robin ----- Original Message ----- From: "Patrick K. O'Brien" <po...@or...> To: "Pycrust-Users" <pyc...@li...> Sent: Monday, November 12, 2001 5:08 AM Subject: RE: [PyCrust] clipboard destroyed on program exit > Here is how I have coded the cut and copy operations: > > def Cut(self): > """Remove selection and place it on the clipboard.""" > if self.CanCut() and self.CanCopy(): > if self.AutoCompActive(): self.AutoCompCancel() > if self.CallTipActive: self.CallTipCancel() > self.Copy() > self.ReplaceSelection('') > > def Copy(self): > """Copy selection and place it on the clipboard.""" > if self.CanCopy(): > command = self.GetSelectedText() > command = command.replace(os.linesep + sys.ps2, os.linesep) > command = command.replace(os.linesep + sys.ps1, os.linesep) > command = self.lstripPrompt(text=command) > data = wxTextDataObject(command) > if wxTheClipboard.Open(): > wxTheClipboard.SetData(data) > wxTheClipboard.Close() > > def CopyWithPrompts(self): > """Copy selection, including prompts, and place it on the > clipboard.""" > if self.CanCopy(): > command = self.GetSelectedText() > data = wxTextDataObject(command) > if wxTheClipboard.Open(): > wxTheClipboard.SetData(data) > wxTheClipboard.Close() > > --- > Patrick K. O'Brien > Orbtech > "I am, therefore I think." > > -----Original Message----- > From: pyc...@li... > [mailto:pyc...@li...]On Behalf Of Neil Hodgson > Sent: Monday, November 12, 2001 2:46 AM > To: Pycrust-Users > Subject: Re: [PyCrust] clipboard destroyed on program exit > > Kevin: > > > Patrick thought I should bring this up here to see if Neil or Robin have > > any ideas what causes this? Is there something in wxPython or > > Scintilla that is messing with the clipboard when the app exits? I've > > never seen this issue when copying text from a wxTextCtrl and > > then exiting an app, it only happens with the PyCrust shell. > > This is on Windows? On X/Linux this is hard to fix as you only provide > 'promises' (in Mac terms) of your clipboard value. Then when another app > wants to paste, you are sent a message and you provide the full contents of > the clipboard. On Windows, you can either provide promises or data. The > reason for promises is the cost in rendering and storing the selection in > all possibly required formats when processing the copy/cut commands. Because > of this deep platform difference (and even worse, the asynchrony required on > X), Scintilla leaves it up to the platform adaptation layer to handle > clipboard operations. So it is up to Robin ;) > > Neil > > > > _______________________________________________ > PyCrust-users mailing list > PyC...@li... > https://lists.sourceforge.net/lists/listinfo/pycrust-users > > > _______________________________________________ > PyCrust-users mailing list > PyC...@li... > https://lists.sourceforge.net/lists/listinfo/pycrust-users > |
From: Patrick K. O'B. <po...@or...> - 2001-11-15 00:28:50
|
Is there any way to force wxPython to put the data on the clipboard, rather than just a promise? This seems like something that should be decided by each application, no? --- Patrick K. O'Brien Orbtech "I am, therefore I think." -----Original Message----- From: pyc...@li... [mailto:pyc...@li...]On Behalf Of Robin Dunn Sent: Monday, November 12, 2001 10:09 AM To: Pycrust-Users Subject: Re: [PyCrust] clipboard destroyed on program exit I believe wxWindows uses the promise method. --Robin |