-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ef976c
commit c2e859a
Showing
18 changed files
with
933 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,45 @@ | ||
"""Top level API. | ||
"""Contains logic relevant to fastcs. Will use `fastcs_pandablocks.panda`.""" | ||
|
||
.. data:: __version__ | ||
:type: str | ||
from pathlib import Path | ||
|
||
Version number as calculated by https://github.com/pypa/setuptools_scm | ||
""" | ||
from fastcs.backends.epics.backend import EpicsBackend | ||
from fastcs.backends.epics.gui import EpicsGUIFormat | ||
|
||
from ._version import __version__ | ||
from .controller import PandaController | ||
from .gui import PandaGUIOptions | ||
from .types import EpicsName | ||
|
||
__all__ = ["__version__"] | ||
|
||
|
||
def ioc( | ||
prefix: EpicsName, | ||
hostname: str, | ||
screens_directory: Path | None, | ||
clear_bobfiles: bool = False, | ||
): | ||
controller = PandaController(prefix, hostname) | ||
backend = EpicsBackend(controller, pv_prefix=str(prefix)) | ||
|
||
if clear_bobfiles and not screens_directory: | ||
raise ValueError("`clear_bobfiles` is True with no `screens_directory`") | ||
|
||
if screens_directory: | ||
if not screens_directory.is_dir(): | ||
raise ValueError( | ||
f"`screens_directory` {screens_directory} is not a directory" | ||
) | ||
if not clear_bobfiles: | ||
if list(screens_directory.iterdir()): | ||
raise RuntimeError("`screens_directory` is not empty.") | ||
|
||
backend.create_gui( | ||
PandaGUIOptions( | ||
output_path=screens_directory / "output.bob", | ||
file_format=EpicsGUIFormat.bob, | ||
title="PandA", | ||
) | ||
) | ||
|
||
backend.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.