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 asyncio
|
||||
import atexit
|
||||
import importlib
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
|
@ -43,6 +44,9 @@ def get_argparser():
|
|||
parser.add_argument(
|
||||
"--db-file", default=None,
|
||||
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)
|
||||
return parser
|
||||
|
||||
|
@ -95,6 +99,11 @@ def main():
|
|||
args = get_argparser().parse_args()
|
||||
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:
|
||||
args.db_file = os.path.join(get_user_config_dir(),
|
||||
"artiq_dashboard_{server}_{port}.pyon".format(
|
||||
|
|
Loading…
Reference in New Issue