Module peel_devices
Table of Contents
PeelDeviceBase
All Devices must inherit from peel_devices.PeelDeviceBase. See the Stub device for a fully implemented working example.
Custom devices can be placed in userPython/peel_user_devices directory
- class peel_devices.PeelDeviceBase(name, parent=None)
- as_dict()
Returns the constructor fields and values for this instance. Used to recreate the instance between application sessions
- command(command, argument)
Command, Argument may be:
record takename
play takename or “” for last recorded
stop
transport stop | next | prev
notes note - sent when the notes are changed, relevant for the last take
timecode timecode - called when recording starts
selectedTake take - sent when a user selects a take, passes the take name
The following are called when take information needs to be updated, ie the take name has changed or when recording starts:
takeName n
shotName name
shotTag tag
takeNumber n
description description
takeId id
- data_directory()
returns the current data directory for this device
- static device()
returns the string name for this device type
- device_ref(state=None, info=None)
Create a PeelApp.Device() object that contains the information needed to update the main ui. The Device() object is implemented in c++ to make it easier to pass around inside the main app.
This function does not need to be overridden for subclasses, the default should be okay for most uses.
See the note in update_state() about populating state and info values when calling this from get_state() or get_info()
- static dialog(settings)
Static method to create the UI for this device. It should return an blank instance of this device type.
- static dialog_callback(widget)
Static method to populate the device from the creation widget
- edit(settings)
Create the UI to edit this device. It should return an populated instance of this device object.
- get_info()
Return the text to put in the main ui next to the device name
- get_state()
devices should return “OFFLINE”, “ONLINE”, “RECORDING”, “PLAYING” or “ERROR”
- harvest(directory, all_files)
Download the takes to the local storage directory
- has_harvest()
Return True if the device supports the ability to download files from the device to local storage
- list_takes()
list the take files currently on the device
- reconfigure(name, **kwargs)
Called by the SimpleDevice dialog to set the device settings. Does not need to be overridden if a different dialog is being used. The kwargs need to match the parameters specified in SimpleDeviceWidget constructor, ie if has_host is True, kwargs will have a “host” parameter.
- set_enabled(value)
Main app calls this to enable / disable the device. Default behavior is to set self.enabled
- staticMetaObject = PySide6.QtCore.QMetaObject("PeelDeviceBase" inherits "QObject": )
- teardown()
Called when the app is shutting down - tell all threads to stop and return
- thread_join()
Called when the app is shutting down - block till threads are stopped
- update_state(state=None, info=None)
Call this to push a status update to the main app.
Note that device_ref() may call get_state() and get_info() for the device, so it’s important that any calls to this function inside of get_state() or get_info() populate state and info fields to avoid a loop/lockup.
This function is usually called in response to a device thread or socket changing state or having new info to update in the ui to avoid the need for polling devices.
BaseDeviceWidget
SimpleDeviceWidget
- class peel_devices.SimpleDeviceWidget(settings, title, has_host, has_port, has_broadcast, has_listen_ip, has_listen_port, has_set_capture_folder=False)
- do_add()
The ui is asking for the device to be added - validate and save the settings returns true if the data is valid. If returning false it’s a good idea to pop up a message to the user to say what was wrong
- populate_from_device(device)
populate the gui using data from the provided device object
- staticMetaObject = PySide6.QtCore.QMetaObject("SimpleDeviceWidget" inherits "BaseDeviceWidget": )
- update_device(device, data=None)
Set the device properties from values in the ui device is the object to modify, by calling reconfigure data has any kwargs for reconfigure to be passed on Return true to close the window when adding
DeviceCollection
- class peel_devices.DeviceCollection(parent=None)
- add_device(device)
- static all_classes()
- from_id(id)
- get_data()
- has_device(device_name, name)
- load_json(data, mode)
- remove(device_id)
- remove_all()
- staticMetaObject = PySide6.QtCore.QMetaObject("DeviceCollection" inherits "QObject": )
- teardown()
- unique_name(device_name)
- update_all()
XmlUdpListenThread
TcpDevice
- class peel_devices.TcpDevice(name=None, host=None, port=None)
- as_dict()
Returns the constructor fields and values for this instance. Used to recreate the instance between application sessions
- do_connected()
- do_disconnected()
- do_error(err)
- do_read()
- get_info()
Return the text to put in the main ui next to the device name
- get_state()
devices should return “OFFLINE”, “ONLINE”, “RECORDING”, “PLAYING” or “ERROR”
- reconfigure(name, host=None, port=None)
Called by the SimpleDevice dialog to set the device settings. Does not need to be overridden if a different dialog is being used. The kwargs need to match the parameters specified in SimpleDeviceWidget constructor, ie if has_host is True, kwargs will have a “host” parameter.
- send(msg)
- staticMetaObject = PySide6.QtCore.QMetaObject("TcpDevice" inherits "PeelDeviceBase": )
- teardown()
Called when the app is shutting down - tell all threads to stop and return
XmlUdpDevice
DownloadThread
- class peel_devices.DownloadThread
- COPY_FAIL = 0
- COPY_OK = 1
- COPY_SKIP = 2
- STATUS_FINISHED = 3
- STATUS_NONE = 0
- STATUS_RUNNING = 1
- STATUS_STOP = 2
- all_done
- file_done
- file_fail(name, err)
- file_ok(name)
- file_skip(name)
- is_running()
- log(message)
- message
- set_current(value)
- set_finished()
- set_started()
- staticMetaObject = PySide6.QtCore.QMetaObject("DownloadThread" inherits "QThread": Methods: #13 type=Signal, signature=tick(double), parameters=double #14 type=Signal, signature=file_done(QString,int,QString), parameters=QString, int, QString #15 type=Signal, signature=all_done() #16 type=Signal, signature=message(QString), parameters=QString )
- teardown()
- tick