1
0
鏡像自 https://github.com/arsenetar/dupeguru.git synced 2025-07-02 21:43:21 +00:00

Error reports are now dropped by FTP on drop.hardcoded.net

This commit is contained in:
Virgil Dupras 2014-01-26 15:03:24 -05:00
父節點 f66db94ffd
當前提交 1104e24408
共有 2 個檔案被更改,包括 27 行新增6 行删除

23
hscommon/error_report.py Normal file
查看文件

@ -0,0 +1,23 @@
# Created By: Virgil Dupras
# Created On: 2014-01-26
# Copyright 2014 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
import ftplib
import io
import time
import threading
def send_error_report(text):
def do():
conn = ftplib.FTP('drop.hardcoded.net')
conn.login()
conn.cwd('/drop')
textfp = io.BytesIO(text.encode('utf-8'))
cmd = 'STOR report%d.txt' % time.time()
conn.storbinary(cmd, textfp)
threading.Thread(target=do).start()

查看文件

@ -10,12 +10,12 @@ import traceback
import sys import sys
import os import os
from PyQt5.QtCore import Qt, QUrl, QCoreApplication, QSize from PyQt5.QtCore import Qt, QCoreApplication, QSize
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPlainTextEdit, QPushButton, from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPlainTextEdit, QPushButton,
QApplication) QApplication)
from hscommon.trans import trget from hscommon.trans import trget
from hscommon.error_report import send_error_report
from .util import horizontalSpacer from .util import horizontalSpacer
tr = trget('qtlib') tr = trget('qtlib')
@ -27,7 +27,7 @@ class ErrorReportDialog(QDialog):
self._setupUi() self._setupUi()
name = QCoreApplication.applicationName() name = QCoreApplication.applicationName()
version = QCoreApplication.applicationVersion() version = QCoreApplication.applicationVersion()
errorText = "Application Name: {0}\nVersion: {1}\n\n{2}".format(name, version, error) errorText = "Application Name: {}\nVersion: {}\n\n{}".format(name, version, error)
# Under windows, we end up with an error report without linesep if we don't mangle it # Under windows, we end up with an error report without linesep if we don't mangle it
errorText = errorText.replace('\n', os.linesep) errorText = errorText.replace('\n', os.linesep)
self.errorTextEdit.setPlainText(errorText) self.errorTextEdit.setPlainText(errorText)
@ -65,9 +65,7 @@ class ErrorReportDialog(QDialog):
self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout)
def accept(self): def accept(self):
text = self.errorTextEdit.toPlainText() send_error_report(self.errorTextEdit.toPlainText())
url = QUrl("mailto:support@hardcoded.net?SUBJECT=Error Report&BODY=%s" % text)
QDesktopServices.openUrl(url)
super().accept() super().accept()