Skip to content

Commit 563635e

Browse files
authored
Merge branch 'main' into update-devcontainer
2 parents 983d0c9 + e89aff2 commit 563635e

File tree

15 files changed

+402
-176
lines changed

15 files changed

+402
-176
lines changed

.github/workflows/_docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with:
1616
# Need this to get version number from last tag
1717
fetch-depth: 0
18+
submodules: recursive
1819

1920
- name: Install system packages
2021
run: sudo apt-get install graphviz

.github/workflows/_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
with:
2828
# Need this to get version number from last tag
2929
fetch-depth: 0
30+
submodules: recursive
3031

3132
- if: inputs.python-version == 'dev'
3233
name: Install dev versions of python packages

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
[submodule "techui-support"]
3+
path = techui-support
4+
url = https://github.com/adedamola-sode/techui-support.git
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-pmac/releases/download/2024.4.1/ibek.ioc.schema.json
2+
ioc_name: "{{ _global.get_env('IOC_NAME') }}"
3+
4+
description: auto-generated by https://github.com/epics-containers/builder2ibek
5+
6+
entities:
7+
- type: epics.EpicsEnvSet
8+
name: EPICS_TZ
9+
value: "GMT0BST"
10+
11+
- type: epics.EpicsCaMaxArrayBytes
12+
max_bytes: 3000000
13+
14+
- type: devIocStats.iocAdminSoft
15+
IOC: "{{ ioc_name | upper }}"
16+
17+
- type: pmac.pmacAsynIPPort
18+
IP: 1.1.1.1:1111
19+
name: BRICK1port
20+
21+
- type: pmac.GeoBrick
22+
IdlePoll: 1000
23+
NAXES: 4
24+
P: BL01T-MO-BRICK-01
25+
name: BRICK1
26+
pmacAsynPort: BRICK1port
27+
28+
- type: pmac.GeoBrickTrajectoryControl
29+
NPOINTS: 10000
30+
PmacController: BRICK1
31+
32+
- type: pmac.autohome
33+
GRP1: All
34+
GRP2: X
35+
GRP3: A
36+
P: BL01T-MO-MAP-01:STAGE
37+
PLC: 11
38+
PmacController: BRICK1
39+
40+
- type: pmac.dls_pmac_asyn_motor
41+
ACCL: 0.1
42+
ADDR: 1
43+
Controller: BRICK1
44+
DESC: X
45+
DHLM: 25
46+
DIR: Pos
47+
DLLM: -25
48+
EGU: mm
49+
HLM: "25"
50+
LLM: "-25"
51+
M: :X
52+
MRES: -0.000125
53+
P: BL01T-MO-MAP-01:STAGE
54+
PREC: 3
55+
TWV: 1
56+
UEIP: "Yes"
57+
VELO: 4
58+
59+
- type: pmac.dls_pmac_asyn_motor
60+
ACCL: 0.1
61+
ADDR: 2
62+
Controller: BRICK1
63+
DESC: A
64+
DHLM: 0
65+
DIR: Pos
66+
DLLM: 0
67+
EGU: mm
68+
HLSV: NO_ALARM
69+
M: :A
70+
MRES: 0.018
71+
P: BL01T-MO-MAP-01:STAGE
72+
PREC: 3
73+
TWV: 18
74+
UEIP: "Yes"
75+
VELO: 2500
76+
77+
- type: pmac.CS
78+
CS: 1
79+
IdlePoll: 1000
80+
PmacController: BRICK1
81+
name: CS1
82+
83+
- type: pmac.pmacDisableLimitsCheck
84+
Axis: 2
85+
Controller: BRICK1

example/create_gui.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# create_gui example for Phoebus GuiBuilder
22
beamline:
3-
dom: p47
3+
dom: bl01t
44
desc: Test Beamline
55

66
components:
77
fshtr:
88
desc: Fast Shutter
9-
prefix: BL47P-EA-FSHTR-01
9+
prefix: BL01T-EA-FSHTR-01
1010

1111
dcm:
1212
desc: Double Crystal Monochromator
13-
prefix: BL47P-MO-DCM-01:MIRR1
13+
prefix: BL01T-MO-DCM-01:MIRR1
1414

1515
d1:
1616
desc: Diode 1
17-
prefix: BL47P-DI-PHDGN-01
17+
prefix: BL01T-DI-PHDGN-01
1818
filename: test.bob
1919

