Kaydet (Commit) ad8381a8 authored tarafından Jack Jansen's avatar Jack Jansen

Use the Carbon scrap manager interface if the old interface isn't available.

üst 420ed403
...@@ -176,8 +176,13 @@ class List(Wbase.SelectableWidget): ...@@ -176,8 +176,13 @@ class List(Wbase.SelectableWidget):
selitems.append(str(self.items[i])) selitems.append(str(self.items[i]))
text = string.join(selitems, '\r') text = string.join(selitems, '\r')
if text: if text:
Scrap.ZeroScrap() if hasattr(Scrap, 'PutScrap'):
Scrap.PutScrap('TEXT', text) Scrap.ZeroScrap()
Scrap.PutScrap('TEXT', text)
else:
Scrap.ClearCurrentScrap()
sc = Scrap.GetCurrentScrap()
sc.PutScrapFlavor('TEXT', 0, text)
def can_copy(self, *args): def can_copy(self, *args):
return len(self.getselection()) <> 0 return len(self.getselection()) <> 0
......
...@@ -430,7 +430,10 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget): ...@@ -430,7 +430,10 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
selbegin, selend = self.ted.WEGetSelection() selbegin, selend = self.ted.WEGetSelection()
if selbegin == selend: if selbegin == selend:
return return
Scrap.ZeroScrap() if hasattr(Scrap, 'ZeroScrap'):
Scrap.ZeroScrap()
else:
Scrap.ClearCurrentScrap()
self.ted.WECopy() self.ted.WECopy()
self.updatescrollbars() self.updatescrollbars()
...@@ -438,7 +441,10 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget): ...@@ -438,7 +441,10 @@ class EditText(Wbase.SelectableWidget, _ScrollWidget):
selbegin, selend = self.ted.WEGetSelection() selbegin, selend = self.ted.WEGetSelection()
if selbegin == selend: if selbegin == selend:
return return
Scrap.ZeroScrap() if hasattr(Scrap, 'ZeroScrap'):
Scrap.ZeroScrap()
else:
Scrap.ClearCurrentScrap()
self.ted.WECut() self.ted.WECut()
self.updatescrollbars() self.updatescrollbars()
self.selview() self.selview()
......
...@@ -564,8 +564,13 @@ def FrontWindowInsert(stuff): ...@@ -564,8 +564,13 @@ def FrontWindowInsert(stuff):
"Can't find window or widget to insert text into; copy to clipboard instead?", "Can't find window or widget to insert text into; copy to clipboard instead?",
1) == 1: 1) == 1:
from Carbon import Scrap from Carbon import Scrap
Scrap.ZeroScrap() if hasattr(Scrap, 'PutScrap'):
Scrap.PutScrap('TEXT', stuff) Scrap.ZeroScrap()
Scrap.PutScrap('TEXT', stuff)
else:
Scrap.ClearCurrentScrap()
sc = Scrap.GetCurrentScrap()
sc.PutScrapFlavor('TEXT', 0, stuff)
# not quite based on the same function in FrameWork # not quite based on the same function in FrameWork
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment