connectors/__init__.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Thu, 28 Sep 2023 18:28:07 +0200
changeset 3847 832c257d5618
parent 3776 1fbc900ca1ce
child 3884 34da877021d5
permissions -rw-r--r--
IDE: connect local runtime with '127.0.0.1' instead of 'localhost'
Workaround localhost possibly resolving as ::1. leading to problems.
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     1
#!/usr/bin/env python
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     2
# -*- coding: utf-8 -*-
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     3
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     4
# This file is part of Beremiz, a Integrated Development Environment for
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     5
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     6
#
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     7
# Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     8
# Copyright (C) 2017: Andrey Skvortsov
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
     9
#
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    10
# See COPYING file for copyrights details.
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    11
#
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    12
# This program is free software; you can redistribute it and/or
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    13
# modify it under the terms of the GNU General Public License
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    14
# as published by the Free Software Foundation; either version 2
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    15
# of the License, or (at your option) any later version.
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    16
#
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    17
# This program is distributed in the hope that it will be useful,
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    20
# GNU General Public License for more details.
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    21
#
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    22
# You should have received a copy of the GNU General Public License
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    23
# along with this program; if not, write to the Free Software
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    24
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    25
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    26
# Package initialisation
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    27
1881
091005ec69c4 fix pylint py3k conversion warning: "(no-absolute-import) import missing `from __future__ import absolute_import`"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1785
diff changeset
    28
3721
6365e33fb11f Tests: allow overriding local host's hostname with BEREIS_LOCAL_HOST env variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3501
diff changeset
    29
import os
3757
814595c0ea16 fix dynamic module loading
GP Orcullo <kinsamanka@gmail.com>
parents: 3750
diff changeset
    30
import importlib
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    31
from os import listdir, path
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
    32
from connectors.ConnectorBase import ConnectorBase
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    33
3776
1fbc900ca1ce switched to Pyro5
GP Orcullo <kinsamanka@gmail.com>
parents: 3757
diff changeset
    34
connectors_packages = ["PYRO"]
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    35
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    36
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    37
def _GetLocalConnectorClassFactory(name):
3757
814595c0ea16 fix dynamic module loading
GP Orcullo <kinsamanka@gmail.com>
parents: 3750
diff changeset
    38
    return lambda: getattr(importlib.import_module(f"connectors.{name}"),
814595c0ea16 fix dynamic module loading
GP Orcullo <kinsamanka@gmail.com>
parents: 3750
diff changeset
    39
                           f"{name}_connector_factory")
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    40
2182
eeca1aff0691 Fix linter errors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2007
diff changeset
    41
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    42
connectors = {name: _GetLocalConnectorClassFactory(name)
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    43
              for name in connectors_packages}
2007
ef2d479f564f #2476 Connectors dialog module added.
dporopat <denis.poropat@smarteh.si>
parents: 2006
diff changeset
    44
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    45
_dialogs_imported = False
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    46
per_URI_connectors = None
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
    47
schemes = None
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
    48
2182
eeca1aff0691 Fix linter errors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2007
diff changeset
    49
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    50
# lazy import of connectors dialogs, only if used
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    51
def _Import_Dialogs():
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    52
    global per_URI_connectors, schemes, _dialogs_imported
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
    53
    if not _dialogs_imported:
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    54
        _dialogs_imported = True
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    55
        per_URI_connectors = {}
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    56
        schemes = []
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    57
        for con_name in connectors_packages:
3757
814595c0ea16 fix dynamic module loading
GP Orcullo <kinsamanka@gmail.com>
parents: 3750
diff changeset
    58
            module = importlib.import_module(f"connectors.{con_name}_dialog")
2007
ef2d479f564f #2476 Connectors dialog module added.
dporopat <denis.poropat@smarteh.si>
parents: 2006
diff changeset
    59
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    60
            for scheme in module.Schemes:
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    61
                per_URI_connectors[scheme] = getattr(module, con_name + '_dialog')
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
    62
                schemes += [scheme]
2007
ef2d479f564f #2476 Connectors dialog module added.
dporopat <denis.poropat@smarteh.si>
parents: 2006
diff changeset
    63
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    64
3847
832c257d5618 IDE: connect local runtime with '127.0.0.1' instead of 'localhost'
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3776
diff changeset
    65
LocalHost = os.environ.get("BEREMIZ_LOCAL_HOST", "127.0.0.1")
3721
6365e33fb11f Tests: allow overriding local host's hostname with BEREIS_LOCAL_HOST env variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3501
diff changeset
    66
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    67
def ConnectorFactory(uri, confnodesroot):
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    68
    """
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    69
    Return a connector corresponding to the URI
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    70
    or None if cannot connect to URI
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    71
    """
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
    72
    _scheme = uri.split("://")[0].upper()
