diff --git a/log.log b/log.log index 4adb211..57cf76d 100644 --- a/log.log +++ b/log.log @@ -47,3 +47,114 @@ 2023-12-07 13:45:28,376 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:281] - p_vew - INFO: ++将图片保存为临时文件++ 2023-12-07 13:45:28,380 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:285] - p_vew - INFO: ++清除临时文件夹++ 2023-12-07 13:45:28,394 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:257] - parse - INFO: [Decoded(data=b'\xe8\xbf\x99\xe6\x98\xaf\xe6\xa8\xa1\xe5\xbc\x8f\xe4\xba\x8c\xe7\x94\x9f\xe6\x88\x90\xe7\x9a\x84\xe5\xb8\xa6\xe6\x9c\x89\xe8\x83\x8c\xe6\x99\xaf\xe7\x9a\x84\xe4\xba\x8c\xe7\xbb\xb4\xe7\xa0\x81\xef\xbc\x9b\nThis is a QR code by with background mod2', type='QRCODE', rect=Rect(left=32, top=32, width=423, height=423), polygon=[Point(x=32, y=32), Point(x=34, y=455), Point(x=455, y=455), Point(x=455, y=34)], quality=1, orientation=None)] +2023-12-09 12:55:46,661 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:448] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 12:55:46,662 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:450] - - INFO: ---帮助模块加载完成--- +2023-12-09 12:55:46,663 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:453] - - INFO: ---反馈模块加载完成--- +2023-12-09 12:56:18,697 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:186] - bg - ERROR: 用户未选择生成模式 +2023-12-09 12:56:25,957 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:188] - bg - INFO: 用户选择 模式二 +2023-12-09 12:59:08,968 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:449] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 12:59:08,968 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:451] - - INFO: ---帮助模块加载完成--- +2023-12-09 12:59:08,969 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:454] - - INFO: ---反馈模块加载完成--- +2023-12-09 12:59:13,471 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:00:56,076 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:450] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:00:56,077 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:452] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:00:56,077 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:455] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:00:59,575 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:01:51,056 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:451] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:01:51,057 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:453] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:01:51,057 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:456] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:01:57,482 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:105] - logo - ERROR: 用户未选择生成模式 +2023-12-09 13:01:58,505 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:02:44,474 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:447] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:02:44,475 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:449] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:02:44,475 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:452] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:02:52,030 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:03:17,300 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:03:17,317 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:03:17,320 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:05:36,232 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:447] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:05:36,232 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:449] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:05:36,232 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:452] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:05:41,220 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:139] - bg - INFO: 用户选择 模式一 +2023-12-09 13:09:47,404 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:446] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:09:47,404 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:448] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:09:47,404 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:451] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:09:52,389 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:44] - produce - INFO: 用户选择 模式一 +2023-12-09 13:09:52,502 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:277] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:09:52,559 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:279] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:09:52,561 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:283] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:11:51,876 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:447] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:11:51,876 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:449] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:11:51,877 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:452] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:12:03,954 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:447] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:12:03,954 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:449] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:12:03,954 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:452] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:12:07,787 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:44] - produce - INFO: 用户选择 模式一 +2023-12-09 13:12:07,892 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:12:07,943 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:12:07,946 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:12:22,025 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:272] - save - INFO: E:/桌面/测试.png保存完成-生成用时:0.10s +2023-12-09 13:12:35,937 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:12:38,347 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:12:38,347 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 7339 +2023-12-09 13:12:38,407 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:12:38,422 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:12:38,425 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:12:49,191 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:12:50,806 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:12:50,806 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 7339 +2023-12-09 13:12:50,861 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:12:50,877 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:12:50,879 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:13:14,060 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:139] - bg - INFO: 用户选择 模式一 +2023-12-09 13:13:17,976 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:13:17,976 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 7339 +2023-12-09 13:13:18,039 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:13:18,059 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:13:18,061 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:13:39,494 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:81] - logo - INFO: 用户选择 模式一 +2023-12-09 13:13:42,220 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:13:42,220 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 7339 +2023-12-09 13:13:42,276 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:13:42,293 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:13:42,295 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:13:51,055 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:272] - save - INFO: E:/桌面/测试.png保存完成-生成用时:0.04s +2023-12-09 13:14:18,135 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:14:18,135 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 20270 +2023-12-09 13:14:18,140 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:278] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:14:18,155 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:280] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:14:18,157 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:284] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:14:18,163 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:253] - parse - INFO: [Decoded(data=b'123', type='QRCODE', rect=Rect(left=114, top=114, width=83, height=83), polygon=[Point(x=114, y=114), Point(x=114, y=197), Point(x=197, y=197), Point(x=197, y=114)], quality=1, orientation=None), Decoded(data=b'456', type='QRCODE', rect=Rect(left=9, top=9, width=294, height=294), polygon=[Point(x=9, y=9), Point(x=9, y=303), Point(x=303, y=303), Point(x=303, y=9)], quality=1, orientation=None)] +2023-12-09 13:33:50,780 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:446] - - INFO: ---GUI加载成功,程序启动---正在加载必要功能--- +2023-12-09 13:33:50,780 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:448] - - INFO: ---帮助模块加载完成--- +2023-12-09 13:33:50,780 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:451] - - INFO: ---反馈模块加载完成--- +2023-12-09 13:34:03,704 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:45] - produce - INFO: 用户选择 模式一 +2023-12-09 13:34:03,809 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:277] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:34:03,865 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:279] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:34:03,867 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:283] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:34:06,166 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:82] - logo - INFO: 用户选择 模式一 +2023-12-09 13:34:10,671 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:34:10,671 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 20270 +2023-12-09 13:34:10,732 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:277] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:34:10,748 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:279] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:34:10,750 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:283] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:34:19,825 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:271] - save - INFO: E:/桌面/测试.png.png保存完成-生成用时:0.04s +2023-12-09 13:34:25,599 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:34:25,599 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 21693 +2023-12-09 13:34:25,604 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:277] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:34:25,621 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:279] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:34:25,623 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:283] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:34:25,631 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:254] - parse - INFO: [Decoded(data=b'456', type='QRCODE', rect=Rect(left=114, top=114, width=83, height=83), polygon=[Point(x=114, y=114), Point(x=114, y=197), Point(x=197, y=197), Point(x=197, y=114)], quality=1, orientation=None), Decoded(data=b'456789', type='QRCODE', rect=Rect(left=9, top=9, width=294, height=294), polygon=[Point(x=9, y=9), Point(x=9, y=303), Point(x=303, y=303), Point(x=303, y=9)], quality=1, orientation=None)] +2023-12-09 13:34:33,327 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:34:33,327 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 20270 +2023-12-09 13:34:33,331 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:277] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:34:33,347 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:279] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:34:33,349 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:283] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:34:33,354 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:254] - parse - INFO: [Decoded(data=b'123', type='QRCODE', rect=Rect(left=114, top=114, width=83, height=83), polygon=[Point(x=114, y=114), Point(x=114, y=197), Point(x=197, y=197), Point(x=197, y=114)], quality=1, orientation=None), Decoded(data=b'456', type='QRCODE', rect=Rect(left=9, top=9, width=294, height=294), polygon=[Point(x=9, y=9), Point(x=9, y=303), Point(x=303, y=303), Point(x=303, y=9)], quality=1, orientation=None)] +2023-12-09 13:34:37,612 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:82] - logo - INFO: 用户选择 模式一 +2023-12-09 13:34:39,490 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IHDR' 16 13 +2023-12-09 13:34:39,490 - PngImagePlugin.py[line:201] - call - DEBUG: STREAM b'IDAT' 41 20270 +2023-12-09 13:34:39,546 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:277] - p_vew - INFO: ++创建临时文件夹++ +2023-12-09 13:34:39,562 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:279] - p_vew - INFO: ++将图片保存为临时文件++ +2023-12-09 13:34:39,566 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:283] - p_vew - INFO: ++清除临时文件夹++ +2023-12-09 13:34:41,197 - 二维码小工具-v3.2-BUCTPJP[LSG].pyw[line:140] - bg - INFO: 用户选择 模式一 diff --git "a/v3.2\344\275\277\347\224\250\350\257\264\346\230\216.txt" "b/v3.3\344\275\277\347\224\250\350\257\264\346\230\216.txt" similarity index 92% rename from "v3.2\344\275\277\347\224\250\350\257\264\346\230\216.txt" rename to "v3.3\344\275\277\347\224\250\350\257\264\346\230\216.txt" index 72009fa..1833271 100644 --- "a/v3.2\344\275\277\347\224\250\350\257\264\346\230\216.txt" +++ "b/v3.3\344\275\277\347\224\250\350\257\264\346\230\216.txt" @@ -1,3 +1,6 @@ +3.3更新历史: +1.修复弹出选择图片对话框后,如果不选择,直接退出的问题 +*************************************************** 3.2更新历史: 1.增加预览功能,生成后可以先在软件内预览 2.优化软件逻辑,生成后默认预览,分离出单独保存按键 diff --git "a/\344\272\214\347\273\264\347\240\201\345\260\217\345\267\245\345\205\267-v3.2-BUCTPJP[LSG].pyw" "b/\344\272\214\347\273\264\347\240\201\345\260\217\345\267\245\345\205\267-v3.3-BUCTPJP[LSG].pyw" similarity index 66% rename from "\344\272\214\347\273\264\347\240\201\345\260\217\345\267\245\345\205\267-v3.2-BUCTPJP[LSG].pyw" rename to "\344\272\214\347\273\264\347\240\201\345\260\217\345\267\245\345\205\267-v3.3-BUCTPJP[LSG].pyw" index 9b20d3d..451f00d 100644 --- "a/\344\272\214\347\273\264\347\240\201\345\260\217\345\267\245\345\205\267-v3.2-BUCTPJP[LSG].pyw" +++ "b/\344\272\214\347\273\264\347\240\201\345\260\217\345\267\245\345\205\267-v3.3-BUCTPJP[LSG].pyw" @@ -1,10 +1,10 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- ''' -@File : 二维码小工具-v3.2-BUCTPJP[LSG].pyw -@Time : 2023/12/07 12:11:08 +@File : 二维码小工具-v3.3-BUCTPJP[LSG].pyw +@Time : 2023/12/09 13:32:41 @Author : BUCTPJP -@Version : 3.2 +@Version : 3.3 @Contact : pjp1095765918@gmail.com @License : Copyright (C) 2023 , Inc. All Rights Reserved @Desc : None @@ -12,6 +12,7 @@ # here put the import lib + import qrcode,logging,time,sys,pyzbar,tempfile,os,webbrowser import pyzbar.pyzbar as pyzbar from PIL import Image,ImageEnhance @@ -41,7 +42,7 @@ def produce(): #正常 global runtime,img_s start = time.time() if myWindow.mod.checkedId() == 1: - logger.info('用户选择 模式一') + logger.info('用户选择 模式一') #TODO:info运行信息输出 string= myWindow.text1.toPlainText() #获取用户输入内容 qr = qrcode.QRCode( version=5, # 二维码的格子矩阵大小,可以是1到40,1最小为21*21,40是177*177 @@ -57,9 +58,9 @@ def produce(): #正常 p_vew(img_s) elif myWindow.mod.checkedId() == -1: QMessageBox.critical(myWindow, "错误", "未选择生成模式") - logger.error("用户未选择生成模式") + logger.error("用户未选择生成模式") #TODO:error错误信息输出 else: - logger.info('用户选择 模式二') + logger.info('用户选择 模式二') #TODO:info运行信息输出 string = myWindow.text1.toPlainText() #获取用户输入内容 qr = qrcode.QRCode( version=5, # 二维码的格子矩阵大小,可以是1到40,1最小为21*21,40是177*177 @@ -78,7 +79,7 @@ def logo(): #带logo global runtime,img_s start = time.time() if myWindow.mod.checkedId() == 1: - logger.info('用户选择 模式一') + logger.info('用户选择 模式一') #TODO:info运行信息输出 string = myWindow.text1.toPlainText() #获取用户输入内容 qr = qrcode.QRCode( version=5, # 二维码的格子矩阵大小,可以是1到40,1最小为21*21,40是177*177 @@ -91,17 +92,20 @@ def logo(): #带logo end = time.time() options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog - image= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) - image = image[0] - img = qr.make_image(back_color='#FFF',image_factory=StyledPilImage, module_drawer=RoundedModuleDrawer(),embeded_image_path=image) - img_s = img.convert('RGB') - runtime = "生成用时:{:.2f}s".format(end - start) - p_vew(img_s) + image,type = QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) + if image == (''): + logger.warning('用户未选择图片退出') #TODO:warning警告输出 + pass + else: + img = qr.make_image(back_color='#FFF',image_factory=StyledPilImage, module_drawer=RoundedModuleDrawer(),embeded_image_path=image) + img_s = img.convert('RGB') + runtime = "生成用时:{:.2f}s".format(end - start) + p_vew(img_s) elif myWindow.mod.checkedId() == -1: QMessageBox.critical(myWindow, "错误", "未选择生成模式") - logger.error("用户未选择生成模式") + logger.error("用户未选择生成模式") #TODO:error错误信息输出 else: - logger.info('用户选择 模式二') + logger.info('用户选择 模式二') #TODO:info运行信息输出 string= myWindow.text1.toPlainText() qr = qrcode.QRCode( version=5, # 二维码的格子矩阵大小,可以是1到40,1最小为21*21,40是177*177 @@ -115,30 +119,33 @@ def logo(): #带logo end1 = time.time() options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog - image= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) - start1 = time.time() - image = image[0] - icon = Image.open(image).convert('RGBA') #转换为RGBA4通道 - img_w, img_h = img.size #获得二维码尺寸 - size_w,size_h = int(img_w / 4),int(img_h / 4) - icon_w, icon_h = icon.size - if icon_w > size_w: #调整logo图片大小 - icon_w = size_w - if icon_h > size_h: - icon_h = size_h - icon = icon.resize((icon_w, icon_h),Image.Resampling.LANCZOS) - w,h = int((img_w - icon_w) / 2),int((img_h - icon_h) / 2) - img.paste(icon, (w, h), icon) #将logo图片贴在二维码指定位置 - img_s = img.convert('RGB') - end = time.time() - runtime = "生成用时:{:.2f}s".format((end1 - start)+(end - start1)) - p_vew(img_s) + image,type= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) + if image == (''): + logger.warning('用户未选择图片退出') #TODO:warning警告输出 + pass + else: + start1 = time.time() + icon = Image.open(image).convert('RGBA') #转换为RGBA4通道 + img_w, img_h = img.size #获得二维码尺寸 + size_w,size_h = int(img_w / 4),int(img_h / 4) + icon_w, icon_h = icon.size + if icon_w > size_w: #调整logo图片大小 + icon_w = size_w + if icon_h > size_h: + icon_h = size_h + icon = icon.resize((icon_w, icon_h),Image.Resampling.LANCZOS) + w,h = int((img_w - icon_w) / 2),int((img_h - icon_h) / 2) + img.paste(icon, (w, h), icon) #将logo图片贴在二维码指定位置 + img_s = img.convert('RGB') + end = time.time() + runtime = "生成用时:{:.2f}s".format((end1 - start)+(end - start1)) + p_vew(img_s) def bg(): #带背景 global runtime,img_s start = time.time() #开始计时 if myWindow.mod.checkedId() == 1: - logger.info('用户选择 模式一') + logger.info('用户选择 模式一') #TODO:info运行信息输出 string = myWindow.text1.toPlainText() box = 8 if myWindow.text7.toPlainText() == '': @@ -157,35 +164,38 @@ def bg(): #带背景 end1 = time.time() options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog - image= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) - start1 = time.time() - image = image[0] - bg = Image.open(image).convert('RGBA') - img_w, img_h = img.size - datas = img.getdata() - newData = [] - for item in datas: - if item[0] > 220 and item[1] > 220 and item[2] > 220:# 将白色(也可以调整为其他颜色)全部变为透明 - newData.append((255, 255, 255, 0)) - else: - newData.append(item) - img.putdata(newData) - bg_w,bg_h = bg.size #获得背景图片尺寸 - if bg_w != img_w: #改变背景图片大小与二维码一致 - bg_w = img_w - if bg_h != img_h: - bg_h = img_h - bg_ = bg.resize((bg_w, bg_h),Image.Resampling.LANCZOS) - bg_.paste(img,(0,0),img) #将二维码贴在背景图片上 - img_s = bg_.convert('RGB') - end = time.time() - runtime = "生成用时:{:.2f}s".format((end1 - start)+(end - start1)) - p_vew(img_s) + image,type= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) + if image == (''): + logger.warning('用户未选择图片退出') #TODO:warning警告输出 + pass + else: + start1 = time.time() + bg = Image.open(image).convert('RGBA') + img_w, img_h = img.size + datas = img.getdata() + newData = [] + for item in datas: + if item[0] > 220 and item[1] > 220 and item[2] > 220:# 将白色(也可以调整为其他颜色)全部变为透明 + newData.append((255, 255, 255, 0)) + else: + newData.append(item) + img.putdata(newData) + bg_w,bg_h = bg.size #获得背景图片尺寸 + if bg_w != img_w: #改变背景图片大小与二维码一致 + bg_w = img_w + if bg_h != img_h: + bg_h = img_h + bg_ = bg.resize((bg_w, bg_h),Image.Resampling.LANCZOS) + bg_.paste(img,(0,0),img) #将二维码贴在背景图片上 + img_s = bg_.convert('RGB') + end = time.time() + runtime = "生成用时:{:.2f}s".format((end1 - start)+(end - start1)) + p_vew(img_s) elif myWindow.mod.checkedId() == -1: QMessageBox.critical(myWindow, "错误", "未选择生成模式") - logger.error("用户未选择生成模式") + logger.error("用户未选择生成模式") #TODO:error错误信息输出 else: - logger.info('用户选择 模式二') + logger.info('用户选择 模式二') #TODO:info运行信息输出 string = myWindow.text1.toPlainText() box = 8 if myWindow.text7.toPlainText() == '': @@ -204,57 +214,64 @@ def bg(): #带背景 end1 = time.time() options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog - image= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) - start1 = time.time() - image = image[0] - bg = Image.open(image).convert('RGBA') - img_w, img_h = img.size - datas = img.getdata() - newData = [] - for item in datas: - if item[0] > 220 and item[1] > 220 and item[2] > 220: - newData.append((255, 255, 255, 0)) - else: - newData.append(item) - img.putdata(newData) - bg_w,bg_h = bg.size #获得背景图片尺寸 - if bg_w != img_w: #改变背景图片大小与二维码一致 - bg_w = img_w - if bg_h != img_h: - bg_h = img_h - bg_ = bg.resize((bg_w, bg_h),Image.Resampling.LANCZOS) - bg_.paste(img,(0,0),img) #将二维码贴在背景图片上 - img_s = bg_.convert('RGB') - end = time.time() - runtime = "生成用时:{:.2f}s".format((end1 - start)+(end - start1)) - p_vew(img_s) + image,type = QFileDialog.getOpenFileName(myWindow, "选择文件", "", "Image Files (*.jpg *.gif *.png *.jpeg);;All Files (*)", options=options) + if image == (''): + logger.warning('用户未选择图片退出') #TODO:warning警告输出 + pass + else: + start1 = time.time() + bg = Image.open(image).convert('RGBA') + img_w, img_h = img.size + datas = img.getdata() + newData = [] + for item in datas: + if item[0] > 220 and item[1] > 220 and item[2] > 220: + newData.append((255, 255, 255, 0)) + else: + newData.append(item) + img.putdata(newData) + bg_w,bg_h = bg.size #获得背景图片尺寸 + if bg_w != img_w: #改变背景图片大小与二维码一致 + bg_w = img_w + if bg_h != img_h: + bg_h = img_h + bg_ = bg.resize((bg_w, bg_h),Image.Resampling.LANCZOS) + bg_.paste(img,(0,0),img) #将二维码贴在背景图片上 + img_s = bg_.convert('RGB') + end = time.time() + runtime = "生成用时:{:.2f}s".format((end1 - start)+(end - start1)) + p_vew(img_s) def parse(): #解析 options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog - image= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "All Files (*);;Image Files (*.jpg *.gif *.png *.jpeg)", options=options) - start = time.time() - img = Image.open(image[0]) - #处理图片 - img = ImageEnhance.Brightness(img).enhance(1.0) #调整亮度 0~1~无穷 - img = ImageEnhance.Sharpness(img).enhance(1.0) #锐利化 0~1~2 - img = ImageEnhance.Contrast(img).enhance(1.0) #调整对比度 0~1~无穷 - img = ImageEnhance.Color(img).enhance(1.0) #调整色彩平衡 0~1~无穷 - #img = img.filter(SHARPEN) #SHARPEN:补偿图像的轮廓,增强图像的边缘及灰度跳变的部分,使图像变得清晰 - p_vew(img) - texts = pyzbar.decode(img) #解析到信息 - if texts == []: - result = '此图片不包含二维码,或未解析到信息,请重试或更换' - myWindow.text6.setText(result) - else: - for text in texts: #查找输出结果 - content = text.data.decode("utf-8") #data-内容;type-类型;rect-尺寸;polygon-边角定位点;quality-质量;orientation-方向 - result = "二维码中的内容是:\n{}".format(content) - myWindow.text6.setText(result) - end = time.time() - runtime = "用时:{:.2f}s".format(end - start) #解析内容格式化 - myWindow.text5.setText(runtime) - logger.info(texts) + image,type= QFileDialog.getOpenFileName(myWindow, "选择文件", "", "All Files (*);;Image Files (*.jpg *.gif *.png *.jpeg)", options=options) + if image == (''): + logger.warning('用户未选择图片退出') #TODO:warning警告输出 + pass + else: + start = time.time() + img = Image.open(image) + #处理图片 + img = ImageEnhance.Brightness(img).enhance(1.0) #调整亮度 0~1~无穷 + img = ImageEnhance.Sharpness(img).enhance(1.0) #锐利化 0~1~2 + img = ImageEnhance.Contrast(img).enhance(1.0) #调整对比度 0~1~无穷 + img = ImageEnhance.Color(img).enhance(1.0) #调整色彩平衡 0~1~无穷 + #img = img.filter(SHARPEN) #SHARPEN:补偿图像的轮廓,增强图像的边缘及灰度跳变的部分,使图像变得清晰 + p_vew(img) + texts = pyzbar.decode(img) #解析到信息 + if texts == []: + result = '此图片不包含二维码,或未解析到信息,请重试或更换' + myWindow.text6.setText(result) + else: + for text in texts: #查找输出结果 + content = text.data.decode("utf-8") #data-内容;type-类型;rect-尺寸;polygon-边角定位点;quality-质量;orientation-方向 + result = "二维码中的内容是:\n{}".format(content) + myWindow.text6.setText(result) + end = time.time() + runtime = "用时:{:.2f}s".format(end - start) #解析内容格式化 + myWindow.text5.setText(runtime) + logger.info(texts) #TODO:info运行信息输出 def clean(): #清空显示 myWindow.text5.clear() @@ -263,29 +280,30 @@ def clean(): #清空显示 def save(): #保存图像 options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog - file_path = QFileDialog.getSaveFileName(myWindow, "保存文件", "", "PNG(*.png);;JPG(*.jpg)", options=options) - if file_path == ('', ''): + file_path,type = QFileDialog.getSaveFileName(myWindow, "保存文件", "", "PNG(*.png);;JPG(*.jpg)", options=options) + if file_path == (''): + logger.warning('用户未选择图片退出') #TODO:warning警告输出 pass else: - file_path = file_path[0]+file_path[1][5:9] + file_path = file_path+type[5:9] if file_path: img_s.save(file_path,quality=100) - logger.info(file_path + '保存完成-'+ runtime) + logger.info(file_path + '保存完成-'+ runtime) #TODO:info运行信息输出 myWindow.text4.clear() myWindow.text4.setText(file_path+ '保存完成' + '\n' + runtime) def p_vew(img): #预览图像 temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.png') - logger.info('++创建临时文件夹++') + logger.info('++创建临时文件夹++') #TODO:info运行信息输出 img.resize((350, 350),Image.Resampling.LANCZOS).save(temp_file.name) - logger.info('++将图片保存为临时文件++') + logger.info('++将图片保存为临时文件++') #TODO:info运行信息输出 pixmap = QPixmap(temp_file.name) myWindow.privew.setPixmap(pixmap) temp_file.close() - logger.info('++清除临时文件夹++') + logger.info('++清除临时文件夹++') #TODO:info运行信息输出 def description(): #使用说明 - os.system(r'v3.2使用说明.txt') + os.system(r'v3.3使用说明.txt') def git_open(): #打开github webbrowser.open('https://github.com/BUCTPJP/QRCode-Tool-LSG/issues') @@ -445,12 +463,12 @@ class Child(QWidget): #子窗口 app = QApplication(sys.argv) myWindow = MyWindow() #实例化 myWindow.show() -logger.info('---GUI加载成功,程序启动---正在加载必要功能---') +logger.info('---GUI加载成功,程序启动---正在加载必要功能---') #TODO:info运行信息输出 myWindow.explain.triggered.connect(description) -logger.info('---帮助模块加载完成---') +logger.info('---帮助模块加载完成---') #TODO:info运行信息输出 myWindow.github.triggered.connect(git_open) myWindow.lsg.triggered.connect(lsg_open) -logger.info('---反馈模块加载完成---') +logger.info('---反馈模块加载完成---') #TODO:info运行信息输出 myWindow.about.triggered.connect(myWindow.open_child_window) app.exec_() myWindow.close() \ No newline at end of file