Ejemplo n.º 1
0
    def on_buttonBox_accepted(self):
        ticket_type = self.ticketType.currentText()
        is_critical = self.highPrio.isChecked()
        subject = self.subject.text().strip()
        description = self.descText.toPlainText().strip()
        reproduction = self.reproText.toPlainText().strip()
        add_log = self.scriptBox.isChecked()

        if not subject or not description:
            self.showError('Please enter a ticket subject and description.')
            return

        try:
            ticket_num = self.submitIssue(ticket_type, is_critical, subject,
                                          description, reproduction, add_log)
        except Exception as e:
            self.showError(
                'Unfortunately, something went wrong submitting the '
                'ticket (%s). The tracker page will now be opened, '
                'please enter the ticket there.' % e)
            QDesktopServices.openUrl(QUrl(CREATE_TICKET_URL))
            return

        # switch to "thank you" display
        self.stacker.setCurrentIndex(1)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Close)
        self.ticketUrl.setText(TICKET_URL % ticket_num)
Ejemplo n.º 2
0
    def on_buttonBox_accepted(self):
        ticket_type = self.ticketType.currentText()
        is_critical = self.highPrio.isChecked()
        subject = self.subject.text().strip()
        info = [
            'Used versions:',
            '    Client: %s' % nicos_version,
            '    Python: %s' % sys.version.split()[0],
            '    Qt:     %s' % QT_VERSION_STR,
            '    PyQt:   %s' % PYQT_VERSION_STR,
        ]
        if self.client.isconnected:
            dinfo = self.client.daemon_info.copy()
            info += [
                '    Server: %s' % dinfo.get('daemon_version', ''),
                'Connected to: %s' % self.client.host,
                '    root: %s' % dinfo.get('nicos_root', ''),
                '    custom:',
                '        path:    %s' % dinfo.get('custom_path', ''),
                '        version: %s' % dinfo.get('custom_version', ''),
            ]
        description = self.descText.toPlainText().strip()
        description += '\n\n' + '\n'.join(info)
        reproduction = self.reproText.toPlainText().strip()
        add_log = self.scriptBox.isChecked()

        if not subject or not description:
            self.showError('Please enter a ticket subject and description.')
            return

        try:
            ticket_num = self.submitIssue(ticket_type, is_critical, subject,
                                          description, reproduction, add_log)
        except Exception as e:
            self.showError('Unfortunately, something went wrong submitting '
                           'the ticket (%s). The tracker page will now be '
                           'opened, please enter the ticket there.' % e)
            QDesktopServices.openUrl(QUrl(CREATE_TICKET_URL))
            return

        # switch to "thank you" display
        self.stacker.setCurrentIndex(1)
        self.buttonBox.clear()
        self.buttonBox.addButton(QDialogButtonBox.Close)
        self.ticketUrl.setText(TICKET_URL % ticket_num)
Ejemplo n.º 3
0
 def on_page_unsupportedContent(self, reply):
     if reply.url().scheme() != 'file':
         return
     filename = reply.url().path()
     if filename.endswith('.dat'):
         content = open(filename, encoding='utf-8', errors='replace').read()
         window = QMainWindow(self)
         window.resize(600, 800)
         window.setWindowTitle(filename)
         widget = QTextEdit(window)
         widget.setFontFamily('monospace')
         window.setCentralWidget(widget)
         widget.setText(content)
         window.show()
     else:
         # try to open the link with host computer default application
         try:
             QDesktopServices.openUrl(reply.url())
         except Exception:
             pass
Ejemplo n.º 4
0
 def on_ticketUrl_released(self):
     QDesktopServices.openUrl(QUrl(self.ticketUrl.text()))