2020
p2m:
2121
desc: Pilatus 2M
22-
prefix: BL47P-EA-PILAT-01
22+
prefix: BL01T-EA-PILAT-01
2323

2424
motor:
2525
desc: Hexapod Stage
26-
prefix: BL47P-MO-MAP-01:STAGE
26+
prefix: BL01T-MO-MAP-01:STAGE

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ authors = [
1515
license = { file = "LICENSE" }
1616
readme = "README.md"
1717
requires-python = ">=3.12,<4.0"
18-
dependencies = ["pyyaml>=6.0.2"]
18+
dependencies = ["pyyaml>=6.0.2", "phoebusgen>=3.0.0"]
1919
scripts = { phoebus-guibuilder = "phoebus_guibuilder.__main__:main" }
2020
optional-dependencies = { dev = [
2121
"basedpyright>=1.27.1",

src/phoebus_guibuilder/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
Version number as calculated by poetry-dynamic-versioning
77
"""
88

9+
from phoebus_guibuilder.datatypes import Beamline, Component, Entry
10+
from phoebus_guibuilder.guibuilder import Guibuilder
11+
from phoebus_guibuilder.screen import TechUIScreens
12+
913
from ._version import __version__
1014

11-
__all__ = ["__version__"]
15+
__all__ = [
16+
"__version__",
17+
"Beamline",
18+
"Component",
19+
"Entry",
20+
"Guibuilder",
21+
"TechUIScreens",
22+
]

src/phoebus_guibuilder/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from argparse import ArgumentParser
44
from collections.abc import Sequence
55

6-
from . import __version__, guibuilder
6+
from . import __version__
7+
from .guibuilder import Guibuilder
78

89
__all__ = ["main"]
910

@@ -20,7 +21,8 @@ def main(args: Sequence[str] | None = None) -> None:
2021
)
2122
_args = parser.parse_args(args)
2223

23-
guibuilder.main(_args.filename)
24+
gb = Guibuilder(_args.filename)
25+
gb.extract_from_create_gui()
2426

2527

2628
if __name__ == "__main__":
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import re
2+
from dataclasses import dataclass
3+
4+
5+
@dataclass
6+
class Beamline:
7+
dom: str
8+
desc: str
9+
10+
11+
@dataclass
12+
class Entry:
13+
type: str
14+
DESC: str
15+
P: str
16+
M: str | None
17+
R: str | None
18+
19+
20+
@dataclass
21+
class Component:
22+
name: str
23+
desc: str
24+
prefix: str
25+
filename: str | None = None
26+
27+
def __post_init__(self):
28+
self._extract_p_and_r()
29+
30+
def __repr__(self) -> str:
31+
return f"Component(name={self.name}, desc={self.desc}, \
32+
prefix={self.P}, suffix={self.R}, filename={self.filename})"
33+
34+
def _extract_p_and_r(self):
35+
pattern = re.compile(
36+
r"""
37+
^ # start of string
38+
(?= # lookahead to ensure the following pattern matches
39+
[A-Za-z0-9-]{14,16} # match 14 to 16 alphanumeric characters or hyphens
40+
[:A-Za-z0-9]* # match zero or more colons or alphanumeric characters
41+
[.A-Za-z0-9] # match a dot or alphanumeric character
42+
)
43+
(?!.*--) # negative lookahead to ensure no double hyphens
44+
(?!.*:\..) # negative lookahead to ensure no colon followed by a dot
45+
( # start of capture group 1
46+
(?:[A-Za-z0-9]{2,5}-){3} # match 2 to 5 alphanumeric characters followed
47+
# by a hyphen, repeated 3 times
48+
[\d]* # match zero or more digits
49+
[^:]? # match zero or one non-colon character
50+
)
51+
(?::([a-zA-Z0-9:]*))? # match zero or one colon followed by zero or more
52+
# alphanumeric characters or colons (capture group 2)
53+
(?:\.([a-zA-Z0-9]+))? # match zero or one dot followed by one or more
54+
# alphanumeric characters (capture group 3)
55+
$ # end of string
56+
""",
57+
re.VERBOSE,
58+
)
59+
60+
match = re.match(pattern, self.prefix)
61+
if match:
62+
self.P: str = match.group(1)
63+
self.R: str = match.group(2)
64+
# TODO: Is this needed?
65+
self.attribute: str | None = match.group(3)
66+
else:
67+
raise AttributeError(f"No valid PV prefix found for {self.name}.")

0 commit comments

Comments
 (0)