connectors/ERPC_dialog.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sat, 23 Nov 2024 01:09:55 +0100
changeset 4046 808f7da43a4d
parent 4038 4b47b4ce0f12
permissions -rw-r--r--
requirements: update eRPC dependency to include subdirectory for Python
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())