mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-22 11:05:26 +01:00
allow sls::Pattern in python d.pattern
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
import pathlib
|
||||||
from ._slsdet import CppDetectorApi
|
from ._slsdet import CppDetectorApi
|
||||||
from ._slsdet import slsDetectorDefs
|
from ._slsdet import slsDetectorDefs
|
||||||
from ._slsdet import IpAddr, MacAddr
|
from ._slsdet import IpAddr, MacAddr
|
||||||
@@ -3766,9 +3767,13 @@ class Detector(CppDetectorApi):
|
|||||||
raise NotImplementedError("Pattern is set only")
|
raise NotImplementedError("Pattern is set only")
|
||||||
|
|
||||||
@pattern.setter
|
@pattern.setter
|
||||||
def pattern(self, fname):
|
def pattern(self, name_or_pattern):
|
||||||
fname = ut.make_string_path(fname)
|
# If passed a file path, convert to string representation
|
||||||
ut.set_using_dict(self.setPattern, fname)
|
# with the path expanded. Otherwise it's probably a sls::Pattern
|
||||||
|
# and we can pass it directly.
|
||||||
|
if isinstance(name_or_pattern, (pathlib.Path, str)):
|
||||||
|
name_or_pattern = ut.make_string_path(name_or_pattern)
|
||||||
|
ut.set_using_dict(self.setPattern, name_or_pattern)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def patfname(self):
|
def patfname(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user