PythonScanClient / PyScanClient

Python Client for CS-Studio Scan Service
Eclipse Public License 1.0
3 stars 4 forks source link

Log command parameters #7

Closed kasemir closed 9 years ago

kasemir commented 9 years ago

Log command should support

# Log nothing
Log()

# Log one device
Log("pv1")

# Log several devices
Log("pv1", "pv2", "pv3")

# Log list of devices
devices = [ "pv1", "pv2", "pv3" ]
Log(devices)

That currently doesn't work, mostly because the first argument must be the errHandler.

kasemir commented 9 years ago

Could be solved like this

class Log
    def __init__(first_device_or_list_of_devices, *more_devices, **kwargs):
        # Check if first_device_or_list_of_devices is list
        # Add remaining devices from more_devices
        # Check kwargs for "errHandler"
kasemir commented 9 years ago

https://github.com/PythonScanClient/PyScanClient/blob/master/scan/commands/parallel.py is similar to Log(). Instead of one or more devices to log it takes one of more commands to execute, but the idea of using first_or_list, _more_args, *_other_keywords is the same.