Beispiel #1
0
 def run_qtile():
     llvl = logging.DEBUG if pytest.config.getoption("--debuglog") else logging.INFO
     kore = xcore.XCore()
     try:
         init_log(llvl, log_path=None, log_color=False)
         q = QtileManager(kore, config_class(), self.display, self.sockfile)
         q.loop()
     except Exception:
         wpipe.send(traceback.format_exc())
Beispiel #2
0
def test_falls_back():
    xc = xcore.XCore()
    f = confreader.Config.from_file(
        xc, os.path.join(tests_dir, "configs", "basic.py"))

    # We just care that it has a default, we don't actually care what the
    # default is; don't assert anything at all about the default in case
    # someone changes it down the road.
    assert hasattr(f, "follow_mouse_focus")
Beispiel #3
0
 def run_qtile():
     kore = xcore.XCore()
     try:
         init_log(self.log_level, log_path=None, log_color=False)
         q = QtileManager(kore, config_class(), self.display,
                          self.sockfile)
         q.loop()
     except Exception:
         wpipe.send(traceback.format_exc())
Beispiel #4
0
    def create_manager(self, config_class):
        """Create a Qtile manager instance in this thread

        This should only be used when it is known that the manager will throw
        an error and the returned manager should not be started, otherwise this
        will likely block the thread.
        """
        llvl = logging.DEBUG if pytest.config.getoption(
            "--debuglog") else logging.INFO
        init_log(llvl, log_path=None, log_color=False)
        kore = xcore.XCore()
        return QtileManager(kore, config_class(), self.display, self.sockfile)
Beispiel #5
0
    def create_manager(self, config_class):
        """Create a Qtile manager instance in this thread

        This should only be used when it is known that the manager will throw
        an error and the returned manager should not be started, otherwise this
        will likely block the thread.
        """
        init_log(self.log_level, log_path=None, log_color=False)
        kore = xcore.XCore()
        config = config_class()
        for attr in dir(default_config):
            if not hasattr(config, attr):
                setattr(config, attr, getattr(default_config, attr))

        return QtileManager(kore, config, self.display, self.sockfile)
Beispiel #6
0
def test_validate():
    xc = xcore.XCore()
    f = confreader.Config.from_file(
        xc, os.path.join(tests_dir, "configs", "basic.py"))
    f.validate(xc)
    f.keys[0].key = "nonexistent"
    with pytest.raises(confreader.ConfigError):
        f.validate(xc)

    f.keys[0].key = "x"
    f = confreader.Config.from_file(
        xc, os.path.join(tests_dir, "configs", "basic.py"))
    f.keys[0].modifiers = ["nonexistent"]
    with pytest.raises(confreader.ConfigError):
        f.validate(xc)
    f.keys[0].modifiers = ["shift"]
Beispiel #7
0
def make_qtile():
    from argparse import ArgumentParser
    parser = ArgumentParser(
        description='A full-featured, pure-Python tiling window manager.',
        prog='qtile',
    )
    parser.add_argument(
        '--version',
        action='version',
        version=VERSION,
    )
    parser.add_argument(
        "-c",
        "--config",
        action="store",
        default=path.expanduser(
            path.join(getenv('XDG_CONFIG_HOME', '~/.config'), 'qtile',
                      'config.py')),
        dest="configfile",
        help='Use the specified configuration file',
    )
    parser.add_argument("-s",
                        "--socket",
                        action="store",
                        default=None,
                        dest="socket",
                        help='Path to Qtile comms socket.')
    parser.add_argument("-n",
                        "--no-spawn",
                        action="store_true",
                        default=False,
                        dest="no_spawn",
                        help='Avoid spawning apps. (Used for restart)')
    parser.add_argument('-l',
                        '--log-level',
                        default='WARNING',
                        dest='log_level',
                        choices=('DEBUG', 'INFO', 'WARNING', 'ERROR',
                                 'CRITICAL'),
                        help='Set qtile log level')
    parser.add_argument(
        '--with-state',
        default=None,
        dest='state',
        help='Pickled QtileState object (typically used only internally)',
    )
    options = parser.parse_args()
    log_level = getattr(logging, options.log_level)
    init_log(log_level=log_level)

    kore = xcore.XCore()
    try:
        config = confreader.Config.from_file(kore, options.configfile)
    except Exception as e:
        logger.exception('Error while reading config file (%s)', e)
        config = confreader.Config()
        from libqtile.widget import TextBox
        widgets = config.screens[0].bottom.widgets
        widgets.insert(0, TextBox('Config Err!'))
    # XXX: the import is here because we need to call init_log
    # before start importing stuff
    from libqtile.core import manager
    return manager.Qtile(
        kore,
        config,
        fname=options.socket,
        no_spawn=options.no_spawn,
        state=options.state,
    )
Beispiel #8
0
def test_basic():
    xc = xcore.XCore()
    f = confreader.Config.from_file(
        xc, os.path.join(tests_dir, "configs", "basic.py"))
    assert f.keys
Beispiel #9
0
def test_syntaxerr():
    xc = xcore.XCore()
    with pytest.raises(confreader.ConfigError):
        confreader.Config.from_file(
            xc, os.path.join(tests_dir, "configs", "syntaxerr.py"))
Beispiel #10
0
def test_keys(qtile):
    xc = xcore.XCore()
    assert "a" in xc.get_keys()
    assert "shift" in xc.get_modifiers()