Skip to content

Commit 45a6f79

Browse files
author
tiann
committed
修复文本粘贴的时候出错的一个问题;(不会有界面上的BUG;但是对下一个文本格式的支持有BUG
1 parent 1242dd5 commit 45a6f79

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

clipboard.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ def get_paste_img_file():
1414
pb = NSPasteboard.generalPasteboard()
1515
data_type = pb.types()
1616
# if img file
17-
# print data_type
17+
print data_type
1818
# always generate png format img
1919
png_file = tempfile.NamedTemporaryFile(suffix="png")
2020

2121
supported_image_format = (NSPasteboardTypePNG, NSPasteboardTypeTIFF)
22-
if any(filter(lambda f: f in data_type, supported_image_format)):
22+
if NSPasteboardTypeString in data_type:
23+
# make this be first, because plain text may be TIFF format?
24+
# string todo, recognise url of png & jpg
25+
pass
26+
elif any(filter(lambda f: f in data_type, supported_image_format)):
2327
# do not care which format it is, we convert it to png finally
2428
# system screen shotcut is png, QQ is tiff
2529
tmp_img_file = tempfile.NamedTemporaryFile()
@@ -33,11 +37,7 @@ def get_paste_img_file():
3337
# close the file explicitly
3438
tmp_img_file.close()
3539
return png_file
36-
37-
elif NSPasteboardTypeString in data_type:
38-
# string todo, recognise url of png & jpg
39-
pass
40-
40+
4141
if __name__ == '__main__':
4242
get_paste_img_file()
4343

markdown img.alfredworkflow

38 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)