connectors/ERPC_dialog.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Tue, 03 Dec 2024 21:22:45 +0100
changeset 4057 cf42c3dbdd5c
parent 4038 4b47b4ce0f12
permissions -rw-r--r--
IDE: Fix PLCOpenEditor (wxPython4 menus) and drop broken PDF doc support.
3884
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/env python
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
# See COPYING file for copyrights details.
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
4038
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
     6
from connectors.ERPC_URI import schemes_desc, per_scheme_model
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
     7
from connectors.SchemeEditor import SchemeEditor
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
     8
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
     9
## Scheme list for the dialog's combobox
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
    10
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
    11
Schemes = list(zip(*schemes_desc))[0]
3884
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
4038
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
    14
## Specialized SchemeEditor panel for ERPC 
3884
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
class ERPC_dialog(SchemeEditor):
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
    def __init__(self, scheme, *args, **kwargs):
4038
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
    18
        self.model, self.EnableIDSelector, self.parser, self.builder = per_scheme_model[scheme]
3884
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
        SchemeEditor.__init__(self, scheme, *args, **kwargs)
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    21
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    22
    def SetLoc(self, loc):
4038
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
    23
        self.SetFields(self.parser(loc))
3884
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    24
34da877021d5 Replace PYRO with ERPC. Work In Progress.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    25
    def GetLoc(self):
4038
4b47b4ce0f12 IDE: refactor ERPC URI editor, add serial and USB URI types
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3908
diff changeset
    26
        return self.builder(self.GetFields())