Python PyQt5.QtWidgets.QApplication 模块,clipboard() 实例源码

我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用PyQt5.QtWidgets.QApplication.clipboard()

项目:dayworkspace    作者:copie    | 项目源码 | 文件源码
def __init__(self):
        self.app = QApplication(sys.argv)
        self.mainWindow = QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.mainWindow)

        self.Dialog = QtWidgets.QDialog()
        self.ui2 = Ui_Form()
        self.ui2.setupUi(self.Dialog)

        self.ui.textEdit.setReadOnly(True)
        self.clipboard = QApplication.clipboard()
        self.clipboard.selectionChanged.connect(self.fanyi)
        self.mainWindow.setWindowTitle("????")
        self.mainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.ui2.lineEdit.editingFinished.connect(self.callInput)
        self.Dialog.moveEvent = self.mainMove
        self.wordutil = wordutil()
        self.time = time.time()
        self.ui.textEdit.mouseDoubleClickEvent = self.inputText
项目:dayworkspace    作者:copie    | 项目源码 | 文件源码
def fanyi(self):
        if time.time() - self.time < 0.1:
            print("???")
            return
        self.time = time.time()
        if self.ui.textEdit.hasFocus():
            return
        text = self.clipboard.text(self.clipboard.Selection)
        if len(text) > 20:
            return
        self.mainWindow.move(*self._position())
        texttmp = ""
        for c in text:
            if c.isupper():
                texttmp += " " + c
            else:
                texttmp += c
        text = texttmp
        text = text.strip(' ')
        if text != '':
            text = self.wordutil.execfind(text)
            self.ui.textEdit.clear()
            self.ui.textEdit.insertHtml(text)
项目:TrezorSymmetricFileEncryption    作者:8go    | 项目源码 | 文件源码
def selectionChanged(self):
        """
        called whenever selected text in textarea is changed
        """
        # self.textBrowser.copy()  # copy selected to clipboard
        # self.settings.mlogger.log("Copied text to clipboard: %s" % self.clipboard.text(),
        #   logging.DEBUG, "Clipboard")
        pass
项目:TrezorSymmetricFileEncryption    作者:8go    | 项目源码 | 文件源码
def copy2Clipboard(self):
        self.textBrowser.copy()  # copy selected to clipboard
        # This is content from the Status textarea, so no secrets here, we can log it
        self.settings.mlogger.log("Copied text to clipboard: %s" % self.clipboard.text(),
            logging.DEBUG, "Clipboard")
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def do_clip(self):
        buf = io.BytesIO()
        self.my_figure.savefig(buf)
        QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
        buf.close()
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def do_clip(self):
        buf = io.BytesIO()
        self.fig.savefig(buf)
        QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
        buf.close()
项目:opcua-widgets    作者:FreeOpcUa    | 项目源码 | 文件源码
def _copy_value(self, position):
        it = self.get_current_item(1)
        if it:
            QApplication.clipboard().setText(it.text())
项目:opcua-widgets    作者:FreeOpcUa    | 项目源码 | 文件源码
def copy_path(self):
        path = self.get_current_path()
        path_str = ",".join(path)
        QApplication.clipboard().setText(path_str)
项目:opcua-widgets    作者:FreeOpcUa    | 项目源码 | 文件源码
def copy_nodeid(self):
        node = self.get_current_node()
        text = node.nodeid.to_string()
        QApplication.clipboard().setText(text)
项目:persepolis    作者:persepolisdm    | 项目源码 | 文件源码
def dropEvent(self, droplink):
        link_clipborad = QApplication.clipboard()
        link_clipborad.clear(mode=link_clipborad.Clipboard)
        link_string = droplink.mimeData().text()
        link_clipborad.setText(str(link_string), mode=link_clipborad.Clipboard)
        self.addLinkButtonPressed(button=link_clipborad)

# aria2 identifies each download by the ID called GID.
# The GID must be hex string of 16 characters,
# thus [0-9a-zA-Z] are allowed and leading zeros must 
# not be stripped. The GID all 0 is reserved and must
# not be used. The GID must be unique, otherwise error 
# is reported and the download is not added.
# gidGenerator generates GID for downloads