reportBug.py :  » GUI » Kodos » kodos-2.4.9 » modules » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » GUI » Kodos 
Kodos » kodos 2.4.9 » modules » reportBug.py
#  reportBug.py: -*- Python -*-  DESCRIPTIVE TEXT.

from reportBugBA import reportBugBA
from util import *
import qt 
import sys
import string
import smtplib
from version import VERSION
import xpm

AUTHOR_ADDR = "phil_schwartz@users.sourceforge.net"

class reportBug(reportBugBA):
    def __init__(self, parent=None, name=None):
        reportBugBA.__init__(self, parent, name)
        self.parent = parent
        self.kodos_main = parent.kodos_main
        self.populate()
        

    def populate(self):
        self.OSEdit.setText(sys.platform)
        pyvers = string.replace(sys.version, "\n", " - ")
        self.pythonVersionEdit.setText(pyvers)
        self.PyQtVersionEdit.setText(qt.QT_VERSION_STR)
        self.regexMultiLineEdit.setText(self.kodos_main.regexMultiLineEdit.text())
        self.stringMultiLineEdit.setText(self.kodos_main.stringMultiLineEdit.text())


    def cancel_slot(self):
        self.parent.close()

    def submit_slot(self):
        addr = str(self.emailAddressEdit.text())
        if not addr:
            msg = self.tr(
                "An email address is necessary so that the author "
                "can contact you.  Your email address will not "
                "be used for any other purposes.")

            QMessageBox.information(None,
                                    self.tr("You must supply a valid email address"),
                                    msg)
            return 

        msg = "Subject: Kodos bug report\n\n"
        msg += "Kodos Version: %s\n" % VERSION
        msg += "Operating System: %s\n" % unicode(self.OSEdit.text())
        msg += "Python Version: %s\n" % unicode(self.pythonVersionEdit.text())
        msg += "PyQt Version: %s\n" % unicode(self.PyQtVersionEdit.text())
        msg += "\n" + "=" * 70 + "\n"
        msg += "Regex:\n%s\n" % unicode(self.regexMultiLineEdit.text())
        msg += "=" * 70 + "\n"
        msg += "String:\n%s\n" % unicode(self.stringMultiLineEdit.text())
        msg += "=" * 70 + "\n"
        msg += "Comments:\n%s\n" % unicode(self.commentsMultiLineEdit.text())
        email_server = unicode(self.kodos_main.prefs.emailServerEdit.text()) or "localhost"
        try:
            server = smtplib.SMTP(email_server)
            server.sendmail(addr, AUTHOR_ADDR, msg)
            server.quit()
            QMessageBox.information(None,
                                    self.tr("Bug report sent"),
                                    self.tr("Your bug report has been sent."))
            self.parent.close()
        except Exception, e:
            QMessageBox.information(None,
                                    self.tr("An exception occurred sending bug report"),
                                    str(e))
        

class reportBugWindow(QMainWindow):
    def __init__(self, kodos_main):
        self.kodos_main = kodos_main

        QMainWindow.__init__(self, None, None,
                             Qt.WType_TopLevel | Qt.WDestructiveClose)
        
        self.setGeometry(100, 50, 800, 600)
        self.setCaption(self.tr("Report a Bug"))
        #self.setIcon(getPixmap("kodos_icon.png", "PNG"))
        self.setIcon(QPixmap(xpm.kodosIcon))
        self.bug_report = reportBug(self)
        self.setCentralWidget(self.bug_report)

        
        self.createMenu()
        self.createToolBar()

        self.show()


    def createMenu(self):
        self.filemenu = QPopupMenu()
        id = self.filemenu.insertItem(self.tr("&Close"), self, SLOT("close()"))

        self.menubar = QMenuBar(self)
        self.menubar.insertItem(self.tr("&File"), self.filemenu)


    def createToolBar(self):
        toolbar = QToolBar(self)
        toolbar.setStretchableWidget(self.menubar)
        self.logolabel = kodos_toolbar_logo(toolbar)
 
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.