samuraix.main

samuraix.main provides with a setuptools entrypoint for the sx-wm console script.

class samuraix.main.SamuraiLogger(name, level=0)

The SamuraiLogger is a convenience logging.Logger subclass with additional functionalities to log exceptions nicer.

exception(exc)

Improved exception logger.

Parameter:exc – An Exception instance
samuraix.main.configure_logging(options, file_level=10, console_level=10)

Set up the logging for the client.

Parameters:
  • file_level – level of logging for files
  • console_level – level of logging for the console
samuraix.main.create_default_option_parser(usage=None, config_path=None, logfile=None)
create a parser with standard options - usefull for other apps using samuraix.baseapp.BaseApp
samuraix.main.load_config(config=None)
Sets samuraix.config to the desired configuration dictionary. If config is None, it will load samuraix.defaultconfig. If config is callable, it will call it and use the return value instead.
samuraix.main.load_user_config(configpath)

Tries to execute the Python configuration script. Returns its config member on success, None if there was an error reading the config file (e.g. if the file does not exist)

Parameter:configpath – The filename of the configuration script we should try to load.
Note:Yes, the configuration file is a Python script, yes, it is executed and yes, that’s unsafe. Let’s trust the user that he knows what he does.
samuraix.main.parse_options()
Parse the command line options and return them. The command-line arguments are ignored, since we aren’t accepting any.
samuraix.main.restart()
restart the running application
samuraix.main.restart_loop(app_func)
main entry point for sx-wm. Runs the application in a loop to allow restarting
samuraix.main.run_samurai_x()

First, it parses the options. If the user specified –default-config, it will just print the defaultconfig.py file and quit. If not, it configures the logging and loads the configuration. Then samuraix.app is set to an instance of app_func, or, if app_func is None, to an instance of samuraix.appl.App. After that, samuraix.appl.App.init() and samuraix.appl.App.run() are called.

Parameter:app_func – A callable returning an application instance and taking no arguments. If it is None, samuraix.appl.App will be used as fallback.
samuraix.main.setup_ooxcb()
configure all required mixins

samurai-x

Previous topic

samuraix.logformatter

Next topic

samuraix.plugin

This Page