Beispiel #1
0
def FrontWindowInsert(stuff):
    if not stuff:
        return
    if type(stuff) <> StringType:
        raise TypeError, 'string expected'
    import W
    app = W.getapplication()
    wid = MyFrontWindow()
    if wid and app._windows.has_key(wid):
        window = app._windows[wid]
        if hasattr(window, "insert"):
            try:
                window.insert(stuff)
                return
            except:
                pass
    import EasyDialogs
    if EasyDialogs.AskYesNoCancel(
            "Can't find window or widget to insert text into; copy to clipboard instead?",
            1) == 1:
        from Carbon import Scrap
        if hasattr(Scrap, 'PutScrap'):
            Scrap.ZeroScrap()
            Scrap.PutScrap('TEXT', stuff)
        else:
            Scrap.ClearCurrentScrap()
            sc = Scrap.GetCurrentScrap()
            sc.PutScrapFlavor('TEXT', 0, stuff)
Beispiel #2
0
 def menu_copy(self):
     if hasattr(Scrap, 'ZeroScrap'):
         Scrap.ZeroScrap()
     else:
         Scrap.ClearCurrentScrap()
     self.ted.WECopy()
     self.updatescrollbars()
     self.parent.updatemenubar()
Beispiel #3
0
 def menu_cut(self):
     self.ted.WESelView()
     if hasattr(Scrap, 'ZeroScrap'):
         Scrap.ZeroScrap()
     else:
         Scrap.ClearCurrentScrap()
     self.ted.WECut()
     self.updatescrollbars()
     self.parent.updatemenubar()
Beispiel #4
0
 def domenu_copy(self, *args):
     selbegin, selend = self.ted.WEGetSelection()
     if selbegin == selend:
         return
     if hasattr(Scrap, 'ZeroScrap'):
         Scrap.ZeroScrap()
     else:
         Scrap.ClearCurrentScrap()
     self.ted.WECopy()
     self.updatescrollbars()
Beispiel #5
0
 def domenu_copy(self, *args):
     sel = self.getselection()
     selitems = []
     for i in sel:
         selitems.append(str(self.items[i]))
     text = string.join(selitems, '\r')
     if text:
         if hasattr(Scrap, 'PutScrap'):
             Scrap.ZeroScrap()
             Scrap.PutScrap('TEXT', text)
         else:
             Scrap.ClearCurrentScrap()
             sc = Scrap.GetCurrentScrap()
             sc.PutScrapFlavor('TEXT', 0, text)
Beispiel #6
0
 def domenu_copy(self, *args):
     sel = self.getselectedobjects()
     selitems = []
     for key, value, dummy, dummy in sel:
         selitems.append(double_repr(key, value))
     text = string.join(selitems, '\r')
     if text:
         from Carbon import Scrap
         if hasattr(Scrap, 'PutScrap'):
             Scrap.ZeroScrap()
             Scrap.PutScrap('TEXT', text)
         else:
             Scrap.ClearCurrentScrap()
             sc = Scrap.GetCurrentScrap()
             sc.PutScrapFlavor('TEXT', 0, text)
Beispiel #7
0
 def domenu_cut(self, *args):
     selbegin, selend = self.ted.WEGetSelection()
     if selbegin == selend:
         return
     if hasattr(Scrap, 'ZeroScrap'):
         Scrap.ZeroScrap()
     else:
         Scrap.ClearCurrentScrap()
     self.ted.WECut()
     self.updatescrollbars()
     self.selview()
     self.textchanged()
     self.selectionchanged()
     if self._callback:
         Wbase.CallbackCall(self._callback, 0, "", None)
Beispiel #8
0
# A minimal text editor.
Beispiel #9
0
# A minimal text editor.
Beispiel #10
0
# A minimal text editor.