Esempio n. 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)
Esempio n. 2
0
 def menu_copy(self):
     if hasattr(Scrap, 'ZeroScrap'):
         Scrap.ZeroScrap()
     else:
         Scrap.ClearCurrentScrap()
     self.ted.WECopy()
     self.updatescrollbars()
     self.parent.updatemenubar()
Esempio n. 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()
Esempio n. 4
0
File: Wtext.py Progetto: mmrvka/xbmc
 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()
Esempio n. 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)
Esempio n. 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)
Esempio n. 7
0
File: Wtext.py Progetto: mmrvka/xbmc
 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)