Python gtk 模块,Clipboard() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用gtk.Clipboard()

项目:QGIS-CKAN-Browser    作者:BergWerkGIS    | 项目源码 | 文件源码
def init_gtk_clipboard():
    import gtk

    def copy_gtk(text):
        global cb
        cb = gtk.Clipboard()
        cb.set_text(text)
        cb.store()

    def paste_gtk():
        clipboardContents = gtk.Clipboard().wait_for_text()  # for python 2, returns None if the clipboard is blank.
        if clipboardContents is None:
            return ''
        else:
            return clipboardContents

    return copy_gtk, paste_gtk
项目:ci_edit    作者:google    | 项目源码 | 文件源码
def init_gtk_clipboard():
    import gtk

    def copy_gtk(text):
        global cb
        cb = gtk.Clipboard()
        cb.set_text(text)
        cb.store()

    def paste_gtk():
        clipboardContents = gtk.Clipboard().wait_for_text()
        # for python 2, returns None if the clipboard is blank.
        if clipboardContents is None:
            return ''
        else:
            return clipboardContents

    return copy_gtk, paste_gtk
项目:safetalk    作者:zjuchenyuan    | 项目源码 | 文件源码
def init_gtk_clipboard():
    import gtk

    def copy_gtk(text):
        global cb
        cb = gtk.Clipboard()
        cb.set_text(text)
        cb.store()

    def paste_gtk():
        clipboardContents = gtk.Clipboard().wait_for_text()
        # for python 2, returns None if the clipboard is blank.
        if clipboardContents is None:
            return ''
        else:
            return clipboardContents

    return copy_gtk, paste_gtk
项目:sixense    作者:a0726h77    | 项目源码 | 文件源码
def gtkGetClipboard():
    return gtk.Clipboard().wait_for_text()
项目:sixense    作者:a0726h77    | 项目源码 | 文件源码
def gtkSetClipboard(text):
    cb = gtk.Clipboard()
    cb.set_text(text)
    cb.store()
项目:sixense    作者:a0726h77    | 项目源码 | 文件源码
def gtkGetClipboard():
    return gtk.Clipboard().wait_for_text()
项目:sixense    作者:a0726h77    | 项目源码 | 文件源码
def gtkSetClipboard(text):
    cb = gtk.Clipboard()
    cb.set_text(text)
    cb.store()
项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda    作者:SignalMedia    | 项目源码 | 文件源码
def _pasteGtk():
    return gtk.Clipboard().wait_for_text()
项目:PyDataLondon29-EmbarrassinglyParallelDAWithAWSLambda    作者:SignalMedia    | 项目源码 | 文件源码
def _copyGtk(text):
    global cb
    cb = gtk.Clipboard()
    cb.set_text(text)
    cb.store()
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def copy_selection(self, cut=False):
        (store, paths) = self.view.get_selection().get_selected_rows()

        maybe_cut = []
        selection = []

        for path in paths:
            iter = store.get_iter(path)
            mem = self._get_memory(iter)
            selection.append(mem.dupe())
            maybe_cut.append((iter, mem))

        if cut:
            for iter, mem in maybe_cut:
                mem.empty = True
                job = common.RadioJob(self._set_memory_cb,
                                      "erase_memory", mem.number)
                job.set_desc(
                    _("Cutting memory {number}").format(number=mem.number))
                self.rthread.submit(job)

                self._set_memory(iter, mem)

        result = pickle.dumps((self._features, selection))
        clipboard = gtk.Clipboard(selection="CLIPBOARD")
        clipboard.set_text(result)
        clipboard.store()

        return cut  # Only changed if we did a cut
项目:chirp_fork    作者:mach327    | 项目源码 | 文件源码
def paste_selection(self):
        clipboard = gtk.Clipboard(selection="CLIPBOARD")
        clipboard.request_text(self._paste_selection)
项目:DealershipSimulation    作者:creechD    | 项目源码 | 文件源码
def _clipboard_init(self):
        if not Interface._clipboard:
            try:
                from gtk import Clipboard
                Interface._clipboard = Clipboard()
                Interface._clipboard_type = 'gtk'
            except ImportError:
                try:
                    from Tkinter import Tk
                    Interface._clipboard = Tk()
                    Interface._clipboard.withdraw()
                    Interface._clipboard_type = 'tk'
                except ImportError:
                    try:
                        global StringSelection, DataFlavor, UnsupportedFlavorException, IOException, IllegalStateException
                        from java.awt.datatransfer import StringSelection, DataFlavor
                        from java.awt.datatransfer import UnsupportedFlavorException
                        from java.io import IOException
                        from java.lang import IllegalStateException
                        from java.awt import Toolkit
                        Interface._clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
                        Interface._clipboard_type = 'jtk'
                    except ImportError:
                        try:
                            engine.display.textbox_init()
                            Interface._clipboard = engine.display.textarea
                            Interface._clipboard_type = 'js'
                        except AttributeError:
                            Interface._clipboard = None
                            Interface._clipboard_type = None
        if Interface._clipboard_type == 'gtk':
            self.get_clipboard = self._get_clipboard_gtk
            self.set_clipboard = self._set_clipboard_gtk
        elif Interface._clipboard_type == 'tk':
            self.get_clipboard = self._get_clipboard_tk
            self.set_clipboard = self._set_clipboard_tk
        elif Interface._clipboard_type == 'jtk':
            self.get_clipboard = self._get_clipboard_jtk
            self.set_clipboard = self._set_clipboard_jtk
        elif Interface._clipboard_type == 'js':
            self.get_clipboard = self._get_clipboard_js
            self.set_clipboard = self._set_clipboard_js