示例#1
0
class Widget(QtGui.QWidget, ScreenWidget):
    title = ki18n("Bug Reporting Tool")
    desc = ki18n("Goodbye Screen")

    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_bugWidget()
        self.ui.setupUi(self)
        self.bug_submitted = False

    def shown(self):
        if not self.bug_submitted:
            bugz = self.shared['bugzilla']
            title = self.shared['summary']
            description = self.shared['description']
            product = FEATURE_PRODUCT
            component = FEATURE_COMPONENT
            data = {'version': FEATURE_VERSION}
            if self.shared['type'] == 'bug':
                product = BUG_PRODUCT
                component = BUG_COMPONENT
                data['version'] = BUG_VERSION

            bid = bugz.post(product, component, title, description, **data)
            if bid == 0:
                raise RuntimeError, 'Error submitting bug to %s' % BUGZILLA_URL

            url = '%s?id=%d' % (urljoin(BUGZILLA_URL,
                                        config.urls['show']), bid)
            print url
            self.ui.linkText.setText('You can view your report online by '
                                     'clicking <a href=%s>here</a>' % url)

            # sumbitting attachments
            files = self.shared['attachments']
            for k in files:
                tmp = tempfile.NamedTemporaryFile()
                filename, mime, content = files[k]
                tmp.write(content)
                tmp.flush()
                tmp.seek(0)
                res = bugz.attach(bid, filename, k, tmp.name, mime, filename)
                if not res:
                    raise RuntimeError, 'Error uploading file %s' % filename
            self.bug_submitted = True

    def execute(self):
        return True

    @property
    def shared(self):
        return self.parent().parent().parent().shared_data
示例#2
0
class Widget(QtGui.QWidget, ScreenWidget):
    title = ki18n("Bug Reporting Tool")
    desc = ki18n("Goodbye Screen")

    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_bugWidget()
        self.ui.setupUi(self)
        self.bug_submitted = False

    def shown(self):
        if not self.bug_submitted:
            bugz = self.shared['bugzilla']
            title = self.shared['summary']
            description = self.shared['description']
            product = FEATURE_PRODUCT
            component = FEATURE_COMPONENT
            data = {'version': FEATURE_VERSION}
            if self.shared['type'] == 'bug':
                product = BUG_PRODUCT
                component = BUG_COMPONENT
                data['version'] = BUG_VERSION

            bid = bugz.post(product, component, title, description, **data)
            if bid == 0:
                raise RuntimeError, 'Error submitting bug to %s' % BUGZILLA_URL

            url = '%s?id=%d' % (urljoin(BUGZILLA_URL, config.urls['show']),
                                bid)
            print url
            self.ui.linkText.setText('You can view your report online by '
                                     'clicking <a href=%s>here</a>' % url)

            # sumbitting attachments
            files = self.shared['attachments']
            for k in files:
                tmp = tempfile.NamedTemporaryFile()
                filename, mime, content = files[k]
                tmp.write(content)
                tmp.flush()
                tmp.seek(0)
                res = bugz.attach(bid, filename, k, tmp.name, mime, filename)
                if not res:
                    raise RuntimeError, 'Error uploading file %s' % filename
            self.bug_submitted = True

    def execute(self):
        return True

    @property
    def shared(self):
        return self.parent().parent().parent().shared_data
示例#3
0
 def __init__(self, *args):
     QtGui.QWidget.__init__(self, None)
     self.ui = Ui_bugWidget()
     self.ui.setupUi(self)
     self.bug_submitted = False
示例#4
0
 def __init__(self, *args):
     QtGui.QWidget.__init__(self,None)
     self.ui = Ui_bugWidget()
     self.ui.setupUi(self)
     self.bug_submitted = False