Exemplo n.º 1
0
    def parser(self, mocker):
        """Fixture to provide an argparser.

        Monkey-patches .exit() of the argparser so it doesn't exit on errors.
        """
        parser = qutebrowser.get_argparser()
        mocker.patch.object(parser, 'exit', side_effect=Exception)
        return parser
Exemplo n.º 2
0
def session_save():
    """Send config-source command to qutebrowsers ipc server."""
    args = qutebrowser.get_argparser().parse_args()
    app.standarddir.init(args)
    socket = ipc._get_socketname(args.basedir)
    ipc.send_to_running_instance(
        socket, [":session-save get_urls"], args.target
    )
Exemplo n.º 3
0
    def parser(self, mocker):
        """Fixture to provide an argparser.

        Monkey-patches .exit() of the argparser so it doesn't exit on errors.
        """
        parser = qutebrowser.get_argparser()
        mocker.patch.object(parser, 'exit', side_effect=Exception)
        return parser
Exemplo n.º 4
0
    def test_init_from_config_consistent_default(self, config_stub):
        """Ensure config defaults are consistent with the builtin defaults."""
        args = qutebrowser.get_argparser().parse_args([])
        log.init_log(args)

        assert log.ram_handler.level == logging.DEBUG
        assert log.console_handler.level == logging.INFO

        log.init_from_config(config_stub.val)

        assert log.ram_handler.level == logging.DEBUG
        assert log.console_handler.level == logging.INFO
Exemplo n.º 5
0
    def __init__(self, buffer_id, url, arguments):
        Buffer.__init__(self, buffer_id, url, arguments, True,
                        QColor(0, 0, 0, 255))

        parser = qutebrowser.get_argparser()
        args = parser.parse_args(arguments.split())
        print('before app.run')
        app.run(args)
        print('after app.run')
        qwidget = app.qApp.topLevelWidgets()[0]
        print(qwidget)
        self.add_widget(qwidget)
Exemplo n.º 6
0
def regenerate_manpage(filename):
    """Update manpage OPTIONS using an argparse parser."""
    # pylint: disable=protected-access
    parser = qutebrowser.get_argparser()
    groups = []
    # positionals, optionals and user-defined groups
    for group in parser._action_groups:
        groupdata = []
        groupdata.append('=== {}'.format(group.title))
        if group.description is not None:
            groupdata.append(group.description)
        for action in group._group_actions:
            groupdata.append(_format_action(action))
        groups.append('\n'.join(groupdata))
    options = '\n'.join(groups)
    # epilog
    if parser.epilog is not None:
        options.append(parser.epilog)
    _format_block(filename, 'options', options)
Exemplo n.º 7
0
def regenerate_manpage(filename):
    """Update manpage OPTIONS using an argparse parser."""
    # pylint: disable=protected-access
    parser = qutebrowser.get_argparser()
    groups = []
    # positionals, optionals and user-defined groups
    for group in parser._action_groups:
        groupdata = []
        groupdata.append('=== {}'.format(group.title))
        if group.description is not None:
            groupdata.append(group.description)
        for action in group._group_actions:
            groupdata.append(_format_action(action))
        groups.append('\n'.join(groupdata))
    options = '\n'.join(groups)
    # epilog
    if parser.epilog is not None:
        options.append(parser.epilog)
    _format_block(filename, 'options', options)
Exemplo n.º 8
0
def regenerate_manpage(filename):
    """Update manpage OPTIONS using an argparse parser."""
    parser = qutebrowser.get_argparser()
    groups = []
    # positionals, optionals and user-defined groups
    # pylint: disable=protected-access
    for group in parser._action_groups:
        groupdata = []
        # https://bugs.python.org/issue9694 backport
        title = "options" if group.title == "optional arguments" else group.title
        groupdata.append('=== {}'.format(title))
        if group.description is not None:
            groupdata.append(group.description)
        for action in group._group_actions:
            action_data = _format_action(action)
            if action_data is not None:
                groupdata.append(action_data)
        groups.append('\n'.join(groupdata))
    # pylint: enable=protected-access
    options = '\n'.join(groups)
    # epilog
    if parser.epilog is not None:
        options += parser.epilog
    _format_block(filename, 'options', options)
Exemplo n.º 9
0
 def init_args(self):
     parser = qutebrowser.get_argparser()
     args = parser.parse_args([])
     log.init_log(args)
Exemplo n.º 10
0
 def parser(self):
     return qutebrowser.get_argparser()
Exemplo n.º 11
0
def qute_reload():
    """Send config-source command to qutebrowsers ipc server."""
    args = qutebrowser.get_argparser().parse_args()
    app.standarddir.init(args)
    socket = ipc._get_socketname(args.basedir)
    ipc.send_to_running_instance(socket, [":config-source"], args.target)
Exemplo n.º 12
0
 def setUp(self):
     self.parser = qutebrowser.get_argparser()
     self.parser.exit = argparser_exit