当前位置: 首页>>代码示例>>Python>>正文


Python QGuiApplication.clipboard方法代码示例

本文整理汇总了Python中PyQt5.QtGui.QGuiApplication.clipboard方法的典型用法代码示例。如果您正苦于以下问题:Python QGuiApplication.clipboard方法的具体用法?Python QGuiApplication.clipboard怎么用?Python QGuiApplication.clipboard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtGui.QGuiApplication的用法示例。


在下文中一共展示了QGuiApplication.clipboard方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: onClipboardChanged

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
 def onClipboardChanged(self, mode):
     if mode == QClipboard.Clipboard:
         if not QGuiApplication.clipboard().ownsClipboard():
             self.clipboardTimer.start()
         else:
             self.clipboardTimer.stop()
     elif mode == QClipboard.Selection:
         if not QGuiApplication.clipboard().ownsSelection():
             self.selectionTimer.start()
         else:
             self.selectionTimer.stop()
开发者ID:hluk,项目名称:infinitecopy,代码行数:13,代码来源:Clipboard.py

示例2: __init__

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
 def __init__(self, config_dict):
     super().__init__()
     self.config_dict = config_dict
     self.clipboard = QGuiApplication.clipboard()
     self.reconstruct = enable_rhc(config_dict["random_hit_chance"])(
         self.reconstruct
     )
     self.clipboard.dataChanged.connect(self.reconstruct)
开发者ID:gurpreetshanky,项目名称:chaos,代码行数:10,代码来源:chaosd.py

示例3: emitChanged

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
 def emitChanged(self, mode):
     clipboard = QGuiApplication.clipboard()
     mimeData = clipboard.mimeData()
     data = {}
     for format in self.formats:
         if mimeData.hasFormat(format):
             data[format] = mimeData.data(format)
     self.changed.emit(data)
开发者ID:hluk,项目名称:infinitecopy,代码行数:10,代码来源:Clipboard.py

示例4: __init__

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
    def __init__(self):
        QObject.__init__(self)
        clipboard = QGuiApplication.clipboard()
        clipboard.changed.connect(self.onClipboardChanged)

        self.clipboardTimer = QTimer()
        self.clipboardTimer.setInterval(500)
        self.clipboardTimer.setSingleShot(True)
        self.clipboardTimer.timeout.connect(self.onClipboardChangedAfterDelay)

        self.selectionTimer = QTimer()
        self.selectionTimer.setInterval(1000)
        self.selectionTimer.setSingleShot(True)
        self.selectionTimer.timeout.connect(self.onSelectionChangedAfterDelay)

        self.formats = set([mimeText])
开发者ID:hluk,项目名称:infinitecopy,代码行数:18,代码来源:Clipboard.py

示例5: __init__

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
    def __init__(self, parent = None):
        super().__init__(parent)
        self.app = QGuiApplication.instance()
        self._queue = deque()
        self.frontendpy = parent

        self._listener = threading.Thread(target = self.listenerThread, daemon = True,
                                          name = "frontend communication listener")
        self._listener.start()

        tasks = sys.argv[1:]
        if tasks:
            self.createTasksAction(tasks)

        self.urlExtractor = UrlExtractor(self)

        self._clipboard = QGuiApplication.clipboard()
        self.app.settings.applySettings.connect(self.slotWatchClipboardToggled)
开发者ID:mimers,项目名称:XwareDesktop,代码行数:20,代码来源:actions.py

示例6: getSelectedTextFunc

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
    return getSelectedTextFunc(desktop)

lock = threading.Lock()

def textCopied():
    with lock:
        print("copiedText:" + getSelectedText());
        sys.stdout.flush();

def selectingText():
    previousSelectedText = None;
    currentSelectedText = None;
    while True:
        currentSelectedText = getSelectedText();
        if currentSelectedText and currentSelectedText != previousSelectedText:
            with lock:
                print("selectedText:" + currentSelectedText);
                sys.stdout.flush();
            previousSelectedText = currentSelectedText;

        time.sleep(0.05);

t = threading.Thread(target=selectingText);
t.daemon = True;
t.start();

app = QGuiApplication(sys.argv);
clipboard = QGuiApplication.clipboard()
clipboard.dataChanged.connect(textCopied)
sys.exit(app.exec_())
开发者ID:Open365,项目名称:open365-base-with-dependencies-docker,代码行数:32,代码来源:office_clipboard.py

示例7: Q_ARG

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
        myObj = obj.findChild(QObject, "loginHandle")
        QMetaObject.invokeMethod(myObj, "loginResult", Qt.QueuedConnection, Q_ARG(QVariant, string))

    @pyqtSlot(str, str)
    def login(self, email, password):
        self.cw.authenticate(email, password)

    @pyqtSlot()
    def stop(self):
        self.cw.stop()
        sys.exit()


if __name__ == "__main__":
    app = QGuiApplication(sys.argv)
    clipboard = app.clipboard()

    # add icon
    app_icon = QIcon()
    app_icon.addFile(path.join("qml", "img", "logo.jpg"))
    app.setWindowIcon(app_icon)

    engine = QQmlApplicationEngine()
    ctx = engine.rootContext()
    py = QMLNameSpace(engine, clipboard)
    ctx.setContextProperty("main", engine)
    ctx.setContextProperty("py", py)

    # engine.addImportPath(path.join(getcwd(), 'qml'))
    engine.setImportPathList([path.join(getcwd(), "qml", "lib")])
开发者ID:CopyEverything,项目名称:CopyEverything-Desktop,代码行数:32,代码来源:gui.py

示例8: copyText

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
 def copyText(self, text):
     from PyQt5.QtGui import QGuiApplication
     clip = QGuiApplication.clipboard()
     clip.setText(text)
开发者ID:xianjunzhengbackup,项目名称:LinuxBackup,代码行数:6,代码来源:api.py

示例9: text

# 需要导入模块: from PyQt5.QtGui import QGuiApplication [as 别名]
# 或者: from PyQt5.QtGui.QGuiApplication import clipboard [as 别名]
 def text(self, text):
     clipboard = QGuiApplication.clipboard()
     return clipboard.setText(text)
开发者ID:hluk,项目名称:infinitecopy,代码行数:5,代码来源:Clipboard.py


注:本文中的PyQt5.QtGui.QGuiApplication.clipboard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。