Bug reporting system

This commit is contained in:
Kiooeht 2011-06-01 01:31:43 -07:00
parent 029cc95a16
commit aedb054d90
5 changed files with 358 additions and 209 deletions

View file

@ -37,6 +37,7 @@ CHANGELOG
* Check for Pesterchum updates - Kiooeht [evacipatedBox]
* Memo OP options: Secret, Invite-only, Mute - Kiooeht [evacipatedBox]
* Notify user if channel blocks message - Kiooeht [evacipatedBox]
* Bug reporter - Kiooeht [evacipatedBox]
* Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

@ -10,6 +10,7 @@ Features
* More complex quirks: by-sound
* Spy mode
* Turn @ and # links on/off?
* "someone has friended you" notifier
Bugs
----

74
bugreport.py Normal file
View file

@ -0,0 +1,74 @@
from PyQt4 import QtGui, QtCore
import urllib
import version
class BugReporter(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.mainwindow = parent
self.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
self.setWindowTitle("Report a Bug")
self.setModal(False)
self.title = QtGui.QLabel("Bug Report:")
layout_0 = QtGui.QVBoxLayout()
layout_0.addWidget(self.title)
layout_0.addWidget(QtGui.QLabel("Operating System (ex. Windows 7, Ubuntu 10.10):"))
self.os = QtGui.QLineEdit(self)
self.os.setStyleSheet("background:white; font-weight:bold; color:black; font-size: 10pt;")
layout_0.addWidget(self.os)
layout_0.addWidget(QtGui.QLabel("Description of bug:"))
descLabel = QtGui.QLabel("Include as much information as possible\n(theme, related options, what you were doing at the time, etc.)")
font = descLabel.font()
font.setPointSize(8)
descLabel.setFont(font)
layout_0.addWidget(descLabel)
self.textarea = QtGui.QTextEdit(self)
self.textarea.setStyleSheet("background:white; font-weight:normal; color:black; font-size: 10pt;")
layout_0.addWidget(self.textarea)
self.ok = QtGui.QPushButton("SEND", self)
self.ok.setDefault(True)
self.connect(self.ok, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('sendReport()'))
self.cancel = QtGui.QPushButton("CANCEL", self)
self.connect(self.cancel, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('reject()'))
layout_2 = QtGui.QHBoxLayout()
layout_2.addWidget(self.cancel)
layout_2.addWidget(self.ok)
layout_0.addLayout(layout_2)
self.setLayout(layout_0)
@QtCore.pyqtSlot()
def sendReport(self):
name = unicode(self.mainwindow.profile().handle)
os = unicode(self.os.text())
msg = unicode(self.textarea.toPlainText())
if len(os) <= 0 or len(msg) <= 0:
msgbox = QtGui.QMessageBox()
msgbox.setStyleSheet(self.mainwindow.theme["main/defaultwindow/style"])
msgbox.setText("You must fill out all fields first!")
msgbox.setStandardButtons(QtGui.QMessageBox.Ok)
ret = msgbox.exec_()
return
QtGui.QDialog.accept(self)
data = urllib.urlencode({"name":name, "version": version._pcVersion, "os":os, "msg":msg})
print "Sending..."
f = urllib.urlopen("http://distantsphere.com/pc/reporter.php", data)
text = f.read()
print text
if text == "success!":
print "Sent!"
else:
print "Problems ):"

View file

@ -5,29 +5,31 @@
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
import sys, traceback
error = 0
try:
import os, shutil
from stat import *
from string import Template
import os, sys, shutil
from stat import *
from string import Template
_PLATFORM = sys.platform
if _PLATFORM in ['win32','cygwin','darwin','os2','os2emx','riscos','atheos']:
_PLATFORM = sys.platform
if _PLATFORM in ['win32','cygwin','darwin','os2','os2emx','riscos','atheos']:
print "Whoa there buddy! This installation script isn't meant to be run on your OS."
exit()
if os.getuid() != 0:
if os.getuid() != 0:
print "This program must be run as root (sudo)."
exit()
_HOME = os.environ['HOME']
_USER = os.environ['SUDO_USER']
_UID = int(os.environ['SUDO_UID'])
_GID = int(os.environ['SUDO_GID'])
# fix home if it's root weirdness
if _HOME.find("root") != -1:
_HOME = os.environ['HOME']
_USER = os.environ['SUDO_USER']
_UID = int(os.environ['SUDO_UID'])
_GID = int(os.environ['SUDO_GID'])
# fix home if it's root weirdness
if _HOME.find("root") != -1:
_HOME = "/home/"+_USER
def setPermissions(path):
def setPermissions(path):
os.chown(path, _UID, _GID)
for file_ in os.listdir(path):
filePath = os.path.join(path,file_)
@ -36,7 +38,7 @@ def setPermissions(path):
else:
os.chown(filePath, _UID, _GID)
def findPesterchum(path):
def findPesterchum(path):
for f in os.listdir(path):
filePath = os.path.join(path, f)
if os.path.isdir(filePath):
@ -48,14 +50,14 @@ def findPesterchum(path):
elif f == "pesterchum.py":
return path
if not os.path.exists(_HOME+"/.pcInstallLoc"):
if not os.path.exists(_HOME+"/.pcInstallLoc"):
print "Welcome to the Pesterchum 3.14 Easy Installer (for Linux)!\n\
Created by Kiooeht [evacipatedBox] May 28th-29th, 2011.\n\
License: WTFPL\n\
\n\
Leaving an option blank will accept it's default [in brackets]\n\
Are you ready to begin your MAGICAL JOURNEY?!\n\
Of course you are!!! ::::D"
Leaving an option blank will accept it's default [in brackets]\n\
Are you ready to begin your MAGICAL JOURNEY?!\n\
Of course you are!!! ::::D"
# ask user about things
while 1:
install = raw_input("Install location [~/.pesterchum]: ")
@ -160,7 +162,7 @@ Of course you are!!! ::::D"
f.close()
os.chown(_HOME+"/Pesterchum.desktop", _UID, _GID)
os.chmod(_HOME+"/Pesterchum.desktop", S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
else:
else:
print "Welcome to the Pesterchum 3.14 Easy Uninstaller (for Linux)!\n\
Created by Kiooeht [evacipatedBox] May 28th-29th, 2011.\n\
License: WTFPL\n"
@ -220,3 +222,62 @@ else:
break
else:
print "Invalid input, try again"
except KeyboardInterrupt:
print ""
except Exception, e:
error = -1
finally:
if error == -1:
print "Oh noes!! It seems an error has occurred!"
lineN = traceback.extract_tb(sys.exc_info()[2])[-1][1]
print "The error occurred on line %s:" % lineN
formatted_lines = traceback.format_exc().splitlines()
print " '" + formatted_lines[-2] + "'"
print formatted_lines[-1]
while 1:
print "\nWould you like to (s)end a bug report,"
send = raw_input("view the (f)ull error message, or (n)either? [s/f/n]: ")
if send.lower() == "n":
act = 2;break
elif send.lower() == "s":
act = 0;break
elif send.lower() == "f":
print "!---------------BEGIN ERROR MESSAGE---------------!"
for l in formatted_lines:
print l
print "!----------------END ERROR MESSAGE----------------!"
send = raw_input("Would you like to send this error message? [y/n]: ")
if send.lower() == "y":
act = 0;break
elif send.lower() == "n":
act = 2;break
else:
print "What was that?"
if act == 2:
print "Okay"
elif act == 0:
print "Thank you for taking time out of your day to complete a bug report."
print "Fields marked with an asterisk (*) are required."
name = raw_input("Your Name: ")
while 1:
os = raw_input("OS (include version) (ex. Ubuntu 10.10) [*]: ")
if os: break
else: print "This field is required."
while 1:
msg = raw_input("Short description of problem [*]: ")
if msg: break
else: print "This field is required."
import urllib, json
data = urllib.urlencode({"name":name, "os":os, "msg":msg, "short":formatted_lines[-1], "long":json.dumps(formatted_lines)})
try:
print "Sending..."
f = urllib.urlopen("http://distantsphere.com/pc/easyInstall.php", data)
text = f.read()
print text
if text == "success!":
print "Sent!"
else:
print "There seems to have been a problem sending your bug report! ):"
except:
print "There seems to have been a problem sending your bug report! ):"

View file

@ -52,6 +52,7 @@ from parsetools import convertTags, addTimeInitial, themeChecker, ThemeException
from memos import PesterMemo, MemoTabWindow, TimeTracker
from irc import PesterIRC
from logviewer import PesterLogUserSelect, PesterLogViewer
from bugreport import BugReporter
_datadir = QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.DataLocation)+"Pesterchum/"
canon_handles = ["apocalypseArisen", "arsenicCatnip", "arachnidsGrip", "adiosToreador", \
@ -1507,12 +1508,16 @@ class PesterWindow(MovingWindow):
self.aboutAction = QtGui.QAction(self.theme["main/menus/help/about"], self)
self.connect(self.aboutAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('aboutPesterchum()'))
self.reportBugAction = QtGui.QAction("REPORT BUG", self)
self.connect(self.reportBugAction, QtCore.SIGNAL('triggered()'),
self, QtCore.SLOT('reportBug()'))
helpmenu = self.menu.addMenu(self.theme["main/menus/help/_name"])
self.helpmenu = helpmenu
self.helpmenu.addAction(self.helpAction)
self.helpmenu.addAction(self.botAction)
self.helpmenu.addAction(self.nickServAction)
self.helpmenu.addAction(self.aboutAction)
self.helpmenu.addAction(self.reportBugAction)
self.closeButton = WMButton(PesterIcon(self.theme["main/close/image"]), self)
self.setButtonAction(self.closeButton, self.config.closeAction(), -1)
@ -2709,6 +2714,13 @@ class PesterWindow(MovingWindow):
@QtCore.pyqtSlot()
def launchHelp(self):
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://nova.xzibition.com/~illuminatedwax/help.html", QtCore.QUrl.TolerantMode))
@QtCore.pyqtSlot()
def reportBug(self):
if hasattr(self, 'bugreportwindow') and self.bugreportwindow:
return
self.bugreportwindow = BugReporter(self)
self.bugreportwindow.exec_()
self.bugreportwindow = None
@QtCore.pyqtSlot(QtCore.QString, QtCore.QString)
def nickCollision(self, handle, tmphandle):