Added ability to paste image
This commit is contained in:
parent
2aea5df33c
commit
a984b624b5
1 changed files with 9 additions and 1 deletions
|
@ -73,8 +73,16 @@ class MessageArea(QtWidgets.QPlainTextEdit):
|
||||||
if text.startswith('file://'):
|
if text.startswith('file://'):
|
||||||
file_name = self.parse_file_name(text)
|
file_name = self.parse_file_name(text)
|
||||||
self.parent.profile.send_file(file_name)
|
self.parent.profile.send_file(file_name)
|
||||||
else:
|
elif text:
|
||||||
self.insertPlainText(text)
|
self.insertPlainText(text)
|
||||||
|
else:
|
||||||
|
image = QtWidgets.QApplication.clipboard().image()
|
||||||
|
if image is not None:
|
||||||
|
byte_array = QtCore.QByteArray()
|
||||||
|
buffer = QtCore.QBuffer(byte_array)
|
||||||
|
buffer.open(QtCore.QIODevice.WriteOnly)
|
||||||
|
image.save(buffer, 'PNG')
|
||||||
|
self.parent.profile.send_screenshot(bytes(byte_array.data()))
|
||||||
|
|
||||||
def parse_file_name(self, file_name):
|
def parse_file_name(self, file_name):
|
||||||
import urllib
|
import urllib
|
||||||
|
|
Loading…
Reference in a new issue