From 9cf00dd5510cb433d4bc3fd941127c6675f5558d Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Mon, 31 Dec 2001 15:02:56 +0000 Subject: Updated to optionally use Carbon Scrap manager. --- Mac/Demo/textedit/ped.py | 19 +++++++++++++++---- Mac/Demo/waste/htmled.py | 11 ++++++++--- Mac/Demo/waste/swed.py | 11 ++++++++--- Mac/Demo/waste/wed.py | 11 ++++++++--- 4 files changed, 39 insertions(+), 13 deletions(-) diff --git a/Mac/Demo/textedit/ped.py b/Mac/Demo/textedit/ped.py index 524b92a..6a0f882 100644 --- a/Mac/Demo/textedit/ped.py +++ b/Mac/Demo/textedit/ped.py @@ -141,7 +141,10 @@ class TEWindow(ScrolledWindow): def menu_cut(self): self.ted.TESelView() self.ted.TECut() - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() TE.TEToScrap() self.updatescrollbars() self.parent.updatemenubar() @@ -149,7 +152,10 @@ class TEWindow(ScrolledWindow): def menu_copy(self): self.ted.TECopy() - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() TE.TEToScrap() self.updatescrollbars() self.parent.updatemenubar() @@ -226,8 +232,13 @@ class Ped(Application): if hasattr(Scrap, 'InfoScrap'): on = (Scrap.InfoScrap()[0] <> 0) else: - # Not there yet on Carbon, simply always enable - on = 1 + flavors = Scrap.GetCurrentScrap().GetScrapFlavorInfoList() + for tp, info in flavors: + if tp == 'TEXT': + on = 1 + break + else: + on = 0 if on <> self.pastegroup_on: self.pasteitem.enable(on) self.pastegroup_on = on diff --git a/Mac/Demo/waste/htmled.py b/Mac/Demo/waste/htmled.py index fc2ce5b..b590b1d 100644 --- a/Mac/Demo/waste/htmled.py +++ b/Mac/Demo/waste/htmled.py @@ -297,14 +297,19 @@ class WasteWindow(ScrolledWindow): def menu_cut(self): self.ted.WESelView() - self.ted.WECut() - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() self.ted.WECut() self.updatescrollbars() self.parent.updatemenubar() def menu_copy(self): - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() self.ted.WECopy() self.updatescrollbars() self.parent.updatemenubar() diff --git a/Mac/Demo/waste/swed.py b/Mac/Demo/waste/swed.py index e2c2666..62b027e 100644 --- a/Mac/Demo/waste/swed.py +++ b/Mac/Demo/waste/swed.py @@ -235,14 +235,19 @@ class WasteWindow(ScrolledWindow): def menu_cut(self): self.ted.WESelView() - self.ted.WECut() - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() self.ted.WECut() self.updatescrollbars() self.parent.updatemenubar() def menu_copy(self): - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() self.ted.WECopy() self.updatescrollbars() self.parent.updatemenubar() diff --git a/Mac/Demo/waste/wed.py b/Mac/Demo/waste/wed.py index 00ff8d8..14bee45 100644 --- a/Mac/Demo/waste/wed.py +++ b/Mac/Demo/waste/wed.py @@ -190,15 +190,20 @@ class WasteWindow(ScrolledWindow): def menu_cut(self): self.ted.WESelView() - self.ted.WECut() - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() self.ted.WECut() self.updatescrollbars() self.parent.updatemenubar() self.changed = 1 def menu_copy(self): - Scrap.ZeroScrap() + if hasattr(Scrap, 'ZeroScrap'): + Scrap.ZeroScrap() + else: + Scrap.ClearCurrentScrap() self.ted.WECopy() self.updatescrollbars() self.parent.updatemenubar() -- cgit v0.12