2478
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    73
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    74
    # commented code to enable for MDNS:// support
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    75
    # _scheme, location = uri.split("://")
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    76
    # _scheme = _scheme.upper()
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    77
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
    78
    if _scheme == "LOCAL":
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    79
        # Local is special case
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    80
        # pyro connection to local runtime
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
    81
        # started on demand, listening on random port
2338
2c3222433244 Renaming servicetype into scheme.
Edouard Tisserant
parents: 2329
diff changeset
    82
        scheme = "PYRO"
3501
fa291393aac7 Added preliminary CLI. Supports building a project, transfering and running on PLC.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2537
diff changeset
    83
        runtime_port = confnodesroot.StartLocalRuntime()
3776
1fbc900ca1ce switched to Pyro5
GP Orcullo <kinsamanka@gmail.com>
parents: 3757
diff changeset
    84
        uri = f"PYRO://{LocalHost}:{runtime_port}"
2478
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    85
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    86
    # commented code to enable for MDNS:// support
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    87
    # elif _scheme == "MDNS":
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    88
    #     try:
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    89
    #         from zeroconf import Zeroconf
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    90
    #         r = Zeroconf()
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    91
    #         i = r.get_service_info(zeroconf_service_type, location)
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    92
    #         if i is None:
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    93
    #             raise Exception("'%s' not found" % location)
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    94
    #         ip = str(socket.inet_ntoa(i.address))
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    95
    #         port = str(i.port)
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    96
    #         newlocation = ip + ':' + port
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    97
    #         confnodesroot.logger.write(_("'{a1}' is located at {a2}\n").format(a1=location, a2=newlocation))
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    98
    #         location = newlocation
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
    99
    #         # not a bug, but a workaround against obvious downgrade attack
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   100
    #         scheme = "PYROS"
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   101
    #         r.close()
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   102
    #     except Exception:
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   103
    #         confnodesroot.logger.write_error(_("MDNS resolution failure for '%s'\n") % location)
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   104
    #         confnodesroot.logger.write_error(traceback.format_exc())
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   105
    #         return None
733d77bf0aa7 Disable MDNS:// scheme support. Also prevent discovery pannel to produce some. For now it seems that that feature is unused, and could be a security issue.
Edouard Tisserant
parents: 2469
diff changeset
   106
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   107
    elif _scheme in connectors:
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   108
        scheme = _scheme
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   109
    elif _scheme[-1] == 'S' and _scheme[:-1] in connectors:
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   110
        scheme = _scheme[:-1]
1731
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
   111
    else:
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
   112
        return None
6ebd9c40b2be convert some files from CRLF to LF
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1680
diff changeset
   113
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   114
    # import module according to uri type and get connector specific baseclass
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
   115
    # first call to import the module,
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   116
    # then call with parameters to create the class
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   117
    connector_specific_class = connectors[scheme]()(uri, confnodesroot)
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
   118
2469
e8760be772d5 Make easier to read console error message in case of connection problem.
Edouard Tisserant
parents: 2463
diff changeset
   119
    if connector_specific_class is None:
e8760be772d5 Make easier to read console error message in case of connection problem.
Edouard Tisserant
parents: 2463
diff changeset
   120
        return None
2007
ef2d479f564f #2476 Connectors dialog module added.
dporopat <denis.poropat@smarteh.si>
parents: 2006
diff changeset
   121
2463
8742337a9fe3 Chunk based transfer for PLC binary and extra files, and some collateral code refactoring.
Edouard Tisserant
parents: 2339
diff changeset
   122
    # new class inheriting from generic and specific connector base classes
2537
eb4a4cc41914 Fix various pylint and pep8 errors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2522
diff changeset
   123
    return type(_scheme + "_connector",
eb4a4cc41914 Fix various pylint and pep8 errors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2522
diff changeset
   124
                (ConnectorBase, connector_specific_class), {})()
2182
eeca1aff0691 Fix linter errors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2007
diff changeset
   125
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
   126
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
   127
def EditorClassFromScheme(scheme):
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
   128
    _Import_Dialogs()
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
   129
    return per_URI_connectors.get(scheme, None)
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2478
diff changeset
   130
2007
ef2d479f564f #2476 Connectors dialog module added.
dporopat <denis.poropat@smarteh.si>
parents: 2006
diff changeset
   131
2329
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
   132
def ConnectorSchemes():
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
   133
    _Import_Dialogs()
e5703dc8848e URI editor : Rewrote most of it, cleaner.
Edouard Tisserant
parents: 2312
diff changeset
   134
    return schemes