mesycontrol package¶
Subpackages¶
- mesycontrol.devices package
- Submodules
- mesycontrol.devices.mcfd16 module
- mesycontrol.devices.mcfd16_profile module
- mesycontrol.devices.mhv4 module
- mesycontrol.devices.mhv4_profile module
- mesycontrol.devices.mpd4 module
- mesycontrol.devices.mpd4_profile module
- mesycontrol.devices.mpd8 module
- mesycontrol.devices.mpd8_profile module
- mesycontrol.devices.mprb16 module
- mesycontrol.devices.mprb16_profile module
- mesycontrol.devices.mprb16dr module
- mesycontrol.devices.mprb16dr_profile module
- mesycontrol.devices.mscf16 module
- mesycontrol.devices.mscf16_profile module
- mesycontrol.devices.mux16 module
- mesycontrol.devices.mux16_profile module
- mesycontrol.devices.stm16 module
- mesycontrol.devices.stm16_profile module
- Module contents
Submodules¶
mesycontrol.app_context module¶
-
class
mesycontrol.app_context.
Context
(main_file, auto_load_device_modules=True, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
setup
¶ The contexts current setup object.
-
mesycontrol.app_model module¶
-
class
mesycontrol.app_model.
AppObject
(hardware=None, config=None, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
cfg
¶
-
config_set
¶ self, old, new
-
hardware_set
¶ self, old, new
-
has_cfg
¶
-
has_hw
¶
-
hw
¶
-
-
class
mesycontrol.app_model.
Device
(bus, address, mrc=None, hw_device=None, cfg_device=None, hw_module=None, cfg_module=None, parent=None)[source]¶ Bases:
mesycontrol.app_model.AppObject
-
address_conflict
¶
-
cfg_extension_changed
¶
-
cfg_idc
¶
-
cfg_idc_changed
¶
-
cfg_module
¶
-
cfg_module_changed
¶
-
cfg_parameter_changed
¶
-
cfg_profile
¶
-
cfg_profile_changed
¶
-
config_applied
¶ True if hardware and config values are equal.
-
config_applied_changed
¶
-
create_config
(name='', create_mrc_config=True)[source]¶ Creates a config for this device using the default values from the device profile.
- Preconditions:
- self.cfg must be None: device must not have a config yet
- self.profile must be set: a device profile is needed to create the config with the proper idc and initial values
- create_mrc_config must be True or self.mrc.cfg must be set
-
hw_extension_changed
¶
-
hw_idc
¶
-
hw_idc_changed
¶
-
hw_module
¶
-
hw_module_changed
¶
-
hw_parameter_changed
¶
-
hw_profile
¶
-
hw_profile_changed
¶
-
idc
¶
-
idc_changed
¶
-
idc_conflict
¶ True if hardware and config IDCs differ.
-
idc_conflict_changed
¶
-
module
¶
-
module_changed
¶
-
mrc
¶
-
mrc_changed
¶
-
profile
¶
-
profile_changed
¶
-
-
class
mesycontrol.app_model.
Director
(app_registry, device_registry)[source]¶ Bases:
object
Manages the app_model tree. Subscribes to changes to both the hardware and config trees and updates the app_model tree.
-
class
mesycontrol.app_model.
MRC
(url, mrc_registry=None, hw_mrc=None, cfg_mrc=None, parent=None)[source]¶ Bases:
mesycontrol.app_model.AppObject
-
device_about_to_be_removed
¶
-
device_added
¶
-
device_removed
¶
-
devices
¶
-
mrc_registry
¶
-
mrc_registry_changed
¶
-
url
¶
-
mesycontrol.async_util module¶
mesycontrol.basic_model module¶
-
class
mesycontrol.basic_model.
Device
(bus=None, address=None, idc=None, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
address
¶
-
address_changed
¶
-
bus
¶
-
bus_changed
¶
-
clear_cached_memory
()[source]¶ Clears the memory cache. Returns True if any parameters where cleared. Otherwise False is returned.
-
clear_cached_parameter
(address)[source]¶ Removes the cached memory value at the given address. Emits parameter_changed and returns True if the parameter was present in the memory cache. Otherwise False is returned.
-
extension_added
¶
-
extension_changed
¶
-
extension_removed
¶
-
extensions
¶
-
get_cached_parameter
(address)[source]¶ Returns the integer value of the cached parameter at the given address or None if the parameter is not present in the cache. address must be within PARAM_RANGE, otherwise a ValueError will be raised.
-
get_parameter
(address)[source]¶ Get a parameter from the devices memory cache if available. Otherwise use Device.read_parameter() to read the parameter from the hardware. Returns a ResultFuture whose result is a ReadResult instance.
-
idc
¶
-
idc_changed
¶
-
memory_about_to_be_cleared
¶ memory
-
memory_cleared
¶
-
mrc
¶
-
mrc_changed
¶
-
parameter_changed
¶ address, value
-
read_parameter
(address)[source]¶ Read a parameter from the device. This method returns a ResultFuture whose result is a ReadResult instance. On read success the local memory cache is updated with the newly read value.
-
-
class
mesycontrol.basic_model.
MRC
(url, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
device_about_to_be_removed
¶
-
device_added
¶
-
device_removed
¶
-
url
¶
-
url_changed
¶
-
-
class
mesycontrol.basic_model.
MRCRegistry
(parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
Manages MRC instances
-
mrc_about_to_be_removed
¶
-
mrc_added
¶
-
mrc_removed
¶
-
mrcs
¶
-
-
class
mesycontrol.basic_model.
ReadResult
[source]¶ Bases:
mesycontrol.basic_model.ReadResult
The result type for a read operation. A namedtuple with added conversion to int.
-
class
mesycontrol.basic_model.
ResultFuture
[source]¶ Bases:
mesycontrol.future.Future
Future subclass used to hold ReadResult/SetResult instances. This class adds an int() conversion method to easily obtain the result value.
-
class
mesycontrol.basic_model.
SetResult
[source]¶ Bases:
mesycontrol.basic_model.SetResult
The result type for a set operation. Adds requested_value to the fields of ReadResult and conversions to int and bool. The bool conversion returns True if value equals requested value.
mesycontrol.basic_tree_model module¶
-
class
mesycontrol.basic_tree_model.
BasicTreeModel
(parent=None)[source]¶ Bases:
PyQt4.QtCore.QAbstractItemModel
-
class
mesycontrol.basic_tree_model.
BasicTreeNode
(ref=None, parent=None)[source]¶ Bases:
object
Support class for implementing the nodes of a Qt tree model.
-
find_node_by_ref
(ref)[source]¶ Find and return the node pointing to the given ref. If no node can be found None is returned.
-
get_model
()[source]¶ Get this nodes model. If no model is set for this node return the parent nodes model. Return None if no model is set for the node hierarchy.
-
model
¶ Get this nodes model. If no model is set for this node return the parent nodes model. Return None if no model is set for the node hierarchy.
-
notify_all_columns_changed
()[source]¶ No argument variant of notify_data_changed(). Useful to connect to signals whose arguments are to be discarded (the args would take the place of col1 and col2 which is not desired).
-
notify_data_changed
(col1=0, col2=None)[source]¶ Calls notify_data_changed on the nodes model if a model is set. col1 and col2 specify the first and last column that changed. If col2 is None it will be set to the models column count. If the node has no model this method does nothing.
-
parent
¶
-
ref
¶
-
row
¶
-
mesycontrol.config_gui module¶
-
class
mesycontrol.config_gui.
ApplyDeviceConfigsRunner
(devices, parent_widget, parent=None)[source]¶ Bases:
mesycontrol.config_util.GeneratorRunner
-
progress_changed
¶
-
-
class
mesycontrol.config_gui.
ApplySetupRunner
(app_registry, device_registry, parent_widget, parent=None)[source]¶ Bases:
mesycontrol.config_util.GeneratorRunner
-
progress_changed
¶
-
-
class
mesycontrol.config_gui.
FillDeviceConfigsRunner
(devices, parent_widget, parent=None)[source]¶ Bases:
mesycontrol.config_util.GeneratorRunner
-
progress_changed
¶
-
-
class
mesycontrol.config_gui.
ReadConfigParametersRunner
(devices, parent_widget, parent=None)[source]¶ Bases:
mesycontrol.config_util.GeneratorRunner
-
progress_changed
¶
-
-
class
mesycontrol.config_gui.
SubProgressDialog
(title='', parent=None)[source]¶ Bases:
PyQt4.QtGui.QDialog
-
canceled
¶
-
mesycontrol.config_model module¶
-
class
mesycontrol.config_model.
Device
(bus=None, address=None, idc=None, parent=None)[source]¶ Bases:
mesycontrol.basic_model.Device
-
clear_cached_memory
(*args, **kwargs)[source]¶ Clears the memory cache. Returns True if any parameters where cleared. Otherwise False is returned.
-
clear_cached_parameter
(*args, **kwargs)[source]¶ Removes the cached memory value at the given address. Emits parameter_changed and returns True if the parameter was present in the memory cache. Otherwise False is returned.
-
modified
¶
-
modified_changed
¶
-
name
¶
-
name_changed
¶
-
set_cached_parameter
(*args, **kwargs)[source]¶ Set the memory cache at the given address to the given value. Emits parameter_changed and returns True if the value changes. Otherwise no signal is emitted and False is returned. Raises ValueError if address is out of range.
-
set_modified
(b)¶
-
-
class
mesycontrol.config_model.
MRC
(url=None, parent=None)[source]¶ Bases:
mesycontrol.basic_model.MRC
-
autoconnect
¶
-
autoconnect_changed
¶
-
modified
¶
-
modified_changed
¶
-
name
¶
-
name_changed
¶
-
set_modified
(b)¶
-
-
class
mesycontrol.config_model.
Setup
(parent=None)[source]¶ Bases:
mesycontrol.basic_model.MRCRegistry
-
autoconnect
¶
-
autoconnect_changed
¶
-
filename
¶
-
filename_changed
¶
-
modified
¶
-
modified_changed
¶
-
set_modified
(b)¶
-
mesycontrol.config_tree_model module¶
mesycontrol.config_util module¶
-
class
mesycontrol.config_util.
GeneratorRunner
(generator=None, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
progress_changed
¶
-
-
exception
mesycontrol.config_util.
MissingDestinationDevice
(url, bus, dev)[source]¶ Bases:
exceptions.RuntimeError
-
exception
mesycontrol.config_util.
MissingDestinationMRC
(url)[source]¶ Bases:
exceptions.RuntimeError
-
class
mesycontrol.config_util.
ProgressUpdate
(current, total, text='')[source]¶ Bases:
object
-
current
¶
-
total
¶
-
-
exception
mesycontrol.config_util.
SetParameterError
(set_result, device=None)[source]¶ Bases:
exceptions.RuntimeError
-
mesycontrol.config_util.
apply_device_config
(device)[source]¶ Device may be an app_model.Device instance or a DeviceBase subclass.
-
mesycontrol.config_util.
apply_device_configs
(devices)[source]¶ Applies config values to the hardware for each of the given devices. Required MRC connections are established.
-
mesycontrol.config_util.
apply_parameters
(source, dest, criticals, non_criticals)[source]¶ Write parameters from source to dest. First criticals are set to their safe value, then non_criticals are written to the destination and finally criticals are set to the value they have in the source device.
mesycontrol.config_xml module¶
-
class
mesycontrol.config_xml.
CommentTreeBuilder
(element_factory=None)[source]¶ Bases:
xml.etree.ElementTree.TreeBuilder
-
mesycontrol.config_xml.
read_setup
(source)[source]¶ Load a Setup from the given source. Source may be a filename or a file like object.
-
mesycontrol.config_xml.
write_device_config
(device_config, dest, parameter_names={})[source]¶ Write the given device config to destination. The optional parameter_names should map parameter_address to parameter_name. These names will be added as comments in the resulting XML.
mesycontrol.device_profile module¶
-
class
mesycontrol.device_profile.
DeviceProfile
(idc)[source]¶ Bases:
object
-
idc
= None¶ Device Identifier Code
-
name
= None¶ Device name (e.g. MHV4). Should be unique.
-
-
class
mesycontrol.device_profile.
ParameterProfile
(address)[source]¶ Bases:
object
-
address
= None¶ Numeric address of the parameter.
-
critical
= None¶ True if this parameter affects a critical
-
default
¶
-
do_not_store
= None¶ True if this parameters value should not be stored
-
index
= None¶ Index number of this parameter if it is part of a sequence
-
name
¶
-
poll
= None¶ True if this parameter should be polled repeatedly.
-
range
= None¶ Range instance limiting this parameters values.
-
read_only
= None¶ True if this parameter is read only. Its
-
safe_value
= None¶ Optional safe value if this parameter is critical.
-
units
= None¶ Optional list of Unit definitions for this parameter.
-
mesycontrol.device_registry module¶
-
class
mesycontrol.device_registry.
DeviceRegistry
(auto_load_modules=False)[source]¶ Bases:
object
Provides access to device modules.
-
get_parameter_name_mapping
()[source]¶ Returns a mapping of device_idc to a dictionary of param_address -> param_name. Basically the known parameter names for each device.
-
mesycontrol.device_tableview module¶
-
class
mesycontrol.device_tableview.
DeviceTableItemDelegate
(parent=None)[source]¶ Bases:
PyQt4.QtGui.QStyledItemDelegate
-
class
mesycontrol.device_tableview.
DeviceTableModel
(device, display_mode, write_mode, parent=None)[source]¶ Bases:
PyQt4.QtCore.QAbstractTableModel
-
device
¶
-
display_mode
¶
-
editing_ignore_parameter_ranges
¶
-
profile
¶
-
write_mode
¶
-
-
class
mesycontrol.device_tableview.
DeviceTableSortFilterProxyModel
(parent=None)[source]¶ Bases:
PyQt4.QtGui.QSortFilterProxyModel
QSortFilterProxyModel subclass to be used with the DeviceTableView. Filtering capabilities:
- known addresses
- read / write addresses
- addresses with the poll flag set
-
filter_readonly
¶
-
filter_static
¶
-
filter_unknown
¶
-
filter_volatile
¶
mesycontrol.eventloop_callback module¶
-
class
mesycontrol.eventloop_callback.
ref
(method)[source]¶ Bases:
object
A weak method implementation
-
class
mesycontrol.eventloop_callback.
proxy
(method, quiet=False)[source]¶ Bases:
mesycontrol.eventloop_callback.ref
Exactly like ref, but calling it will cause the referent method to be called with the same arguments. If the referent’s object no longer lives, ReferenceError is raised.
If quiet is True, then a ReferenceError is not raise and the callback silently fails if it is no longer valid.
-
class
mesycontrol.eventloop_callback.
CallbackEvent
(func, *args, **kwargs)[source]¶ Bases:
PyQt4.QtCore.QEvent
A custom QEvent that contains a callback reference
Also provides class methods for conveniently executing arbitrary callback, to be dispatched to the event loop.
-
EVENT_TYPE
= 65535¶
-
-
class
mesycontrol.eventloop_callback.
CallbackThreadPool
(processes=None, initializer=None, initargs=())[source]¶ Bases:
multiprocessing.pool.ThreadPool
Simple wrapper around ThreadPool to wrap callbacks in a weakref that get posted as CallbackEvents in the main thread.
mesycontrol.future module¶
-
class
mesycontrol.future.
FutureObserver
(the_future=None, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
Qt wrapper around a Future object using Qt signals to notify about state changes.
-
cancelled
¶
-
done
¶
-
future
¶
-
progress_changed
¶
-
progress_range_changed
¶
-
progress_text_changed
¶
-
mesycontrol.gui module¶
mesycontrol.gui_mainwindow module¶
mesycontrol.gui_tutorial module¶
-
class
mesycontrol.gui_tutorial.
TutorialTextBrowser
(parent=None, **kwargs)[source]¶ Bases:
PyQt4.QtGui.QTextBrowser
-
href_hover
¶
-
mesycontrol.gui_util module¶
-
class
mesycontrol.gui_util.
DeviceNotesWidget
(device, parent=None)[source]¶ Bases:
PyQt4.QtGui.QWidget
-
ADD_PIXELS_PER_ROW
= 5¶
-
DISPLAY_ROWS
= 3¶
-
-
class
mesycontrol.gui_util.
DeviceSubWindow
(widget, window_name_prefix, parent=None, **kwargs)[source]¶ Bases:
PyQt4.QtGui.QMdiSubWindow
-
device
¶
-
display_mode
¶
-
linked_mode
¶
-
update_title_and_name
()[source]¶ Updates the window title and the object name taking into account the display_mode and the device state.
-
write_mode
¶
-
-
class
mesycontrol.gui_util.
ServerLogView
(server_process, max_lines=10000, line_wrap=1, parent=None)[source]¶ Bases:
PyQt4.QtGui.QPlainTextEdit
-
mesycontrol.gui_util.
run_add_device_config_dialog
(device_registry, registry, mrc, bus=None, address=None, parent_widget=None)[source]¶
mesycontrol.hardware_controller module¶
-
class
mesycontrol.hardware_controller.
Controller
(connection)[source]¶ Bases:
object
Link between hardware_model.MRC and MRCConnection. Reacts to changes to the connection state and updates the hardware model accordingly. Also takes requests from the hardware model and forwards them to the connection.
-
add_poll_item
(subscriber, bus, address, item)[source]¶ Add a poll subscription for the given (bus, address, item). Item may be a single parameter address or a tuple of (lower, upper) addresses to poll. The poll item is removed if the given subscriber is destroyed.
-
mrc
¶
-
read_parameter
(bus, device, address)[source]¶ Read the parameter at (bus, device address). Returns a basic_model.ResultFuture containing a basic_model.ReadResult instance on success.
-
mesycontrol.hardware_model module¶
-
class
mesycontrol.hardware_model.
Device
(bus, address, idc, parent=None)[source]¶ Bases:
mesycontrol.basic_model.Device
-
add_poll_item
(subscriber, item)[source]¶ Add parameters that should be polled repeatedly. As long as the given subscriber object is alive and the device is connected, the given item will be polled. Item may be a single parameter address or a tuple of (lower, upper) addresses to poll. If the server and mrc support reading parameter ranges and a tuple is given, the read range command will be used.
-
address_conflict
¶
-
address_conflict_changed
¶
-
connected
¶
-
connecting
¶
-
connection_error
¶ error object
-
controller
¶
-
disconnected
¶
-
rc
¶
-
rc_changed
¶
-
-
class
mesycontrol.hardware_model.
MRC
(url, parent=None)[source]¶ Bases:
mesycontrol.basic_model.MRC
-
address_conflict_changed
¶
-
connect
(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection) → bool[source]¶ QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection) -> bool QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection) -> bool
-
connected
¶
-
connecting
¶ future object
-
connection
¶
-
connection_error
¶ error object
-
controller
¶
-
disconnect
(QObject, SIGNAL(), QObject, SLOT()) → bool[source]¶ QObject.disconnect(QObject, SIGNAL(), callable) -> bool
-
disconnected
¶
-
set_controller
(controller)[source]¶ Set the hardware controller this MRC should use. The MRC holds a strong reference to the controller.
-
set_write_access
(has_write_access, can_acquire)[source]¶ Updates the local write access and can_acquire flags. Emits write_access_changed() if one of the two flags changed.
-
silenced
¶
-
silenced_changed
¶ is_silenced
-
status_changed
¶ proto.MRCStatus
-
write_access
¶
-
write_access_changed
¶ has_write_access, can_acquire
-
mesycontrol.hardware_tree_model module¶
mesycontrol.hardware_util module¶
mesycontrol.log_view module¶
mesycontrol.mc_treeview module¶
-
class
mesycontrol.mc_treeview.
AutoPopupComboBox
(parent=None)[source]¶ Bases:
PyQt4.QtGui.QComboBox
QComboBox subclass which automatically shows its popup on receiving a non-spontaneous showEvent.
-
class
mesycontrol.mc_treeview.
DoubleClickSplitter
(orientation=1, parent=None)[source]¶ Bases:
PyQt4.QtGui.QSplitter
QSplitter using DoubleClickSplitterHandles.
-
class
mesycontrol.mc_treeview.
DoubleClickSplitterHandle
(orientation, parent)[source]¶ Bases:
PyQt4.QtGui.QSplitterHandle
Double click support for QSplitterHandle. Emits the doubleClicked signal if a double click occured on the handle and the mouse button is released within 200ms (if the mouse button is not released the user is most likely dragging the handle).
-
doubleClicked
¶
-
-
class
mesycontrol.mc_treeview.
MCTreeDirector
(app_registry, device_registry, linked_mode_on=False)[source]¶ Bases:
object
-
linked_mode
¶
-
-
class
mesycontrol.mc_treeview.
MCTreeItemDelegate
(tree_director, parent=None)[source]¶ Bases:
PyQt4.QtGui.QStyledItemDelegate
mesycontrol.mesycontrol_pb2 module¶
mesycontrol.model_util module¶
-
mesycontrol.model_util.
add_mrc_connection
(hardware_registry, url, do_connect, connect_timeout_ms=10000)[source]¶ Adds an MRC connection using the given url to the hardware_registry. If `do_connect’ is True this function will start a connection attempt and return the corresponding Future object. Otherwise the newly added MRC will be in disconnected state and None is returned.
mesycontrol.mrc_connection module¶
-
class
mesycontrol.mrc_connection.
AbstractConnection
(parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
connect
(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection) → bool[source]¶ QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection) -> bool QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection) -> bool
-
connected
¶ connected and ready to send requests
-
connecting
¶ Establishing the connection. The argument is a
-
connection_error
¶ error object
-
disconnect
(QObject, SIGNAL(), QObject, SLOT()) → bool[source]¶ QObject.disconnect(QObject, SIGNAL(), callable) -> bool
-
disconnected
¶ disconnected; not ready to handle requests
-
error_message_received
¶ Message
-
message_received
¶ Message
-
notification_received
¶ Message
-
queue_empty
¶
-
queue_size_changed
¶
-
request_queued
¶ request, Future
-
request_sent
¶ request, Future
-
response_received
¶ request, response, Future
-
url
¶
-
-
class
mesycontrol.mrc_connection.
LocalMRCConnection
(server_options={}, parent=None)[source]¶ Bases:
mesycontrol.mrc_connection.AbstractConnection
-
connect
(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection) → bool[source]¶ QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection) -> bool QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection) -> bool
-
connect_delay_ms
= 1000¶ delay between server startup and connection attempt
-
-
class
mesycontrol.mrc_connection.
MRCConnection
(host, port, parent=None)[source]¶ Bases:
mesycontrol.mrc_connection.AbstractConnection
-
connect
(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection) → bool[source]¶ QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection) -> bool QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection) -> bool
-
-
mesycontrol.mrc_connection.
factory
(**kwargs)[source]¶ Connection factory. Supported keyword arguments in order of priority:
- config: MRCConnectionConfig instance specifying the details of the connection.
- url: A string that is passed to util.parse_connection_url(). The resulting dictionary will then be used to create the connection.
- mc_host, mc_port: Creates a MRCConnection to the given host and port.
- serial_port, baud_rate: Creates a LocalMRCConnection using the given serial port and baud rate.
- host, port: Creates a LocalMRCConnection connecting to the MRC on the given host and port.
Additionally ‘parent’ may specify a parent QObject for the resulting connection.
mesycontrol.parameter_binding module¶
-
class
mesycontrol.parameter_binding.
AbstractParameterBinding
(device, profile, target, display_mode, write_mode=None, fixed_modes=False, **kwargs)[source]¶ Bases:
object
-
add_update_callback
(method_or_func, *args, **kwargs)[source]¶ Adds a callback to be invoked when this binding updates its target.
The callback will be called with the result_future that caused the update as its first argument and the optional args and kwargs as the following arguments.
If the given method_or_func is a bound method a weak reference to the corresponding object will be stored. This way the parameter binding won’t keep any objects alive just because they’re registered as a callback.
http://stackoverflow.com/questions/1673483/how-to-store-callback-methods
-
address
¶
-
device
¶
-
display_mode
¶
-
populate
()[source]¶ Gets the value of this bindings parameter and updates the target display once the value is retrieved.
-
read_address
¶
-
read_profile
¶
-
write_address
¶
-
write_mode
¶
-
write_profile
¶
-
-
class
mesycontrol.parameter_binding.
CheckBoxParameterBinding
(**kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
-
class
mesycontrol.parameter_binding.
ComboBoxParameterBinding
(**kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
-
class
mesycontrol.parameter_binding.
DefaultParameterBinding
(**kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.AbstractParameterBinding
-
class
mesycontrol.parameter_binding.
DoubleSpinBoxParameterBinding
(unit_name, **kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
-
class
mesycontrol.parameter_binding.
LCDNumberParameterBinding
(unit_name=None, precision=2, **kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
-
class
mesycontrol.parameter_binding.
LabelParameterBinding
(unit_name, prec=2, **kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
Bases:
exceptions.Exception
-
class
mesycontrol.parameter_binding.
RadioButtonGroupParameterBinding
(**kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
-
class
mesycontrol.parameter_binding.
ReadWriteProfile
[source]¶ Bases:
mesycontrol.parameter_binding.ReadWriteProfile
-
range
¶
-
units
¶
-
-
class
mesycontrol.parameter_binding.
SliderParameterBinding
(unit_name=None, update_on='value_changed', **kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
-
class
mesycontrol.parameter_binding.
SpinBoxEditingObserver
(the_binding, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
class
mesycontrol.parameter_binding.
SpinBoxParameterBinding
(**kwargs)[source]¶ Bases:
mesycontrol.parameter_binding.DefaultParameterBinding
mesycontrol.proto module¶
mesycontrol.qt module¶
mesycontrol.resources module¶
mesycontrol.server_process module¶
-
mesycontrol.server_process.
BASE_PORT
= 23000¶ The default port to listen on
-
mesycontrol.server_process.
MAX_PORT
= 65535¶ The maximum port number.
-
class
mesycontrol.server_process.
ServerProcess
(binary='mesycontrol_server', listen_address='127.0.0.1', listen_port=23000, serial_port=None, baud_rate=0, tcp_host=None, tcp_port=4001, verbosity=0, output_buffer_maxlen=10000, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
error
¶
-
exit_codes
= {0: 'exit_success', 1: 'exit_options_error', 2: 'exit_address_in_use', 3: 'exit_address_not_available', 4: 'exit_permission_denied', 5: 'exit_bad_listen_address', 127: 'exit_unknown_error'}¶
-
finished
¶ exit_status, exit_code, exit_code_string
-
output
¶
-
started
¶
-
startup_delay_ms
= 200¶
-
stopped
¶
-
mesycontrol.specialized_device module¶
-
class
mesycontrol.specialized_device.
DeviceBase
(app_device, read_mode, write_mode, parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
Acts as a decorator for an app_model.Device. Should be subclassed to create device specific classes, e.g. class MHV4(DeviceBase).
-
cfg_idc_changed
¶
-
cfg_module_changed
¶
-
cfg_profile_changed
¶
-
config_applied_changed
¶
-
config_set
¶ self, old, new
-
extension_changed
¶
-
hardware_set
¶ self, old, new
-
hw_idc_changed
¶
-
hw_module_changed
¶
-
hw_profile_changed
¶
-
idc_changed
¶
-
idc_conflict
¶
-
idc_conflict_changed
¶
-
module
¶
-
module_changed
¶
-
mrc_changed
¶
-
parameter_changed
¶
-
profile
¶
-
profile_changed
¶
-
read_mode
¶
-
read_mode_changed
¶
-
write_mode
¶
-
write_mode_changed
¶
-
mesycontrol.tcp_client module¶
-
class
mesycontrol.tcp_client.
MCTCPClient
(parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
Mesycontrol TCP client
-
connect
(host, port)[source]¶ Connect to the given host and port. Returns a Future that fullfills once the connection has been established or an errors occurs. Disconnects if the client currently is connected.
-
connected
¶
-
connecting
¶
-
disconnect
()[source]¶ Disconnect. Returns a Future that fullfills once the connection has been disconnected or an error occurs.
-
disconnected
¶
-
error_received
¶ Message
-
host
¶
-
message_received
¶ Message
-
notification_received
¶ Message
-
port
¶
-
queue_empty
¶
-
queue_request
(request)[source]¶ Adds the given request to the outgoing queue. Returns a Future that fullfills once a response is received or an error occurs.
-
queue_size_changed
¶
-
request_queued
¶ request, Future
-
request_sent
¶ request, Future
-
response_received
¶ request, response, Future
-
socket_error
¶ instance of SocketError
-
mesycontrol.util module¶
-
class
mesycontrol.util.
CallbackHandler
[source]¶ Bases:
logging.Handler
Logging handler passing log_records to callbacks.
-
class
mesycontrol.util.
DelayedDoubleSpinBox
(parent=None, delay=0.5)[source]¶ Bases:
PyQt4.QtGui.QDoubleSpinBox
-
delayed_valueChanged
¶
-
-
class
mesycontrol.util.
DelayedSpinBox
(delay=0.5, parent=None)[source]¶ Bases:
PyQt4.QtGui.QSpinBox
-
delayed_valueChanged
¶
-
-
class
mesycontrol.util.
ExceptionHookRegistry
[source]¶ Bases:
object
Exception handler registry for use with sys.excepthook. Contains a list of handler objects which will get called in the order they where registered when an exception occurs.
-
class
mesycontrol.util.
FixedWidthVerticalToolBar
(parent=None)[source]¶ Bases:
PyQt4.QtGui.QWidget
Like a vertical QToolBar but having a fixed width. I did not manage to get a QToolBar to have a fixed width. That’s the only reason this class exists.
-
class
mesycontrol.util.
GarbageCollector
(parent=None, debug=False)[source]¶ Bases:
PyQt4.QtCore.QObject
Disable automatic garbage collection and instead collect manually every INTERVAL milliseconds.
This is done to ensure that garbage collection only happens in the GUI thread, as otherwise Qt can crash.
-
INTERVAL
= 1000¶
-
-
class
mesycontrol.util.
MinimumLevelFilter
(minimum_level)[source]¶ Bases:
object
Log records with a level greater or equal to minimum_level will pass through this filter.
-
class
mesycontrol.util.
QtLoggingBridge
(parent=None)[source]¶ Bases:
PyQt4.QtCore.QObject
-
log_record
¶
-
-
class
mesycontrol.util.
SimpleToolBar
(orientation=1, parent=None)[source]¶ Bases:
PyQt4.QtGui.QWidget
-
exception
mesycontrol.util.
SocketError
(error_code, error_string)[source]¶ Bases:
exceptions.Exception
-
mesycontrol.util.
build_connection_url
(serial_port=None, baud_rate=0, host=None, port=4001, mc_host=None, mc_port=23000)[source]¶
-
mesycontrol.util.
list_serial_ports_windows
(type_mask)[source]¶ Uses the Win32 registry to return an iterator of serial (COM) ports existing on this computer. Source: http://eli.thegreenplace.net/2009/07/31/listing-all-serial-ports-on-windows-with-python/
-
mesycontrol.util.
loadUi
(filename, baseinstance=None)[source]¶ This version of PyQts uic.loadUi() adds support for loading from resource files.
-
mesycontrol.util.
make_spinbox
(min_value=None, max_value=None, value=None, limits=None, prefix=None, suffix=None, single_step=None, parent=None)[source]¶
-
mesycontrol.util.
parse_connection_url
(url)[source]¶ Parses the given connection URL. Returns a dictionary ready to be passed to mrc_connection.factory() to create a connection instance. Supported URL formats: - For serial connections:
<serial_port>@<baud> serial://<serial_port>[@<baud=9600>]- For TCP connections (serial server connected to an MRC1):
- <host>:<port> tcp://<host>[:<port=4001>]
- For connections to a mesycontrol server:
- mc://<host>[:<port=23000>]
-
mesycontrol.util.
wait_for_signal
(signal, expected_args=None, timeout_ms=0, emitting_callable=None)[source]¶ Uses a local Qt event loop to wait for the given signal to arrive.
expected_args specifies which arguments are expected once the signal is emitted. If expected_args is None any arguments are valid. To specify a placeholder argument use the AnyValue class above (put the class directly into the argument sequence, don’t instantiate it).
timeout_ms gives the maximum time in milliseconds to wait for the signal. If 0 this function will wait forever.
emitting_callable can be used to pass a callable object to the function. This callable will be invoked from within the internal event loop. This is neccessary to avoid missing signals connected via Qt’s direct connection mechanism (the signal would arrive before the event loop was started and thus it would be missed completely).
The return value is True if the signal arrived within the given timeout and with the correct arguments. Otherwise False is returned.