RE: [PyCrust] clipboard destroyed on program exit
Brought to you by:
pobrien
|
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
|