示例#1
0
def test_plugin_for_address(test_plugin):
    # Get by protocol
    assert isinstance(plugin_for_address('tst://tst:this'),
                      test_plugin)
    assert plugin_for_address('tst:this') is None
    # Default protocol
    config.DEFAULT_PROTOCOL = 'tst'
    assert isinstance(plugin_for_address('tst:this'),
                      test_plugin)
示例#2
0
def test_plugin_for_address(test_plugin):
    # Get by protocol
    assert isinstance(plugin_for_address('tst://tst:this'),
                      test_plugin)
    assert plugin_for_address('tst:this') is None
    # Default protocol
    config.DEFAULT_PROTOCOL = 'tst'
    assert isinstance(plugin_for_address('tst:this'),
                      test_plugin)
示例#3
0
def test_pydm_connection(test_plugin):
    # Plugin, Channel and Registry
    chan = PyDMChannel('tst://Tst:this')
    plugin = plugin_for_address(chan.address)
    plugin_no = len(plugin.connections)
    # Make a connection
    chan.connect()
    assert len(plugin.connections) == plugin_no + 1
    # Remove connections
    chan.disconnect()
    assert len(plugin.connections) == plugin_no
示例#4
0
    def __init__(self, parent=None, init_channel=None, replace=None):
        QListWidget.__init__(self, parent)
        PyDMWidget.__init__(self, init_channel=init_channel)
        self._buffer_size = 1000
        self._prepend_date_time = True
        self._display_format_type = DisplayFormat.String
        self._string_encoding = "utf_8"
        self._date_time_fmt = '%Y/%m/%d-%H:%M:%S'
        self._replace = list() if replace is None else replace

        channel = '' if init_channel is None else init_channel
        self._plugin_conns = plugin_for_address(channel).connections
示例#5
0
文件: channel.py 项目: tynanford/pydm
 def disconnect(self, destroying=False):
     """
     Disconnect a PyDMChannel
     """
     if is_qt_designer() and not config.DESIGNER_ONLINE:
         return
     try:
         plugin = plugin_for_address(self.address)
         if not plugin:
             return
         plugin.remove_connection(self, destroying=destroying)
     except Exception as exc:
         logger.exception("Unable to remove connection " "for %r", self)
示例#6
0
文件: channel.py 项目: tynanford/pydm
 def connect(self):
     """
     Connect a PyDMChannel to the proper PyDMPlugin
     """
     if is_qt_designer() and not config.DESIGNER_ONLINE:
         return
     logger.debug("Connecting %r", self.address)
     # Connect to proper PyDMPlugin
     try:
         plugin = plugin_for_address(self.address)
         plugin.add_connection(self)
     except Exception:
         logger.exception("Unable to make proper connection "
                          "for %r", self)
示例#7
0
def reset_signal_plugin():
    """
    Completely restart the sig:// plugin.

    After the restart, there will be no open SignalConnection objects
    and nothing in the signal registry.

    Some tests are easier to express by repeating signal names, which
    will cause the signal plugin to ignore the new devices in favor of
    the previously saved devices, which are no longer available to be
    manipulated or tested.
    """
    signal_registry.clear()
    plugin = plugin_for_address('sig://test')
    for channel in list(plugin.channels):
        channel.disconnect()
示例#8
0
def test_pydm_connection(test_plugin):
    # Plugin, Channel and Registry
    chan = PyDMChannel('tst://Tst:this3')
    plugin = plugin_for_address(chan.address)
    plugin_no = len(plugin.connections)

    print('Connections Before:')
    for k, v in plugin.connections.items():
        print('\t', k, ' - ', v)

    # Make a connection
    chan.connect()

    print('Connections After:')
    for k, v in plugin.connections.items():
        print('\t', k, ' - ', v)

    assert len(plugin.connections) == plugin_no + 1
    # Remove connections
    chan.disconnect()
    assert len(plugin.connections) == plugin_no