mirror of https://github.com/m-labs/artiq.git
dashboard: Add cmdline option to load plugins on startup
Together with m-labs/artiq#1916, this allows the user to integrate multiple argument UIs implemented in external libraries.
This commit is contained in:
parent
46fb8916bb
commit
85895ab89b
|
@ -3,6 +3,7 @@
|
||||||
import argparse
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
import atexit
|
import atexit
|
||||||
|
import importlib
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
@ -43,6 +44,9 @@ def get_argparser():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--db-file", default=None,
|
"--db-file", default=None,
|
||||||
help="database file for local GUI settings")
|
help="database file for local GUI settings")
|
||||||
|
parser.add_argument(
|
||||||
|
"-p", "--load-plugin", dest="plugin_modules", action="append",
|
||||||
|
help="Python module to load on startup")
|
||||||
common_args.verbosity_args(parser)
|
common_args.verbosity_args(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@ -95,6 +99,11 @@ def main():
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
widget_log_handler = log.init_log(args, "dashboard")
|
widget_log_handler = log.init_log(args, "dashboard")
|
||||||
|
|
||||||
|
# load any plugin modules first (to register argument_ui classes, etc.)
|
||||||
|
if args.plugin_modules:
|
||||||
|
for mod in args.plugin_modules:
|
||||||
|
importlib.import_module(mod)
|
||||||
|
|
||||||
if args.db_file is None:
|
if args.db_file is None:
|
||||||
args.db_file = os.path.join(get_user_config_dir(),
|
args.db_file = os.path.join(get_user_config_dir(),
|
||||||
"artiq_dashboard_{server}_{port}.pyon".format(
|
"artiq_dashboard_{server}_{port}.pyon".format(
|
||||||
|
|
Loading…
Reference in New Issue