How to use the qtpyvcp.hal function in qtpyvcp

To help you get started, we’ve selected a few qtpyvcp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kcjengr / qtpyvcp / qtpyvcp / widgets / hal_widgets / hal_checkbox.py View on Github external
def initialize(self):
        comp = hal.COMPONENTS['qtpyvcp']
        obj_name = str(self.objectName()).replace('_', '-')

        # add checkbox.enable HAL pin
        self._enable_pin = comp.addPin(obj_name + ".enable", "bit", "in")
        self._enable_pin.value = self.isEnabled()
        self._enable_pin.valueChanged.connect(self.setEnabled)

        # add checkbox.check HAL pin
        self._check_pin = comp.addPin(obj_name + ".check", "bit", "in")
        self._check_pin.value = self.isChecked()
        self._check_pin.valueChanged.connect(self.setChecked)

        # add checkbox.checked HAL pin
        self._checked_pin = comp.addPin(obj_name + ".checked", "bit", "out")
        self._checked_pin.value = self.isChecked()
github kcjengr / qtpyvcp / examples / mini / mini.py View on Github external
def __init__(self, *args, **kwargs):
        super(MiniVCP, self).__init__(*args, **kwargs)

        comp = hal.component('hello')
        comp.addPin('testing', 'float', 'in')
        comp.addListener('testing', self.onHalTestingChanged)
        comp.ready()
github kcjengr / qtpyvcp / qtpyvcp / app / launcher.py View on Github external
def launch_application(opts, config):
    qtpyvcp.OPTIONS.update(opts)
    qtpyvcp.CONFIG.update(config)

    hal_comp = hal.component('qtpyvcp')

    LOG.debug('Loading data plugings')
    loadPlugins(config['data_plugins'])
    log_time('done loading data plugins')

    LOG.debug('Initializing app')
    app = _initialize_object_from_dict(config['application'])
    log_time('done initializing app')

    LOG.debug('Loading dialogs')
    loadDialogs(config['dialogs'])
    log_time('done loading dialogs')

    LOG.debug('Loading windows')
    loadWindows(config['windows'])
    log_time('done loading windows')
github kcjengr / qtpyvcp / qtpyvcp / hal / __init__.py View on Github external
except KeyError:
        LOG.info("Creating new HAL component: %s", name)
        comp = component(name)

    return comp


if __name__ == "__main__":

    from qtpy.QtWidgets import QApplication
    from qtpyvcp import hal

    app = QApplication([])

    # create a new component and add some pins
    comp = hal.getComponent("loop-back")
    comp.addPin("in", "float", "in")
    comp.addPin("out", "float", "out")

    # mark the component as 'ready'
    comp.ready()

    # define a function to call when the input pin changes
    def onInChanged(new_value):
        print("loop-back.in pin changed:", new_value)
        # loop the out pin to the in pin value
        comp.getPin('out').value = new_value

    # connect the listener to the input pin
    comp.addListener('in', onInChanged)

    app.exec_()