mirror of
https://github.com/TriM-Organization/Musicreater.git
synced 2025-02-07 19:36:46 +08:00
将错误报告改为类来调用
This commit is contained in:
parent
ee5fd84d51
commit
2f6c0e23d7
@ -224,9 +224,7 @@ def __main__():
|
|||||||
def exitapp():
|
def exitapp():
|
||||||
global is_save
|
global is_save
|
||||||
if is_save != True:
|
if is_save != True:
|
||||||
result = tkinter.messagebox.askyesno(title='提示', message='您当前的项目已修改但未存储,是否先保存当前项目?')
|
if tkinter.messagebox.askyesno(title='提示', message='您当前的项目已修改但未存储,是否先保存当前项目?'):
|
||||||
log('询问是否存储:'+str(result))
|
|
||||||
if result:
|
|
||||||
SaveProject()
|
SaveProject()
|
||||||
log("程序正常退出")
|
log("程序正常退出")
|
||||||
|
|
||||||
@ -959,11 +957,11 @@ def __main__():
|
|||||||
|
|
||||||
#使用邮件反馈bug
|
#使用邮件反馈bug
|
||||||
def sendBugReport():
|
def sendBugReport():
|
||||||
from msctspt.bugReporter import emailReport
|
from msctspt.bugReporter import report
|
||||||
name = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的称呼')
|
name = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的称呼')
|
||||||
contact = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的联系方式')
|
contact = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您的联系方式')
|
||||||
describetion = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您对问题的描述')
|
describetion = tkinter.simpledialog.askstring(title = '邮件反馈信息输入',prompt='您对问题的描述')
|
||||||
emailReport(name,contact,describetion);
|
report(name,contact,describetion).emailReport()
|
||||||
del name,contact,describetion
|
del name,contact,describetion
|
||||||
|
|
||||||
|
|
||||||
|
3
log/2021-11-24 12_37_45.msct.log
Normal file
3
log/2021-11-24 12_37_45.msct.log
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
12:37:45 更新执行位置,当前文件位置F:\W-YI\Programming\音·创\程序\Musicreater.py
|
||||||
|
12:37:45 启动root.mainloop(窗口)
|
||||||
|
12:38:04 程序正常退出
|
@ -33,15 +33,16 @@ def makeZip(sourceDir, outFilename,compression = 8,exceptFile = None):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
'''
|
|
||||||
|
|
||||||
# ============================不会写类就别逞强
|
|
||||||
|
|
||||||
|
|
||||||
class report():
|
class report():
|
||||||
|
'''发送报告以及相应的任务处理'''
|
||||||
def __init__(self,senderName:str = 'Unknown',senderContact:str = 'None',describetion:str = ''):
|
def __init__(self,senderName:str = 'Unknown',senderContact:str = 'None',describetion:str = ''):
|
||||||
|
''':param senderName 发送者名称
|
||||||
self.author = 'Yee King (金羿)'
|
:param senderContact 发送者联系方式
|
||||||
|
:param describetion 问题描述'''
|
||||||
self.senderName = senderName;
|
self.senderName = senderName;
|
||||||
self.senderContact = senderContact;
|
self.senderContact = senderContact;
|
||||||
self.describetion = describetion;
|
self.describetion = describetion;
|
||||||
@ -50,9 +51,9 @@ class report():
|
|||||||
if not self.senderContact :
|
if not self.senderContact :
|
||||||
self.senderContact = 'None';
|
self.senderContact = 'None';
|
||||||
|
|
||||||
@property
|
|
||||||
'''
|
|
||||||
def emailReport(senderName:str = 'Unknown',senderContact:str = 'None',describetion:str = ''):
|
def emailReport(self):
|
||||||
'''使用E-mail方法发送当前的日志和临时文件等'''
|
'''使用E-mail方法发送当前的日志和临时文件等'''
|
||||||
import smtplib
|
import smtplib
|
||||||
from email.mime.text import MIMEText;
|
from email.mime.text import MIMEText;
|
||||||
@ -64,17 +65,17 @@ def emailReport(senderName:str = 'Unknown',senderContact:str = 'None',describeti
|
|||||||
log("添加标题与正文")
|
log("添加标题与正文")
|
||||||
msg = MIMEMultipart();
|
msg = MIMEMultipart();
|
||||||
#发送者与接收者显示名称
|
#发送者与接收者显示名称
|
||||||
msg["From"] = Header(senderName,'utf-8');
|
msg["From"] = Header(self.senderName,'utf-8');
|
||||||
msg["To"] = Header("W-YI (QQ2647547478)",'utf-8');
|
msg["To"] = Header("W-YI (QQ2647547478)",'utf-8');
|
||||||
#标题
|
#标题
|
||||||
msg["Subject"] = '发送来自 '+senderName+' 的BUG错误报告';
|
msg["Subject"] = '发送来自 '+self.senderName+' 的BUG错误报告';
|
||||||
#正文
|
#正文
|
||||||
msg.attach(MIMEText("来自"+senderName+"( "+senderContact+" )的错误描述:\n"+describetion,'plain','utf-8'));
|
msg.attach(MIMEText("来自"+self.senderName+"( "+self.senderContact+" )的错误描述:\n"+self.describetion,'plain','utf-8'));
|
||||||
log("添加完毕,正在生成压缩包...")
|
log("添加完毕,正在生成压缩包...")
|
||||||
makeZip("./","Temps&Logs.zip",exceptFile="Temps&Logs.zip");
|
makeZip("./","Temps&Logs.zip",exceptFile="Temps&Logs.zip");
|
||||||
attafile=MIMEText(open("Temps&Logs.zip",'rb').read(),"base64",'gb2312');
|
attafile=MIMEText(open("Temps&Logs.zip",'rb').read(),"base64",'gb2312');
|
||||||
attafile["Content-Type"] = 'application/octet-stream';
|
attafile["Content-Type"] = 'application/octet-stream';
|
||||||
attafile["Content-Disposition"] = 'attachment;filename="BugReport_from_'+senderName+'.zip"';
|
attafile["Content-Disposition"] = 'attachment;filename="BugReport_from_'+self.senderName+'.zip"';
|
||||||
msg.attach(attafile);
|
msg.attach(attafile);
|
||||||
log("完毕,准备发送")
|
log("完毕,准备发送")
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user