Skip to content
Snippets Groups Projects
Commit f71556e6 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[scripts][editor_cli] Add prefix check before editor startup

This will ensure that the editor has a valid
prefix structure to start with.
parent 24e87857
No related branches found
No related tags found
1 merge request!98Check prefix on startup
Pipeline #31604 passed
......@@ -46,6 +46,8 @@ from beat.cmdline.decorators import raise_on_error
from beat.cmdline.decorators import verbosity_option
from ..utils import setup_logger
from ..utils import check_prefix_folders
from ..utils import check_prefix_dataformats
from ..widgets.mainwindow import MainWindow
from ..widgets.assetwidget import AssetWidget
from ..backend.asset import AssetType
......@@ -73,6 +75,14 @@ def setup_environment_cache(ctx, param, value):
dump_environments(environments)
def check_prefix(prefix_path):
"""Check that the prefix is usable"""
folder_status, _ = check_prefix_folders(prefix_path)
dataformat_status, _ = check_prefix_dataformats(prefix_path)
return folder_status and dataformat_status
refresh_environment_cache_flag = click.option(
"--no-check-env",
is_flag=True,
......@@ -130,6 +140,11 @@ def start(ctx):
"""Start the beat editor"""
app = QApplication(sys.argv)
config = ctx.meta["config"]
if not check_prefix(config.prefix):
return
app.installEventFilter(MouseWheelFilter(app))
mainwindow = MainWindow()
mainwindow.set_context(ctx)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment