Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pyqt-apps/scripts/sirius-hla-si-ap-idff.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
'-p', "--prefix", type=str, default=VACA_PREFIX,
help="Define the prefix for the PVs in the window.")
parser.add_argument("idname", type=str, help="ID name.")
parser.add_argument(
'-g', "--idffgroup", type=str, default=None,
help="Power supplies subgroup controlled by IDFF instance.")
args = parser.parse_args()

app = SiriusApplication()
app.open_window(
IDFFWindow, parent=None, prefix=args.prefix, idname=args.idname)
IDFFWindow, parent=None, prefix=args.prefix,
idname=args.idname, idffgroup=args.idffgroup,
)
_sys.exit(app.exec_())
6 changes: 5 additions & 1 deletion pyqt-apps/scripts/sirius-hla-si-id-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from siriushla.sirius_application import SiriusApplication
from siriuspy.envars import VACA_PREFIX
from siriushla.si_id_control import IDControl, APUControlWindow, \
DELTAControlWindow, IVUControlWindow, VPUControlWindow
DELTAControlWindow, IVUControlWindow, VPUControlWindow, \
UEControlWindow


parser = _argparse.ArgumentParser(
Expand Down Expand Up @@ -37,6 +38,9 @@
elif 'VPU' in args.device:
app.open_window(
VPUControlWindow, parent=None, prefix=prefix, device=device)
elif 'UE44' in args.device:
app.open_window(
UEControlWindow, parent=None, prefix=prefix, device=device)
elif not device or isall:
app.open_window(IDControl, parent=None, prefix=prefix)
sys.exit(app.exec_())
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.0
1.16.0
8 changes: 4 additions & 4 deletions pyqt-apps/siriushla/as_ap_launcher/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def _create_id_menu(self):
'SI-08SB:ID-IVU18',
'SI-09SA:ID-APU22',
'SI-10SB:ID-DELTA52',
'SI-11SP:ID-APU58',
'SI-11SP:ID-UE44',
'SI-14SB:ID-IVU18',
'SI-17SA:ID-APU22',
'SI-20SB:ID-APU22',
Expand All @@ -479,10 +479,10 @@ def _create_id_menu(self):
text = '{0} - {1} ({2})'.format(
idname.dev, idname.sub, beamline) \
if LEVEL2A == QAction else beamline
APU = LEVEL2A(text, menu)
ID_DEV = LEVEL2A(text, menu)
self.connect_newprocess(
APU, ['sirius-hla-si-id-control.py', '-dev', idname])
self.add_object_to_level1(menu, APU)
ID_DEV, ['sirius-hla-si-id-control.py', '-dev', idname])
self.add_object_to_level1(menu, ID_DEV)

return menu

Expand Down
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/as_ap_monitor/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def get_sec2dev_laypos(sec, label):
SEC2LABEL2SECPOS['BO'].update({
'RF': (2, 1, 1, 1)})
SEC2LABEL2SECPOS['SI'].update({
'RF': (0, 6, 1, 1)})
'RF': (0, 8, 1, 1)})
return SEC2LABEL2SECPOS[sec][label]
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/as_ps_commands/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ def _get_ps_tree_names(self):
# add SI Corrs
psnames.extend(PSSearch.get_psnames(
{'sec': 'SI', 'sub': '[0-2][0-9].*', 'dis': 'PS',
'dev': '(LCH|CH|CV|CC)'}))
'dev': '(LCH|LCV|CH|CV|CC)'}))
# add SI QTrims
psnames.extend(PSSearch.get_psnames(
{'sec': 'SI', 'sub': '[0-2][0-9].*', 'dis': 'PS',
Expand Down
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/as_ps_control/SummaryWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Quadrupole = re.compile("^.*:PS-Q.*$")
QuadrupoleSkew = re.compile("^.*:PS-QS.*$")
Sextupole = re.compile("^.*:PS-S.*$")
Corrector = re.compile("^.*:PS-(LCH|CH|CV|CC|FCH|FCV).*$")
Corrector = re.compile("^.*:PS-(LCH|LCV|CH|CV|CC|FCH|FCV).*$")
FastCorrector = re.compile("^SI-.*:PS-(FCH|FCV).*$")
IsPulsed = re.compile("^.*:PU-.*$")
IsDCLink = re.compile("^.*:PS-DCLink.*$")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ class BasePSControlWidget(QWidget):
HORIZONTAL = 0
VERTICAL = 1

def __init__(self, subsection=None, orientation=0, parent=None):
def __init__(
self, subsection=None, idffsubgroup=None, orientation=0,
parent=None,
):
"""Class constructor.

Parameters:
Expand All @@ -246,11 +249,18 @@ def __init__(self, subsection=None, orientation=0, parent=None):
orientation
Default to HORIZONTAL. Define how the different groups
(defined in subclasses) will be laid out.
idffsubgroup
Default to None. To be used in filters defined in subclass.
"""
super(BasePSControlWidget, self).__init__(parent)
self._orientation = orientation
self._subsection = subsection
self._dev_list = PSSearch.get_psnames(self._getFilter(subsection))
self._idffsubgroup = idffsubgroup
filtargs = [subsection]
if idffsubgroup:
filtargs.append(idffsubgroup)
filt = self._getFilter(*filtargs)
self._dev_list = PSSearch.get_psnames(filt)
dev0 = PVName(self._dev_list[0])
if dev0.sec == 'LI':
if dev0.dev == 'Slnd':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def _device_not_found(section, device):
raise AttributeError("{} not defined for {}".format(device, section))

@staticmethod
def factory(parent, section, device, subsection=None, orientation=0):
def factory(
parent, section, device, subsection=None, orientation=0,
idffsubgroup=None
):
if section == "LI":
if device == "spectrometer":
return LISpectControlWidget(
Expand Down Expand Up @@ -122,7 +125,7 @@ def factory(parent, section, device, subsection=None, orientation=0):
elif device == "corrector-idff":
return IDFFCorrectorControlWidget(
subsection=subsection, orientation=orientation,
parent=parent)
parent=parent, idffsubgroup=idffsubgroup)
elif device == "skew-quadrupole":
return SISkewQuadControlWidget(
subsection=subsection, orientation=orientation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
class IDFFCorrectorControlWidget(BasePSControlWidget):
"""IDFF corrector control widget."""

def _getFilter(self, subsection=None):
subsectype = subsection[-1] # 'A' | 'B' | 'P'
qd = "QD" + subsectype # for A type sections
qf = "QF" + subsectype
qd1 = qd + "1" # for B and P type sections
qd2 = qd + "2" # for B and P type sections
trims = qd + "|" + qd1 + "|" + qf + "|" + qd2
dev = "(CH|CV|QS|" + trims + "|LCH|CC1|CC2)"
return {"sec": "SI", "sub": subsection, "dev": dev}
def _getFilter(self, subsection=None, idffsubgroup=None):
if idffsubgroup:
filt = {"sec": "SI", "sub": subsection, "dev": idffsubgroup}
else:
subsectype = subsection[-1] # 'A' | 'B' | 'P'
qd = "QD" + subsectype # for A type sections
qf = "QF" + subsectype
qd1 = qd + "1" # for B and P type sections
qd2 = qd + "2" # for B and P type sections
trims = qd + "|" + qd1 + "|" + qf + "|" + qd2
dev = "(CH|CV|QS|" + trims + "|LCH|LCV|CC1|CC2)"
filt = {"sec": "SI", "sub": subsection, "dev": dev}
return filt

def _hasTrimButton(self):
return False
Expand All @@ -27,6 +31,6 @@ def _getGroups(self):
('Vertical Corretors', '-CV'),
('Skew Quadrupole', '-QS'),
('Trim Quadrupoles ', '-(QF[ABP]|QDA|QDB[12]|QDP[12])'),
('Long Coils', '-LCH'),
('Long Coils', '-LC'),
('Corrector Coils', '-CC')
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SISlowCorrectorControlWidget(BasePSControlWidget):
"""Storage ring slow correctors."""

def _getFilter(self, subsection=None):
filt = {"sec": "SI", "sub": "\w{4}", "dev": "(CH|CV|CC|LCH).*"}
filt = {"sec": "SI", "sub": "\w{4}", "dev": "(CH|CV|CC|LCH|LCV).*"}
if subsection:
filt.update({'sub': subsection})
return filt
Expand Down
2 changes: 1 addition & 1 deletion pyqt-apps/siriushla/as_ps_diag/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def update_gridpos(row, col, col_count, offset=0):
aux = devices.pop(-1)
devices.insert(0, aux)
elif sec == 'SI':
if label not in ['FCH', 'FCV', 'ID-CH/CV/QS/CC']:
if label not in ['FCH', 'FCV', 'ID-FF Correctors']:
aux = devices.pop(-1)
devices.insert(0, aux)
if label == 'Trims':
Expand Down
20 changes: 10 additions & 10 deletions pyqt-apps/siriushla/as_ps_diag/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
'S': {'sec': 'SI', 'sub': '.*', 'dev': 'S.*'},
'CV': {'sec': 'SI', 'sub': '.*(M|C).*', 'dev': 'CV.*'},
'CH': {'sec': 'SI', 'sub': '.*(M|C).*', 'dev': 'CH.*'},
'ID-CH/CV/QS/CC': {'sec': 'SI', 'sub': '.*S(A|B|P)',
'dev': '(LCH|CH|CV|CC|QS)'},
'ID-FF Correctors': {'sec': 'SI', 'sub': '.*S(A|B|P)',
'dev': '(LCH|LCV|CH|CV|CC|QS)'},
'FFCH/FFCV': {'sec': 'SI', 'dev': 'FFC.*'},
'Trims': {'sec': 'SI', 'sub': '[0-2][0-9].*',
'dev': 'Q(F|D|[1-4]).*'},
Expand Down Expand Up @@ -89,10 +89,10 @@ def get_label2devices(sec):
'SI': {
'B': (0, 1, 1, 1),
'PM': (0, 2, 1, 1),
'FFCH/FFCV': (0, 3, 1, 1),
'Q': (0, 4, 1, 1),
'S': (0, 5, 1, 1),
'ID-CH/CV/QS/CC': (0, 7, 1, 2),
'Q': (0, 3, 1, 1),
'S': (0, 4, 1, 1),
'ID-FF Correctors': (0, 5, 1, 2),
'FFCH/FFCV': (0, 7, 1, 1),
'QS': (1, 1, 1, 2),
'CH': (1, 3, 1, 1),
'CV': (1, 4, 1, 1),
Expand All @@ -117,15 +117,15 @@ def get_col2dev_count(sec, label):
if 'Trims' in label:
return 14
if 'FFC' in label:
return 4
return 2
if 'ID' in label:
return 8
return 13
if 'FC' in label:
return 4
if label == 'S':
return 11
return 7
if label == 'Q':
return 10 if sec != 'SI' else 6
return 10 if sec != 'SI' else 5
if label == 'Slnd':
return 21
return 10
Expand Down
43 changes: 32 additions & 11 deletions pyqt-apps/siriushla/si_ap_idff/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,34 @@ class IDFFWindow(SiriusMainWindow):
# so as to provide the same PVs as the low level ioc (particularly
# "IDPos-Mon")

def __init__(self, parent=None, prefix='', idname=''):
def __init__(self, parent=None, prefix='', idname='', idffgroup=''):
"""Initialize."""
super().__init__(parent)
self.prefix = prefix or _VACA_PREFIX
self.idname = _PVName(idname)
self._is_llidff = self.idname.dev.startswith(("IVU", "SIMUL", "VPU"))
if self._is_llidff and self.idname.dev.startswith(("IVU", "SIMUL")):
self._is_llidff = self.idname.dev.startswith(
("IVU", "SIMUL", "VPU", "UE44", )
)
if self.idname.dev.startswith(("IVU", "SIMUL")):
self._idffname = _PVName(f"SI-{self.idname.sub}:BS-IDFF-CHCV")
elif self._is_llidff and self.idname.dev.startswith("VPU"):
elif self.idname.dev.startswith("VPU"):
self._idffname = _PVName(f"SI-{self.idname.sub}:BS-IDFF-CC")
elif self.idname.dev.startswith("UE44"):
if not idffgroup:
raise ValueError('idffgroup input need to be defined for UE44')
self._idffname = _PVName(f"SI-{self.idname.sub}:BS-IDFF-{idffgroup}")
else:
self._idffname = _PVName(f"SI-{self.idname.sub}:AP-IDFF")
self.dev_pref = _PVName(self._idffname + ':')
# self._idffname = IDFFConst(idname).idffname
self.dev_pref = _PVName(self._idffname)
self._idffdev = self._create_idffdev()
self._idffdata = IDSearch.conv_idname_2_idff(self.idname)
self.device = _PVName(self._idffname)
dis = "BS" if self._is_llidff else "AP"
self._idffnickname = _PVName(f"SI-{self.idname.sub}:{dis}-IDFF")
self._idffgroup = idffgroup
if idffgroup:
self._idffnickname = self._idffnickname.substitute(idx=idffgroup)
self.setObjectName('IDApp')
self.setWindowTitle(self.device)
self.setWindowTitle(self._idffnickname)
self.setWindowIcon(get_idff_icon())
self._setupUi()
self.setFocusPolicy(Qt.StrongFocus)
Expand All @@ -74,6 +83,8 @@ def _setupUi(self):
corrs += self._idffdev.ctrldev.IDFF_CH_LABELS
corrs += self._idffdev.ctrldev.IDFF_CV_LABELS
corrs += self._idffdev.ctrldev.IDFF_CC_LABELS
corrs += self._idffdev.ctrldev.IDFF_LC_LABELS
corrs += self._idffdev.ctrldev.IDFF_QS_LABELS
lay.addWidget(self._llStatusWidget(), 1, 0, 1, 1)
lay.addWidget(self._llSettingsWidget(corrs), 2, 0, 3, 1)
else:
Expand Down Expand Up @@ -288,15 +299,15 @@ def _basicSettingsWidget(self):
'Calc. values:', self, alignment=Qt.AlignRight)
glay_calccorr = QGridLayout()
glay_calccorr.addWidget(ld_calccorr, 0, 0)
corr_fams = ['CH', 'CV', 'QS', 'LCH', 'QD1', 'QF', 'QD2', 'CC']
corr_fams = ['CH', 'CV', 'QS', 'LCH', 'LCV', 'QD1', 'QF', 'QD2', 'CC']
for ridx, corr in enumerate(corr_fams):
if corr == 'CH' and not chnames:
continue
if corr == 'CV' and not cvnames:
continue
if corr == 'QS' and not qsnames:
continue
if corr == 'LCH' and not lcnames:
if corr in ('LCH', 'LCV') and not lcnames:
continue
if corr in ('QD1', 'QF', 'QD2') and not qnnames:
continue
Expand Down Expand Up @@ -495,9 +506,19 @@ def _logWidget(self):
return gbox

def _corrsMonitorWidget(self):
idffsubgroup = None
if self._idffgroup:
idffsubgroup = (
"(CH|CV)" if self._idffgroup == "CHCV" else
"LC(H|V)" if self._idffgroup == "LC" else
"QS" if self._idffgroup == "QS" else
None
)
widget = ControlWidgetFactory.factory(
self, section='SI', device='corrector-idff',
subsection=self.device.sub, orientation=Qt.Vertical)
subsection=self._idffnickname.sub,
idffsubgroup=idffsubgroup,
orientation=Qt.Vertical)
for wid in widget.get_summary_widgets():
detail_bt = wid.get_detail_button()
psname = detail_bt.text()
Expand Down
1 change: 1 addition & 0 deletions pyqt-apps/siriushla/si_id_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
# from .papu import PAPUControlWindow
from .ivu import IVUControlWindow
from .vpu import VPUControlWindow
from .ue import UEControlWindow
from .id_control import IDControl
Loading
Loading