def test_falls_back(): f = confreader.File(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")
def test_syntaxerr(): confreader.File(os.path.join(tests_dir, "configs", "syntaxerr.py"))
def test_basic(): f = confreader.File(os.path.join(tests_dir, "configs", "basic.py")) assert f.keys
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=None, dest="configfile", help='Use specified configuration file,' ' "default" will load the system default config.') 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) try: config = confreader.File(options.configfile, is_restart=options.no_spawn) except Exception as e: logger.exception('Error while reading config file (%s)', e) raise # XXX: the import is here becouse we need to call init_log # before start importing stuff from libqtile import manager try: return manager.Qtile( config, fname=options.socket, no_spawn=options.no_spawn, state=options.state, ) except: logger.exception('Qtile crashed during startup') raise
def test_syntaxerr(): with pytest.raises(confreader.ConfigError): confreader.File(os.path.join(tests_dir, "configs", "syntaxerr.py"))
def test_basic(self): f = confreader.File("configs/basic.py") assert f.keys
from libqtile import confreader # from libqtile import widget # from libqtile import layout locale.setlocale(locale.LC_ALL, '') d = Dialog(autowidgetsize=True) # should we start from empty or load some config default_config = d.yesno( """This is Qtile setup program to prepair config to use Qtile. Would you like to start from default config or load earlier config?""", yes_label='Default', no_label='Load file') if default_config == 'ok': d.infobox('Config is loading...') config = confreader.File() else: home = expanduser("~") code, config_file = d.fselect(home) if code == 'ok': config = confreader.File(config_file) d.infobox('Config is loading...') else: d.infobox('File has not been loaded. Start gain :)') print(config.__dict__)
def test_syntaxerr(): confreader.File("configs/syntaxerr.py")