Python PyQt5.QtWidgets.QApplication.clipboard() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QApplication.clipboard(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: dayworkspace   Author: copie   File: fygui.py    (license) View Source Project 6 votes vote down vote up
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 
Example 2
Project: dayworkspace   Author: copie   File: fygui.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 3
Project: TrezorSymmetricFileEncryption   Author: 8go   File: dialogs.py    (license) View Source Project 5 votes vote down vote up
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 
Example 4
Project: TrezorSymmetricFileEncryption   Author: 8go   File: dialogs.py    (license) View Source Project 5 votes vote down vote up
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") 
Example 5
Project: gpvdm   Author: roderickmackenzie   File: band_graph.py    (license) View Source Project 5 votes vote down vote up
def do_clip(self):
		buf = io.BytesIO()
		self.my_figure.savefig(buf)
		QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
		buf.close() 
Example 6
Project: gpvdm   Author: roderickmackenzie   File: plot_widget.py    (license) View Source Project 5 votes vote down vote up
def do_clip(self):
		buf = io.BytesIO()
		self.fig.savefig(buf)
		QApplication.clipboard().setImage(QImage.fromData(buf.getvalue()))
		buf.close() 
Example 7
Project: opcua-widgets   Author: FreeOpcUa   File: attrs_widget.py    (license) View Source Project 5 votes vote down vote up
def _copy_value(self, position):
        it = self.get_current_item(1)
        if it:
            QApplication.clipboard().setText(it.text()) 
Example 8
Project: opcua-widgets   Author: FreeOpcUa   File: tree_widget.py    (license) View Source Project 5 votes vote down vote up
def copy_path(self):
        path = self.get_current_path()
        path_str = ",".join(path)
        QApplication.clipboard().setText(path_str) 
Example 9
Project: opcua-widgets   Author: FreeOpcUa   File: tree_widget.py    (license) View Source Project 5 votes vote down vote up
def copy_nodeid(self):
        node = self.get_current_node()
        text = node.nodeid.to_string()
        QApplication.clipboard().setText(text) 
Example 10
Project: persepolis   Author: persepolisdm   File: mainwindow.py    (license) View Source Project 5 votes vote down vote up
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