Ejemplo n.º 1
0
    def on_version_error(self, msg):
        """Called when the version was not obtained from self._pypi_client.

        Args:
            msg: The error message to show.
        """
        lines = ['The report has been sent successfully. Thanks!']
        lines.append("There was an error while getting the newest version: "
                     "{}. Please check for a new version on "
                     "<a href=https://www.qutebrowser.org/>qutebrowser.org</a> "
                     "by yourself.".format(msg))
        text = '<br/><br/>'.join(lines)
        msgbox.information(self, "Report successfully sent!", text,
                           on_finished=self.finish, plain_text=False)
Ejemplo n.º 2
0
def test_information(qtbot):
    box = msgbox.information(parent=None, title='foo', text='bar')
    qtbot.add_widget(box)
    if sys.platform != 'darwin':
        assert box.windowTitle() == 'foo'
    assert box.text() == 'bar'
    assert box.icon() == QMessageBox.Information
Ejemplo n.º 3
0
    def on_version_success(self, newest):
        """Called when the version was obtained from self._pypi_client.

        Args:
            newest: The newest version as a string.
        """
        new_version = pkg_resources.parse_version(newest)
        cur_version = pkg_resources.parse_version(qutebrowser.__version__)
        lines = ['The report has been sent successfully. Thanks!']
        if new_version > cur_version:
            lines.append("<b>Note:</b> The newest available version is v{}, "
                         "but you're currently running v{} - please "
                         "update!".format(newest, qutebrowser.__version__))
        text = '<br/><br/>'.join(lines)
        msgbox.information(self, "Report successfully sent!", text,
                           on_finished=self.finish, plain_text=False)
Ejemplo n.º 4
0
def test_no_err_windows(fake_args, capsys):
    fake_args.no_err_windows = True
    box = msgbox.information(parent=None, title='foo', text='bar')
    box.exec()  # should do nothing
    out, err = capsys.readouterr()
    assert not out
    assert err == 'Message box: foo; bar\n'
Ejemplo n.º 5
0
def test_information(qtbot):
    box = msgbox.information(parent=None, title='foo', text='bar')
    qtbot.add_widget(box)
    if not utils.is_mac:
        assert box.windowTitle() == 'foo'
    assert box.text() == 'bar'
    assert box.icon() == QMessageBox.Information
Ejemplo n.º 6
0
def test_no_err_windows(fake_args, capsys):
    fake_args.no_err_windows = True
    box = msgbox.information(parent=None, title='foo', text='bar')
    box.exec_()  # should do nothing
    out, err = capsys.readouterr()
    assert not out
    assert err == 'Message box: foo; bar\n'
Ejemplo n.º 7
0
def test_information(qtbot):
    box = msgbox.information(parent=None, title='foo', text='bar')
    qtbot.add_widget(box)
    if not utils.is_mac:
        assert box.windowTitle() == 'foo'
    assert box.text() == 'bar'
    assert box.icon() == QMessageBox.Information
Ejemplo n.º 8
0
    def on_version_success(self, newest):
        """Called when the version was obtained from self._pypi_client.

        Args:
            newest: The newest version as a string.
        """
        # pylint: disable=no-member
        # https://bitbucket.org/logilab/pylint/issue/73/
        new_version = distutils.version.StrictVersion(newest)
        cur_version = distutils.version.StrictVersion(qutebrowser.__version__)
        lines = ['The report has been sent successfully. Thanks!']
        if new_version > cur_version:
            lines.append("<b>Note:</b> The newest available version is v{}, "
                         "but you're currently running v{} - please "
                         "update!".format(newest, qutebrowser.__version__))
        text = '<br/><br/>'.join(lines)
        self.hide()
        msgbox.information(self, "Report successfully sent!", text,
                           on_finished=self.finish, plain_text=False)
Ejemplo n.º 9
0
    def on_version_success(self, newest):
        """Called when the version was obtained from self._pypi_client.

        Args:
            newest: The newest version as a string.
        """
        # pylint: disable=no-member
        # https://bitbucket.org/logilab/pylint/issue/73/
        new_version = distutils.version.StrictVersion(newest)
        cur_version = distutils.version.StrictVersion(qutebrowser.__version__)
        lines = ['The report has been sent successfully. Thanks!']
        if new_version > cur_version:
            lines.append("<b>Note:</b> The newest available version is v{}, "
                         "but you're currently running v{} - please "
                         "update!".format(newest, qutebrowser.__version__))
        text = '<br/><br/>'.join(lines)
        self.hide()
        msgbox.information(self,
                           "Report successfully sent!",
                           text,
                           on_finished=self.finish,
                           plain_text=False)
Ejemplo n.º 10
0
def test_no_err_windows(fake_args, caplog):
    fake_args.no_err_windows = True
    box = msgbox.information(parent=None, title='foo', text='bar')
    box.exec()  # should do nothing
    assert caplog.messages == ['foo\n\nbar']