2014-10-29 02:06:21 -04:00
|
|
|
from PyQt5 import QtGui, QtCore, QtWidgets
|
2014-10-29 03:57:49 -04:00
|
|
|
import urllib.request, urllib.parse, urllib.error
|
2011-08-23 05:30:29 -04:00
|
|
|
import ostools
|
2011-06-01 04:31:43 -04:00
|
|
|
import version
|
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
class BugReporter(QtWidgets.QDialog):
|
2011-06-01 04:31:43 -04:00
|
|
|
def __init__(self, parent=None):
|
2014-10-29 02:06:21 -04:00
|
|
|
QtWidgets.QDialog.__init__(self, parent)
|
2011-06-01 04:31:43 -04:00
|
|
|
self.mainwindow = parent
|
|
|
|
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
|
|
|
|
self.setWindowTitle("Report a Bug")
|
|
|
|
self.setModal(False)
|
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
self.title = QtWidgets.QLabel("Bug Report:")
|
2011-06-01 04:31:43 -04:00
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
layout_0 = QtWidgets.QVBoxLayout()
|
2011-06-01 04:31:43 -04:00
|
|
|
layout_0.addWidget(self.title)
|
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
layout_0.addWidget(QtWidgets.QLabel("Chumhandle:"))
|
|
|
|
handleLabel = QtWidgets.QLabel("The best chumhandle to contact you at for further information.")
|
2011-08-23 05:30:29 -04:00
|
|
|
font = handleLabel.font()
|
|
|
|
font.setPointSize(8)
|
|
|
|
handleLabel.setFont(font)
|
|
|
|
layout_0.addWidget(handleLabel)
|
2014-10-29 02:06:21 -04:00
|
|
|
self.name = QtWidgets.QLineEdit(self)
|
2011-08-23 05:30:29 -04:00
|
|
|
self.name.setStyleSheet("background:white; font-weight:bold; color:black; font-size: 10pt;")
|
|
|
|
layout_0.addWidget(self.name)
|
2011-06-01 04:31:43 -04:00
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
layout_0.addWidget(QtWidgets.QLabel("Description of bug:"))
|
|
|
|
descLabel = QtWidgets.QLabel("Include as much information as possible\n(theme, related options, what you were doing at the time, etc.)")
|
2011-06-01 04:31:43 -04:00
|
|
|
font = descLabel.font()
|
|
|
|
font.setPointSize(8)
|
|
|
|
descLabel.setFont(font)
|
|
|
|
layout_0.addWidget(descLabel)
|
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
self.textarea = QtWidgets.QTextEdit(self)
|
2011-06-01 04:31:43 -04:00
|
|
|
self.textarea.setStyleSheet("background:white; font-weight:normal; color:black; font-size: 10pt;")
|
|
|
|
|
|
|
|
layout_0.addWidget(self.textarea)
|
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
self.ok = QtWidgets.QPushButton("SEND", self, clicked=self.sendReport)
|
2011-06-01 04:31:43 -04:00
|
|
|
self.ok.setDefault(True)
|
2014-10-29 02:06:21 -04:00
|
|
|
self.cancel = QtWidgets.QPushButton("CANCEL", self, clicked=self.reject)
|
|
|
|
layout_2 = QtWidgets.QHBoxLayout()
|
2011-06-01 04:31:43 -04:00
|
|
|
layout_2.addWidget(self.cancel)
|
|
|
|
layout_2.addWidget(self.ok)
|
|
|
|
|
|
|
|
layout_0.addLayout(layout_2)
|
|
|
|
|
|
|
|
self.setLayout(layout_0)
|
|
|
|
|
|
|
|
@QtCore.pyqtSlot()
|
|
|
|
def sendReport(self):
|
2014-10-29 03:57:49 -04:00
|
|
|
name = str(self.mainwindow.profile().handle)
|
|
|
|
bestname = str(self.name.text())
|
2011-08-23 05:30:29 -04:00
|
|
|
os = ostools.osVer()
|
|
|
|
full = ostools.platform.platform()
|
|
|
|
python = ostools.platform.python_version()
|
|
|
|
qt = QtCore.qVersion()
|
2014-10-29 03:57:49 -04:00
|
|
|
msg = str(self.textarea.toPlainText())
|
2011-06-01 04:31:43 -04:00
|
|
|
|
2011-08-23 05:30:29 -04:00
|
|
|
if len(bestname) <= 0 or len(msg) <= 0:
|
2014-10-29 02:06:21 -04:00
|
|
|
msgbox = QtWidgets.QMessageBox()
|
2011-06-01 04:31:43 -04:00
|
|
|
msgbox.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
|
|
|
|
msgbox.setText("You must fill out all fields first!")
|
2014-10-29 02:06:21 -04:00
|
|
|
msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
2011-06-01 04:31:43 -04:00
|
|
|
ret = msgbox.exec_()
|
|
|
|
return
|
|
|
|
|
2014-10-29 02:06:21 -04:00
|
|
|
QtWidgets.QDialog.accept(self)
|
2014-10-29 03:57:49 -04:00
|
|
|
data = urllib.parse.urlencode({"name":name, "version": version._pcVersion, "bestname":bestname, "os":os, "platform":full, "python":python, "qt":qt, "msg":msg})
|
|
|
|
print("Sending...")
|
|
|
|
f = urllib.request.urlopen("http://distantsphere.com/pc/reporter.php", data)
|
2011-06-01 04:31:43 -04:00
|
|
|
text = f.read()
|
2014-10-29 03:57:49 -04:00
|
|
|
print(text)
|
2011-06-01 04:31:43 -04:00
|
|
|
if text == "success!":
|
2014-10-29 03:57:49 -04:00
|
|
|
print("Sent!")
|
2011-06-01 04:31:43 -04:00
|
|
|
else:
|
2014-10-29 03:57:49 -04:00
|
|
|
print("Problems ):")
|
2011-06-01 04:31:43 -04:00
|
|
|
|