connectors/ERPC_dialog.py
author Dino Kosic <44305363+kraskrom@users.noreply.github.com>
Mon, 02 Dec 2024 11:33:19 +0100
changeset 4056 4b2de1a0fbf9
parent 4038 4b47b4ce0f12
permissions -rw-r--r--
Extend HMI:JsonTable, create Edit CSV POU, create example, add some doc (#41)

* Extend Jsontable widget, create Edit CSV POU, create example for both

* Add doc for HMI:Image and HMI:JsonTable

* Expand example to include HMI:Image
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())