bacnet/BacnetSlaveEditor.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 29 Sep 2023 13:45:50 +0200
changeset 3849 c3f4e114af38
parent 3845 d7f9b6af98ef
child 3931 1c0263e2b3b1
permissions -rw-r--r--
Fix untested code in worker.py...
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     1
#!/usr/bin/env python
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     3
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     4
# This file is part of Beremiz, a Integrated Development Environment for
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     5
# programming IEC 61131-3 automates supporting plcopen standard.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     6
# This files implements the bacnet plugin for Beremiz, adding BACnet server support.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     7
#
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     8
# Copyright (C) 2017: Mario de Sousa (msousa@fe.up.pt)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
     9
#
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    10
# See COPYING file for copyrights details.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    11
#
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    12
# This program is free software; you can redistribute it and/or
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    13
# modify it under the terms of the GNU General Public License
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    14
# as published by the Free Software Foundation; either version 2
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    15
# of the License, or (at your option) any later version.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    16
#
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    17
# This program is distributed in the hope that it will be useful,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    20
# GNU General Public License for more details.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    21
#
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    22
# You should have received a copy of the GNU General Public License
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    23
# along with this program; if not, write to the Free Software
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    24
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    25
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    26
from __future__ import absolute_import
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    27
from collections import Counter
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    28
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    29
import wx
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    30
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    31
# Import some libraries on Beremiz code
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    32
from util.BitmapLibrary import GetBitmap
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    33
from controls.CustomGrid import CustomGrid
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    34
from controls.CustomTable import CustomTable
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    35
from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    36
from graphics.GraphicCommons import ERROR_HIGHLIGHT
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    37
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    38
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
    39
# BACnet Engineering units taken from: ASHRAE 135-2016, clause/chapter 21
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    40
BACnetEngineeringUnits = [
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    41
    ('(Acceleration) meters-per-second-per-second (166)',              166),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    42
    ('(Area) square-meters (0)',                                       0),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    43
    ('(Area) square-centimeters (116)',                                116),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    44
    ('(Area) square-feet (1)',                                         1),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    45
    ('(Area) square-inches (115)',                                     115),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    46
    ('(Currency) currency1 (105)',                                     105),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    47
    ('(Currency) currency2 (106)',                                     106),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    48
    ('(Currency) currency3 (107)',                                     107),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    49
    ('(Currency) currency4 (108)',                                     108),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    50
    ('(Currency) currency5 (109)',                                     109),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    51
    ('(Currency) currency6 (110)',                                     110),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    52
    ('(Currency) currency7 (111)',                                     111),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    53
    ('(Currency) currency8 (112)',                                     112),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    54
    ('(Currency) currency9 (113)',                                     113),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    55
    ('(Currency) currency10 (114)',                                    114),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    56
    ('(Electrical) milliamperes (2)',                                  2),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    57
    ('(Electrical) amperes (3)',                                       3),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    58
    ('(Electrical) amperes-per-meter (167)',                           167),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    59
    ('(Electrical) amperes-per-square-meter (168)',                    168),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    60
    ('(Electrical) ampere-square-meters (169)',                        169),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    61
    ('(Electrical) decibels (199)',                                    199),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    62
    ('(Electrical) decibels-millivolt (200)',                          200),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    63
    ('(Electrical) decibels-volt (201)',                               201),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    64
    ('(Electrical) farads (170)',                                      170),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    65
    ('(Electrical) henrys (171)',                                      171),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    66
    ('(Electrical) ohms (4)',                                          4),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    67
    ('(Electrical) ohm-meter-squared-per-meter (237)',                 237),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    68
    ('(Electrical) ohm-meters (172)',                                  172),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    69
    ('(Electrical) milliohms (145)',                                   145),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    70
    ('(Electrical) kilohms (122)',                                     122),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    71
    ('(Electrical) megohms (123)',                                     123),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    72
    ('(Electrical) microsiemens (190)',                                190),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    73
    ('(Electrical) millisiemens (202)',                                202),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    74
    ('(Electrical) siemens (173)',                                     173),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    75
    ('(Electrical) siemens-per-meter (174)',                           174),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    76
    ('(Electrical) teslas (175)',                                      175),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    77
    ('(Electrical) volts (5)',                                         5),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    78
    ('(Electrical) millivolts (124)',                                  124),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    79
    ('(Electrical) kilovolts (6)',                                     6),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    80
    ('(Electrical) megavolts (7)',                                     7),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    81
    ('(Electrical) volt-amperes (8)',                                  8),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    82
    ('(Electrical) kilovolt-amperes (9)',                              9),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    83
    ('(Electrical) megavolt-amperes (10)',                             10),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    84
    ('(Electrical) volt-amperes-reactive (11)',                        11),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    85
    ('(Electrical) kilovolt-amperes-reactive (12)',                    12),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    86
    ('(Electrical) megavolt-amperes-reactive (13)',                    13),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    87
    ('(Electrical) volts-per-degree-kelvin (176)',                     176),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    88
    ('(Electrical) volts-per-meter (177)',                             177),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    89
    ('(Electrical) degrees-phase (14)',                                14),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    90
    ('(Electrical) power-factor (15)',                                 15),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    91
    ('(Electrical) webers (178)',                                      178),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    92
    ('(Energy) ampere-seconds (238)',                                  238),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    93
    ('(Energy) volt-ampere-hours (239)',                               239),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    94
    ('(Energy) kilovolt-ampere-hours (240)',                           240),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    95
    ('(Energy) megavolt-ampere-hours (241)',                           241),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    96
    ('(Energy) volt-ampere-hours-reactive (242)',                      242),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    97
    ('(Energy) kilovolt-ampere-hours-reactive (243)',                  243),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    98
    ('(Energy) megavolt-ampere-hours-reactive (244)',                  244),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
    99
    ('(Energy) volt-square-hours (245)',                               245),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   100
    ('(Energy) ampere-square-hours (246)',                             246),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   101
    ('(Energy) joules (16)',                                           16),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   102
    ('(Energy) kilojoules (17)',                                       17),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   103
    ('(Energy) kilojoules-per-kilogram (125)',                         125),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   104
    ('(Energy) megajoules (126)',                                      126),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   105
    ('(Energy) watt-hours (18)',                                       18),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   106
    ('(Energy) kilowatt-hours (19)',                                   19),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   107
    ('(Energy) megawatt-hours (146)',                                  146),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   108
    ('(Energy) watt-hours-reactive (203)',                             203),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   109
    ('(Energy) kilowatt-hours-reactive (204)',                         204),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   110
    ('(Energy) megawatt-hours-reactive (205)',                         205),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   111
    ('(Energy) btus (20)',                                             20),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   112
    ('(Energy) kilo-btus (147)',                                       147),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   113
    ('(Energy) mega-btus (148)',                                       148),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   114
    ('(Energy) therms (21)',                                           21),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   115
    ('(Energy) ton-hours (22)',                                        22),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   116
    ('(Enthalpy) joules-per-kilogram-dry-air (23)',                    23),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   117
    ('(Enthalpy) kilojoules-per-kilogram-dry-air (149)',               149),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   118
    ('(Enthalpy) megajoules-per-kilogram-dry-air (150)',               150),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   119
    ('(Enthalpy) btus-per-pound-dry-air (24)',                         24),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   120
    ('(Enthalpy) btus-per-pound (117)',                                117),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   121
    ('(Entropy) joules-per-degree-kelvin (127)',                       127),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   122
    ('(Entropy) kilojoules-per-degree-kelvin (151)',                   151),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   123
    ('(Entropy) megajoules-per-degree-kelvin (152)',                   152),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   124
    ('(Entropy) joules-per-kilogram-degree-kelvin (128)',              128),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   125
    ('(Force) newton (153)',                                           153),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   126
    ('(Frequency) cycles-per-hour (25)',                               25),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   127
    ('(Frequency) cycles-per-minute (26)',                             26),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   128
    ('(Frequency) hertz (27)',                                         27),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   129
    ('(Frequency) kilohertz (129)',                                    129),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   130
    ('(Frequency) megahertz (130)',                                    130),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   131
    ('(Frequency) per-hour (131)',                                     131),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   132
    ('(Humidity) grams-of-water-per-kilogram-dry-air (28)',            28),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   133
    ('(Humidity) percent-relative-humidity (29)',                      29),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   134
    ('(Length) micrometers (194)',                                     194),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   135
    ('(Length) millimeters (30)',                                      30),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   136
    ('(Length) centimeters (118)',                                     118),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   137
    ('(Length) kilometers (193)',                                      193),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   138
    ('(Length) meters (31)',                                           31),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   139
    ('(Length) inches (32)',                                           32),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   140
    ('(Length) feet (33)',                                             33),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   141
    ('(Light) candelas (179)',                                         179),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   142
    ('(Light) candelas-per-square-meter (180)',                        180),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   143
    ('(Light) watts-per-square-foot (34)',                             34),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   144
    ('(Light) watts-per-square-meter (35)',                            35),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   145
    ('(Light) lumens (36)',                                            36),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   146
    ('(Light) luxes (37)',                                             37),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   147
    ('(Light) foot-candles (38)',                                      38),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   148
    ('(Mass) milligrams (196)',                                        196),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   149
    ('(Mass) grams (195)',                                             195),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   150
    ('(Mass) kilograms (39)',                                          39),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   151
    ('(Mass) pounds-mass (40)',                                        40),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   152
    ('(Mass) tons (41)',                                               41),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   153
    ('(Mass Flow) grams-per-second (154)',                             154),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   154
    ('(Mass Flow) grams-per-minute (155)',                             155),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   155
    ('(Mass Flow) kilograms-per-second (42)',                          42),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   156
    ('(Mass Flow) kilograms-per-minute (43)',                          43),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   157
    ('(Mass Flow) kilograms-per-hour (44)',                            44),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   158
    ('(Mass Flow) pounds-mass-per-second (119)',                       119),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   159
    ('(Mass Flow) pounds-mass-per-minute (45)',                        45),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   160
    ('(Mass Flow) pounds-mass-per-hour (46)',                          46),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   161
    ('(Mass Flow) tons-per-hour (156)',                                156),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   162
    ('(Power) milliwatts (132)',                                       132),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   163
    ('(Power) watts (47)',                                             47),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   164
    ('(Power) kilowatts (48)',                                         48),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   165
    ('(Power) megawatts (49)',                                         49),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   166
    ('(Power) btus-per-hour (50)',                                     50),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   167
    ('(Power) kilo-btus-per-hour (157)',                               157),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   168
    ('(Power) joule-per-hours (247)',                                  247),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   169
    ('(Power) horsepower (51)',                                        51),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   170
    ('(Power) tons-refrigeration (52)',                                52),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   171
    ('(Pressure) pascals (53)',                                        53),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   172
    ('(Pressure) hectopascals (133)',                                  133),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   173
    ('(Pressure) kilopascals (54)',                                    54),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   174
    ('(Pressure) millibars (134)',                                     134),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   175
    ('(Pressure) bars (55)',                                           55),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   176
    ('(Pressure) pounds-force-per-square-inch (56)',                   56),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   177
    ('(Pressure) millimeters-of-water (206)',                          206),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   178
    ('(Pressure) centimeters-of-water (57)',                           57),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   179
    ('(Pressure) inches-of-water (58)',                                58),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   180
    ('(Pressure) millimeters-of-mercury (59)',                         59),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   181
    ('(Pressure) centimeters-of-mercury (60)',                         60),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   182
    ('(Pressure) inches-of-mercury (61)',                              61),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   183
    ('(Temperature) degrees-celsius (62)',                             62),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   184
    ('(Temperature) degrees-kelvin (63)',                              63),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   185
    ('(Temperature) degrees-kelvin-per-hour (181)',                    181),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   186
    ('(Temperature) degrees-kelvin-per-minute (182)',                  182),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   187
    ('(Temperature) degrees-fahrenheit (64)',                          64),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   188
    ('(Temperature) degree-days-celsius (65)',                         65),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   189
    ('(Temperature) degree-days-fahrenheit (66)',                      66),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   190
    ('(Temperature) delta-degrees-fahrenheit (120)',                   120),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   191
    ('(Temperature) delta-degrees-kelvin (121)',                       121),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   192
    ('(Time) years (67)',                                              67),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   193
    ('(Time) months (68)',                                             68),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   194
    ('(Time) weeks (69)',                                              69),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   195
    ('(Time) days (70)',                                               70),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   196
    ('(Time) hours (71)',                                              71),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   197
    ('(Time) minutes (72)',                                            72),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   198
    ('(Time) seconds (73)',                                            73),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   199
    ('(Time) hundredths-seconds (158)',                                158),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   200
    ('(Time) milliseconds (159)',                                      159),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   201
    ('(Torque) newton-meters (160)',                                   160),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   202
    ('(Velocity) millimeters-per-second (161)',                        161),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   203
    ('(Velocity) millimeters-per-minute (162)',                        162),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   204
    ('(Velocity) meters-per-second (74)',                              74),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   205
    ('(Velocity) meters-per-minute (163)',                             163),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   206
    ('(Velocity) meters-per-hour (164)',                               164),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   207
    ('(Velocity) kilometers-per-hour (75)',                            75),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   208
    ('(Velocity) feet-per-second (76)',                                76),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   209
    ('(Velocity) feet-per-minute (77)',                                77),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   210
    ('(Velocity) miles-per-hour (78)',                                 78),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   211
    ('(Volume) cubic-feet (79)',                                       79),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   212
    ('(Volume) cubic-meters (80)',                                     80),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   213
    ('(Volume) imperial-gallons (81)',                                 81),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   214
    ('(Volume) milliliters (197)',                                     197),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   215
    ('(Volume) liters (82)',                                           82),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   216
    ('(Volume) us-gallons (83)',                                       83),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   217
    ('(Volumetric Flow) cubic-feet-per-second (142)',                  142),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   218
    ('(Volumetric Flow) cubic-feet-per-minute (84)',                   84),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   219
    ('(Volumetric Flow) million-standard-cubic-feet-per-minute (254)', 254),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   220
    ('(Volumetric Flow) cubic-feet-per-hour (191)',                    191),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   221
    ('(Volumetric Flow) cubic-feet-per-day (248)',                     248),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   222
    ('(Volumetric Flow) standard-cubic-feet-per-day (47808)',          47808),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   223
    ('(Volumetric Flow) million-standard-cubic-feet-per-day (47809)',  47809),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   224
    ('(Volumetric Flow) thousand-cubic-feet-per-day (47810)',          47810),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   225
    ('(Volumetric Flow) thousand-standard-cubic-feet-per-day (47811)', 47811),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   226
    ('(Volumetric Flow) pounds-mass-per-day (47812)',                  47812),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   227
    ('(Volumetric Flow) cubic-meters-per-second (85)',                 85),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   228
    ('(Volumetric Flow) cubic-meters-per-minute (165)',                165),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   229
    ('(Volumetric Flow) cubic-meters-per-hour (135)',                  135),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   230
    ('(Volumetric Flow) cubic-meters-per-day (249)',                   249),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   231
    ('(Volumetric Flow) imperial-gallons-per-minute (86)',             86),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   232
    ('(Volumetric Flow) milliliters-per-second (198)',                 198),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   233
    ('(Volumetric Flow) liters-per-second (87)',                       87),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   234
    ('(Volumetric Flow) liters-per-minute (88)',                       88),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   235
    ('(Volumetric Flow) liters-per-hour (136)',                        136),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   236
    ('(Volumetric Flow) us-gallons-per-minute (89)',                   89),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   237
    ('(Volumetric Flow) us-gallons-per-hour (192)',                    192),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   238
    ('(Other) degrees-angular (90)',                                   90),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   239
    ('(Other) degrees-celsius-per-hour (91)',                          91),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   240
    ('(Other) degrees-celsius-per-minute (92)',                        92),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   241
    ('(Other) degrees-fahrenheit-per-hour (93)',                       93),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   242
    ('(Other) degrees-fahrenheit-per-minute (94)',                     94),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   243
    ('(Other) joule-seconds (183)',                                    183),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   244
    ('(Other) kilograms-per-cubic-meter (186)',                        186),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   245
    ('(Other) kilowatt-hours-per-square-meter (137)',                  137),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   246
    ('(Other) kilowatt-hours-per-square-foot (138)',                   138),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   247
    ('(Other) watt-hours-per-cubic-meter (250)',                       250),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   248
    ('(Other) joules-per-cubic-meter (251)',                           251),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   249
    ('(Other) megajoules-per-square-meter (139)',                      139),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   250
    ('(Other) megajoules-per-square-foot (140)',                       140),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   251
    ('(Other) mole-percent (252)',                                     252),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   252
    ('(Other) no-units (95)',                                          95),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   253
    ('(Other) newton-seconds (187)',                                   187),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   254
    ('(Other) newtons-per-meter (188)',                                188),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   255
    ('(Other) parts-per-million (96)',                                 96),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   256
    ('(Other) parts-per-billion (97)',                                 97),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   257
    ('(Other) pascal-seconds (253)',                                   253),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   258
    ('(Other) percent (98)',                                           98),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   259
    ('(Other) percent-obscuration-per-foot (143)',                     143),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   260
    ('(Other) percent-obscuration-per-meter (144)',                    144),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   261
    ('(Other) percent-per-second (99)',                                99),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   262
    ('(Other) per-minute (100)',                                       100),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   263
    ('(Other) per-second (101)',                                       101),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   264
    ('(Other) psi-per-degree-fahrenheit (102)',                        102),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   265
    ('(Other) radians (103)',                                          103),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   266
    ('(Other) radians-per-second (184)',                               184),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   267
    ('(Other) revolutions-per-minute (104)',                           104),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   268
    ('(Other) square-meters-per-newton (185)',                         185),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   269
    ('(Other) watts-per-meter-per-degree-kelvin (189)',                189),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   270
    ('(Other) watts-per-square-meter-degree-kelvin (141)',             141),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   271
    ('(Other) per-mille (207)',                                        207),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   272
    ('(Other) grams-per-gram (208)',                                   208),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   273
    ('(Other) kilograms-per-kilogram (209)',                           209),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   274
    ('(Other) grams-per-kilogram (210)',                               210),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   275
    ('(Other) milligrams-per-gram (211)',                              211),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   276
    ('(Other) milligrams-per-kilogram (212)',                          212),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   277
    ('(Other) grams-per-milliliter (213)',                             213),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   278
    ('(Other) grams-per-liter (214)',                                  214),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   279
    ('(Other) milligrams-per-liter (215)',                             215),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   280
    ('(Other) micrograms-per-liter (216)',                             216),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   281
    ('(Other) grams-per-cubic-meter (217)',                            217),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   282
    ('(Other) milligrams-per-cubic-meter (218)',                       218),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   283
    ('(Other) micrograms-per-cubic-meter (219)',                       219),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   284
    ('(Other) nanograms-per-cubic-meter (220)',                        220),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   285
    ('(Other) grams-per-cubic-centimeter (221)',                       221),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   286
    ('(Other) becquerels (222)',                                       222),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   287
    ('(Other) kilobecquerels (223)',                                   223),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   288
    ('(Other) megabecquerels (224)',                                   224),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   289
    ('(Other) gray (225)',                                             225),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   290
    ('(Other) milligray (226)',                                        226),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   291
    ('(Other) microgray (227)',                                        227),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   292
    ('(Other) sieverts (228)',                                         228),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   293
    ('(Other) millisieverts (229)',                                    229),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   294
    ('(Other) microsieverts (230)',                                    230),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   295
    ('(Other) microsieverts-per-hour (231)',                           231),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   296
    ('(Other) millirems (47814)',                                      47814),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   297
    ('(Other) millirems-per-hour (47815)',                             47815),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   298
    ('(Other) decibels-a (232)',                                       232),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   299
    ('(Other) nephelometric-turbidity-unit (233)',                     233),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   300
    ('(Other) pH (234)',                                               234),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   301
    ('(Other) grams-per-square-meter (235)',                           235),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   302
    ('(Other) minutes-per-degree-kelvin (236)',                        236)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   303
]  # BACnetEngineeringUnits
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   304
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   305
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   306
# ObjectID (22 bits ID + 10 bits type) => max = 2^22-1 = 4194303
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   307
#  However, ObjectID 4194303 is not allowed!
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   308
#  4194303 is used as a special value when object Id reference is referencing an undefined object
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   309
#  (similar to NULL in C)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   310
BACnetObjectID_MAX = 4194302
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   311
BACnetObjectID_NUL = 4194303
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   312
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   313
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   314
# A base class
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   315
# what would be a purely virtual class in C++
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   316
class ObjectProperties(object):
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   317
    # this __init_() function is currently not beeing used!
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   318
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   319
    def __init__(self):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   320
        # nothing to do
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   321
        return
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   322
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   323
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   324
class BinaryObject(ObjectProperties):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   325
    # 'PropertyNames' will be used as the header for each column of the Object Properties grid!
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   326
    # Warning: The rest of the code depends on the existance of an "Object Identifier" and "Object Name"
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   327
    # Be sure to use these exact names for these BACnet object properties!
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   328
    PropertyNames = ["Object Identifier", "Object Name", "Description"]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   329
    ColumnAlignments = [wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   330
    ColumnSizes = [40, 80, 80]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   331
    PropertyConfig = {
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   332
        "Object Identifier": {"GridCellEditor": wx.grid.GridCellNumberEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   333
                              "GridCellRenderer": wx.grid.GridCellNumberRenderer,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   334
                              # syntax for GridCellNumberEditor -> "min,max"
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   335
                              # ObjectID (22 bits ID + 10 bits type) => max = 2^22-1
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   336
                              "GridCellEditorParam": "0,4194302"},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   337
        "Object Name": {"GridCellEditor": wx.grid.GridCellTextEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   338
                        "GridCellRenderer": wx.grid.GridCellStringRenderer},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   339
        "Description": {"GridCellEditor": wx.grid.GridCellTextEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   340
                        "GridCellRenderer": wx.grid.GridCellStringRenderer}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   341
    }
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   342
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   343
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   344
class AnalogObject(ObjectProperties):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   345
    # 'PropertyNames' will be used as the header for each column of the Object Properties grid!
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   346
    # Warning: The rest of the code depends on the existance of an "Object Identifier" and "Object Name"
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   347
    #          Be sure to use these exact names for these BACnet object properties!
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   348
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   349
    # NOTE: Although it is not listed here (so it does not show up in the GUI, this object will also
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   350
    #       keep another entry for a virtual property named "Unit ID". This virtual property
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   351
    #       will store the ID corresponding to the "Engineering Units" currently chosen.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   352
    #       This virtual property is kept synchronised to the "Engineering Units" property
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   353
    #       by the function PropertyChanged() which should be called by the OnCellChange event handler.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   354
    PropertyNames = ["Object Identifier", "Object Name",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   355
                     "Description", "Engineering Units"]  # 'Unit ID'
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   356
    ColumnAlignments = [
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   357
        wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   358
    ColumnSizes = [40, 80, 80, 200]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   359
    PropertyConfig = {
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   360
        "Object Identifier": {"GridCellEditor": wx.grid.GridCellNumberEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   361
                              "GridCellRenderer": wx.grid.GridCellNumberRenderer,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   362
                              "GridCellEditorParam": "0,4194302"},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   363
        "Object Name": {"GridCellEditor": wx.grid.GridCellTextEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   364
                        "GridCellRenderer": wx.grid.GridCellStringRenderer},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   365
        "Description": {"GridCellEditor": wx.grid.GridCellTextEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   366
                        "GridCellRenderer": wx.grid.GridCellStringRenderer},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   367
        "Engineering Units": {"GridCellEditor": wx.grid.GridCellChoiceEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   368
                              # use string renderer with choice editor!
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   369
                              "GridCellRenderer": wx.grid.GridCellStringRenderer,
3303
0ffb41625592 Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2250
diff changeset
   370
                              "GridCellEditorConstructorArgs": [x[0] for x in BACnetEngineeringUnits]}
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   371
    }
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   372
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   373
    # obj_properties should be a dictionary, with keys "Object Identifier",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   374
    # "Object Name", "Description", ...
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   375
    def UpdateVirtualProperties(self, obj_properties):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   376
        obj_properties["Unit ID"] = [x[1]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   377
                                     for x in BACnetEngineeringUnits if x[0] == obj_properties["Engineering Units"]][0]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   378
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   379
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   380
class MultiSObject(ObjectProperties):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   381
    # 'PropertyNames' will be used as the header for each column of the Object Properties grid!
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   382
    # Warning: The rest of the code depends on the existance of an "Object Identifier" and "Object Name"
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   383
    # Be sure to use these exact names for these BACnet object properties!
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   384
    PropertyNames = [
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   385
        "Object Identifier", "Object Name", "Description", "Number of States"]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   386
    ColumnAlignments = [
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   387
        wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   388
    ColumnSizes = [40, 80, 80, 120]
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   389
    PropertyConfig = {
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   390
        "Object Identifier": {"GridCellEditor": wx.grid.GridCellNumberEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   391
                              "GridCellRenderer": wx.grid.GridCellNumberRenderer,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   392
                              "GridCellEditorParam": "0,4194302"},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   393
        "Object Name": {"GridCellEditor": wx.grid.GridCellTextEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   394
                        "GridCellRenderer": wx.grid.GridCellStringRenderer},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   395
        "Description": {"GridCellEditor": wx.grid.GridCellTextEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   396
                        "GridCellRenderer": wx.grid.GridCellStringRenderer},
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   397
        # MultiState Values are encoded in unsigned integer
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   398
        # (in BACnet => uint8_t), and can not be 0.
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   399
        # See ASHRAE 135-2016, section 12.20.4
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   400
        "Number of States": {"GridCellEditor": wx.grid.GridCellNumberEditor,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   401
                             "GridCellRenderer": wx.grid.GridCellNumberRenderer,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   402
                             # syntax for GridCellNumberEditor -> "min,max"
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   403
                             "GridCellEditorParam": "1,255"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   404
    }
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   405
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   406
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   407
# The default values to use for each BACnet object type
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   408
#
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   409
# Note that the 'internal plugin parameters' get stored in the data table, but
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   410
# are not visible in the GUI. They are used to generate the
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   411
# EDE files as well as the C code
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   412
class BVObject(BinaryObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   413
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   414
                     "Object Name": "Binary Value",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   415
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   416
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   417
                     "BACnetObjTypeID": 5,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   418
                     "Ctype": "uint8_t",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   419
                     "Settable": "Y"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   420
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   421
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   422
class BOObject(BinaryObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   423
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   424
                     "Object Name": "Binary Output",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   425
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   426
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   427
                     "BACnetObjTypeID": 4,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   428
                     "Ctype": "uint8_t",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   429
                     "Settable": "Y"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   430
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   431
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   432
class BIObject(BinaryObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   433
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   434
                     "Object Name": "Binary Input",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   435
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   436
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   437
                     "BACnetObjTypeID": 3,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   438
                     "Ctype": "uint8_t",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   439
                     "Settable": "N"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   440
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   441
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   442
class AVObject(AnalogObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   443
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   444
                     "Object Name": "Analog Value",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   445
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   446
                     "Engineering Units": '(Other) no-units (95)',
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   447
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   448
                     "Unit ID": 95,   # the ID of the engineering unit
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   449
                     # will get updated by
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   450
                     # UpdateVirtualProperties()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   451
                     "BACnetObjTypeID": 2,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   452
                     "Ctype": "float",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   453
                     "Settable": "Y"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   454
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   455
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   456
class AOObject(AnalogObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   457
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   458
                     "Object Name": "Analog Output",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   459
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   460
                     "Engineering Units": '(Other) no-units (95)',
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   461
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   462
                     "Unit ID": 95,   # the ID of the engineering unit
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   463
                     # will get updated by
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   464
                     # UpdateVirtualProperties()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   465
                     "BACnetObjTypeID": 1,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   466
                     "Ctype": "float",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   467
                     "Settable": "Y"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   468
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   469
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   470
class AIObject(AnalogObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   471
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   472
                     "Object Name": "Analog Input",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   473
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   474
                     "Engineering Units": '(Other) no-units (95)',
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   475
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   476
                     "Unit ID": 95,   # the ID of the engineering unit
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   477
                     # will get updated by
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   478
                     # UpdateVirtualProperties()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   479
                     "BACnetObjTypeID": 0,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   480
                     "Ctype": "float",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   481
                     "Settable": "N"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   482
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   483
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   484
class MSVObject(MultiSObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   485
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   486
                     "Object Name": "Multi-state Value",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   487
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   488
                     "Number of States": "255",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   489
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   490
                     "BACnetObjTypeID": 19,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   491
                     "Ctype": "uint8_t",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   492
                     "Settable": "Y"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   493
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   494
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   495
class MSOObject(MultiSObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   496
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   497
                     "Object Name": "Multi-state Output",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   498
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   499
                     "Number of States": "255",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   500
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   501
                     "BACnetObjTypeID": 14,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   502
                     "Ctype": "uint8_t",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   503
                     "Settable": "Y"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   504
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   505
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   506
class MSIObject(MultiSObject):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   507
    DefaultValues = {"Object Identifier": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   508
                     "Object Name": "Multi-state Input",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   509
                     "Description": "",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   510
                     "Number of States": "255",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   511
                     # internal plugin parameters...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   512
                     "BACnetObjTypeID": 13,
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   513
                     "Ctype": "uint8_t",
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   514
                     "Settable": "N"}
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   515
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   516
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   517
class ObjectTable(CustomTable):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   518
    #  A custom wx.grid.PyGridTableBase using user supplied data
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   519
    #
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   520
    #  This will basically store a list of BACnet objects that the slave will support/implement.
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   521
    #  There will be one instance of this ObjectTable class for each BACnet object type
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   522
    #  (e.g. Binary Value, Analog Input, Multi State Output, ...)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   523
    #
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   524
    #  The list of BACnet objects will actually be stored within the self.data variable
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   525
    #  (declared in CustomTable). Self.data will be a list of dictionaries (one entry per BACnet
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   526
    #  object). All of these dictionaries in the self.data list will have entries whose keys actually
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   527
    #  depend on the BACnet type object being handled. The keys in the dictionary will be
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   528
    #  the entries in the PropertyNames list of one of the following classes:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   529
    #  (BVObject, BOObject, BIObject, AVObject, AOObject, AIObject, MSVObject, MSOObject, MSIObject).
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   530
    #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   531
    #  For example, when handling Binary Value BACnet objects,
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   532
    #   self.data will be a list of dictionaries (one entry per row)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   533
    #     self.data[n] will be a dictionary, with keys "Object Identifier", "Object Name", "Description"
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   534
    #     for example: self.data[n] = {"Object Identifier":33, "Object Name":"room1", "Description":"xx"}
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   535
    #
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   536
    #  Note that this ObjectTable class merely stores the configuration data.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   537
    #  It does not control the display nor the editing of this data.
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   538
    #  This data is typically displayed within a grid, that is controlled by the ObjectGrid class.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   539
    #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   540
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   541
    def __init__(self, parent, data, BACnetObjectType):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   542
        #   parent          : the _BacnetSlavePlug object that is instantiating this ObjectTable
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   543
        #   data            : a list with the data to be shown on the grid
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   544
        #                       (i.e., a list containing the BACnet object properties)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   545
        #                       Instantiated in _BacnetSlavePlug
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   546
        #   BACnetObjectType: one of BinaryObject, AnalogObject, MultiSObject
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   547
        #                     (or a class that derives from them).
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   548
        #                     This is actually the class itself, and not a variable!!!
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   549
        #                     However, self.BACnetObjectType will be an instance
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   550
        #                     of said class as we later need to call methods from this class.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   551
        #                     (in particular, the UpdateVirtualProperties() method)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   552
        #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   553
        # The base class must be initialized *first*
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   554
        CustomTable.__init__(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   555
            self, parent, data, BACnetObjectType.PropertyNames)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   556
        self.BACnetObjectType = BACnetObjectType()
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   557
        self.ChangesToSave = False
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   558
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   559
    # def _GetRowEdit(self, row):
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   560
        # row_edit = self.GetValueByName(row, "Edit")
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   561
        # var_type = self.Parent.GetTagName()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   562
        # bodytype = self.Parent.Controler.GetEditedElementBodyType(var_type)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   563
        # if bodytype in ["ST", "IL"]:
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   564
        #     row_edit = True;
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   565
        # return row_edit
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   566
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   567
    def _updateColAttrs(self, grid):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   568
        #  wx.grid.Grid -> update the column attributes to add the
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   569
        #  appropriate renderer given the column name.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   570
        #
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   571
        #  Otherwise default to the default renderer.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   572
        # print "ObjectTable._updateColAttrs() called!!!"
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   573
        for row in range(self.GetNumberRows()):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   574
            for col in range(self.GetNumberCols()):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   575
                PropertyName = self.BACnetObjectType.PropertyNames[col]
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   576
                PropertyConfig = self.BACnetObjectType.PropertyConfig[PropertyName]
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   577
                grid.SetReadOnly(row, col, False)
3303
0ffb41625592 Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2250
diff changeset
   578
                GridCellEditorConstructorArgs = \
3845
d7f9b6af98ef syntax error
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3303
diff changeset
   579
                    PropertyConfig["GridCellEditorConstructorArgs"] \
3303
0ffb41625592 Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2250
diff changeset
   580
                    if "GridCellEditorConstructorArgs" in PropertyConfig else []
0ffb41625592 Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2250
diff changeset
   581
                grid.SetCellEditor(row, col, PropertyConfig["GridCellEditor"](*GridCellEditorConstructorArgs))
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   582
                grid.SetCellRenderer(row, col, PropertyConfig["GridCellRenderer"]())
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   583
                grid.SetCellBackgroundColour(row, col, wx.WHITE)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   584
                grid.SetCellTextColour(row, col, wx.BLACK)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   585
                if "GridCellEditorParam" in PropertyConfig:
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   586
                    grid.GetCellEditor(row, col).SetParameters(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   587
                        PropertyConfig["GridCellEditorParam"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   588
            self.ResizeRow(grid, row)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   589
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   590
    def FindValueByName(self, PropertyName, PropertyValue):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   591
        # find the row whose property named PropertyName has the value PropertyValue
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   592
        # Returns: row number
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   593
        # for example, find the row where PropertyName "Object Identifier" has value 1002
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   594
        #              FindValueByName("Object Identifier", 1002).
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   595
        for row in range(self.GetNumberRows()):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   596
            if int(self.GetValueByName(row, PropertyName)) == PropertyValue:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   597
                return row
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   598
        return None
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   599
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   600
    # Return a list containing all the values under the column named 'colname'
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   601
    def GetAllValuesByName(self, colname):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   602
        values = []
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   603
        for row in range(self.GetNumberRows()):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   604
            values.append(self.data[row].get(colname))
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   605
        return values
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   606
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   607
    # Returns a dictionary with:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   608
    #      keys: IDs    of BACnet objects
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   609
    #     value: number of BACnet objects using this same Id
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   610
    #            (values larger than 1 indicates an error as BACnet requires unique
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   611
    #             object IDs for objects of the same type)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   612
    def GetObjectIDCount(self):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   613
        # The dictionary is built by first creating a list containing the IDs
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   614
        # of all BACnet objects
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   615
        ObjectIDs = self.GetAllValuesByName("Object Identifier")
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   616
        # list of integers instead of strings...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   617
        ObjectIDs_as_int = [int(x) for x in ObjectIDs]
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   618
        # This list is then transformed into a collections.Counter class
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   619
        # Which is then transformed into a dictionary using dict()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   620
        return dict(Counter(ObjectIDs_as_int))
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   621
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   622
    # Check whether any object ID is used more than once (not valid in BACnet)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   623
    # (returns True or False)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   624
    def HasDuplicateObjectIDs(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   625
        ObjectIDsCount = self.GetObjectIDCount()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   626
        for ObjName in ObjectIDsCount:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   627
            if ObjectIDsCount[ObjName] > 1:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   628
                return True
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   629
        return False
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   630
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   631
    # Update the virtual properties of the objects of the classes derived from ObjectProperties
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   632
    #  (currently only the AnalogObject class had virtua properties, i.e. a property
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   633
    #   that is determined/calculated based on the other properties)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   634
    def UpdateAllVirtualProperties(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   635
        if hasattr(self.BACnetObjectType, 'UpdateVirtualProperties'):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   636
            for ObjProp in self.data:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   637
                self.BACnetObjectType.UpdateVirtualProperties(ObjProp)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   638
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   639
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   640
class ObjectGrid(CustomGrid):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   641
    # A custom wx.grid.Grid (CustomGrid derives from wx.grid.Grid)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   642
    #
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   643
    # Needed mostly to customise the initial values of newly added rows, and to
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   644
    # validate if the inserted data follows BACnet rules.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   645
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   646
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   647
    # This ObjectGrid class:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   648
    #   Creates and controls the GUI __grid__ for configuring all the BACnet objects of one
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   649
    #   (generic) BACnet object type (e.g. Binary Value, Analog Input, Multi State Output, ...)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   650
    #   This grid is currently displayed within one 'window' controlled by a ObjectEditor
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   651
    #   object (this organization is not likely to change in the future).
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   652
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   653
    #   The grid uses one line/row per BACnet object, and one column for each property of the BACnet
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   654
    #   object. The column titles change depending on the specific type of BACnet object being edited
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   655
    #   (BVObject, BOObject, BIObject, AVObject, AOObject, AIObject, MSVObject, MSOObject, MSIObject).
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   656
    #   The editor to use for each column is also obtained from that class (e.g. TextEditor,
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   657
    #   NumberEditor, ...)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   658
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   659
    #   This class does NOT store the data in the grid. It merely controls its display and editing.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   660
    #   The data in the grid is stored within an object of class ObjectTable
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   661
    #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   662
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   663
    def __init__(self, *args, **kwargs):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   664
        CustomGrid.__init__(self, *args, **kwargs)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   665
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   666
    # Called when a new row is added by clicking Add button
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   667
    # call graph: CustomGrid.OnAddButton() --> CustomGrid.AddRow() -->
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   668
    # ObjectGrid._AddRow()
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   669
    def _AddRow(self, new_row):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   670
        if new_row > 0:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   671
            self.Table.InsertRow(new_row, self.Table.GetRow(new_row - 1).copy())
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   672
        else:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   673
            self.Table.InsertRow(new_row, self.DefaultValue.copy())
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   674
        # start off with invalid object ID
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   675
        self.Table.SetValueByName(new_row, "Object Identifier", BACnetObjectID_NUL)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   676
        # Find an apropriate BACnet object ID for the new object.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   677
        # We choose a first attempt (based on object ID of previous line + 1)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   678
        new_object_id = 0
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   679
        if new_row > 0:
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   680
            new_object_id = int(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   681
                self.Table.GetValueByName(new_row - 1, "Object Identifier"))
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   682
            new_object_id += 1
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   683
        # Check whether the chosen object ID is not already in use.
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   684
        # If in use, add 1 to the attempted object ID and recheck...
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   685
        while self.Table.FindValueByName("Object Identifier", new_object_id) is not None:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   686
            new_object_id += 1
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   687
            # if reached end of object IDs, cycle back to 0
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   688
            # (remember, we may have started at any inital object ID > 0, so it makes sense to cyclce back to 0)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   689
            # warning: We risk entering an inifinite loop if all object IDs are already used.
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   690
            #          The likelyhood of this happening is extremely low, (we would need 2^22 elements in the table!)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   691
            #          so don't worry about it for now.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   692
            if new_object_id > BACnetObjectID_MAX:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   693
                new_object_id = 0
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   694
        # Set the object ID of the new object to the apropriate value
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   695
        # ... and append the ID to the default object name (so the name becomes unique)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   696
        new_object_name = self.DefaultValue.get(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   697
            "Object Name") + " " + str(new_object_id)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   698
        self.Table.SetValueByName(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   699
            new_row, "Object Name", new_object_name)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   700
        self.Table.SetValueByName(new_row, "Object Identifier", new_object_id)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   701
        self.Table.ResetView(self)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   702
        return new_row
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   703
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   704
    # Called when a object ID is changed
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   705
    #    call graph: ObjectEditor.OnVariablesGridCellChange() --> this method
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   706
    # Will check whether there is a duplicate object ID, and highlight it if so.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   707
    def HighlightDuplicateObjectIDs(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   708
        if self.Table.GetNumberRows() < 2:
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   709
            # Less than 2 rows. No duplicates are possible!
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   710
            return
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   711
        IDsCount = self.Table.GetObjectIDCount()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   712
        # check ALL object IDs for duplicates...
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   713
        for row in range(self.Table.GetNumberRows()):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   714
            obj_id1 = int(self.Table.GetValueByName(row, "Object Identifier"))
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   715
            if IDsCount[obj_id1] > 1:
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   716
                # More than 1 BACnet object using this ID! Let us Highlight this row with errors...
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   717
                # TODO: change the hardcoded column number '0' to a number obtained at runtime
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   718
                #       that is guaranteed to match the column titled "Object Identifier"
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   719
                self.SetCellBackgroundColour(row, 0, ERROR_HIGHLIGHT[0])
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   720
                self.SetCellTextColour(row, 0, ERROR_HIGHLIGHT[1])
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   721
            else:
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   722
                self.SetCellBackgroundColour(row, 0, wx.WHITE)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   723
                self.SetCellTextColour(row, 0, wx.BLACK)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   724
        # Refresh the graphical display to take into account any changes we may
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   725
        # have made
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   726
        self.ForceRefresh()
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   727
        return None
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   728
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   729
    # Called when the user changes the name of BACnet object (using the GUI grid)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   730
    #    call graph: ObjectEditor.OnVariablesGridCellChange() -->
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   731
    #                --> BacnetSlaveEditorPlug.HighlightAllDuplicateObjectNames() -->
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   732
    #                --> ObjectEditor.HighlightDuplicateObjectNames() -->
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   733
    #                -->   (this method)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   734
    # Will check whether there is a duplicate BACnet object name, and highlight it if so.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   735
    #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   736
    # Since the names of BACnet objects must be unique within the whole bacnet server (and
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   737
    # not just among the BACnet objects of the same class (e.g. Analog Value, Binary Input, ...)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   738
    # to work properly this method must be passed a list of the names of all BACnet objects
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   739
    # currently configured.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   740
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   741
    # AllObjectNamesFreq: a dictionary using as key the names of all currently configured BACnet
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   742
    #                     objects, and value the number of objects using this same name.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   743
    def HighlightDuplicateObjectNames(self, AllObjectNamesFreq):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   744
        for row in range(self.Table.GetNumberRows()):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   745
            # TODO: change the hardcoded column number '1' to a number obtained at runtime
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   746
            #       that is guaranteed to match the column titled "Object Name"
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   747
            if AllObjectNamesFreq[self.Table.GetValueByName(row, "Object Name")] > 1:
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   748
                # This is an error! Highlight it...
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   749
                self.SetCellBackgroundColour(row, 1, ERROR_HIGHLIGHT[0])
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   750
                self.SetCellTextColour(row, 1, ERROR_HIGHLIGHT[1])
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   751
            else:
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   752
                self.SetCellBackgroundColour(row, 1, wx.WHITE)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   753
                self.SetCellTextColour(row, 1, wx.BLACK)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   754
        # Refresh the graphical display to take into account any changes we may
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   755
        # have made
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   756
        self.ForceRefresh()
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   757
        return None
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   758
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   759
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   760
class ObjectEditor(wx.Panel):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   761
    # This ObjectEditor class:
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   762
    #   Creates and controls the GUI window for configuring all the BACnet objects of one
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   763
    #   (generic) BACnet object type (e.g. Binary Value, Analog Input, Multi State Output, ...)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   764
    #   This 'window' is currenty displayed within one tab of the bacnet plugin, but this
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   765
    #   may change in the future!
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   766
    #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   767
    #   It includes a grid to display all the BACnet objects of its type , as well as the buttons
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   768
    #   to insert, delete and move (up/down) a BACnet object in the grid.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   769
    #   It also includes the sizers and spacers required to lay out the grid and buttons
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   770
    #   in the wndow.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   771
    #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   772
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   773
    def __init__(self, parent, window, controller, ObjTable):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   774
        # window:  the window in which the editor will open.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   775
        # controller: The ConfigTreeNode object that controlls the data presented by
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   776
        #             this 'config tree node editor'
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   777
        #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   778
        # parent:  wx._controls.Notebook
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   779
        # window:  BacnetSlaveEditorPlug (i.e. beremiz.bacnet.BacnetSlaveEditor.BacnetSlaveEditorPlug)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   780
        # controller: controller will be an object of class
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   781
        #            FinalCTNClass         (i.e. beremiz.ConfigTreeNode.FinalCTNClass )
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   782
        #            (FinalCTNClass inherits from: ConfigTreeNode and _BacnetSlavePlug)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   783
        #            (For the BACnet plugin, it is easier to think of controller as a _BacnetSlavePlug,
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   784
        #             as the other classes are generic to all plugins!!)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   785
        #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   786
        # ObjTable: The object of class ObjectTable that stores the data displayed in the grid.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   787
        #           This object is instantiated and managed by the _BacnetSlavePlug class.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   788
        #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   789
        self.window = window
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   790
        self.controller = controller
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   791
        self.ObjTable = ObjTable
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   792
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   793
        wx.Panel.__init__(self, parent)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   794
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   795
        # The main sizer, 2 rows: top row for buttons, bottom row for 2D grid
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   796
        self.MainSizer = wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=0)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   797
        self.MainSizer.AddGrowableCol(0)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   798
        self.MainSizer.AddGrowableRow(1)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   799
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   800
        # sizer placed on top row of main sizer:
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   801
        #   1 row; 6 columns: 1 static text, one stretchable spacer, 4 buttons
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   802
        controls_sizer = wx.FlexGridSizer(cols=6, hgap=4, rows=1, vgap=5)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   803
        controls_sizer.AddGrowableCol(0)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   804
        controls_sizer.AddGrowableRow(0)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   805
        self.MainSizer.Add(controls_sizer, border=5, flag=wx.GROW | wx.ALL)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   806
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   807
        # the buttons that populate the controls sizer (itself in top row of the main sizer)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   808
        # NOTE: the _("string") function will translate the "string" to the local language
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   809
        controls_sizer.Add(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   810
            wx.StaticText(self, label=_('Object Properties:')), flag=wx.ALIGN_BOTTOM)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   811
        controls_sizer.AddStretchSpacer()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   812
        for name, bitmap, help in [
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   813
                ("AddButton", "add_element", _("Add variable")),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   814
                ("DeleteButton", "remove_element", _("Remove variable")),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   815
                ("UpButton", "up", _("Move variable up")),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   816
                ("DownButton", "down", _("Move variable down"))]:
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   817
            button = wx.lib.buttons.GenBitmapButton(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   818
                self, bitmap=GetBitmap(bitmap),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   819
                size=wx.Size(28, 28),
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   820
                style=wx.NO_BORDER)
3303
0ffb41625592 Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2250
diff changeset
   821
            button.SetToolTip(help)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   822
            setattr(self, name, button)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   823
            controls_sizer.Add(button)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   824
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   825
        # the variable grid that will populate the bottom row of the main sizer
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   826
        panel = self
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   827
        self.VariablesGrid = ObjectGrid(panel, style=wx.VSCROLL)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   828
        # use only to enable drag'n'drop
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   829
        # self.VariablesGrid.SetDropTarget(VariableDropTarget(self))
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   830
        self.VariablesGrid.Bind(
3303
0ffb41625592 Preliminary support for WxPython 4.1.0. Needs more testing. Grid selection/focus seems broken, and probably many other bugs hidden in dialogs and editors.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2250
diff changeset
   831
            wx.grid.EVT_GRID_CELL_CHANGING,     self.OnVariablesGridCellChange)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   832
        # self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnVariablesGridCellLeftClick)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   833
        # self.VariablesGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN,    self.OnVariablesGridEditorShown)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   834
        self.MainSizer.Add(self.VariablesGrid, flag=wx.GROW)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   835
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   836
        # Configure the Variables Grid...
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   837
        # do not include a leftmost column containing the 'row label'
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   838
        self.VariablesGrid.SetRowLabelSize(0)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   839
        self.VariablesGrid.SetButtons({"Add":    self.AddButton,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   840
                                       "Delete": self.DeleteButton,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   841
                                       "Up":     self.UpButton,
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   842
                                       "Down":   self.DownButton})
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   843
        # The custom grid needs to know the default values to use when 'AddButton' creates a new row
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   844
        # NOTE: ObjTable.BACnetObjectType will contain the class name of one of the following classes
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   845
        # (BVObject, BIObject, BOObject, AVObject, AIObject, AOObject, MSVObject, MSIObject, MSOObject)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   846
        # which inherit from one of (BinaryObject, AnalogObject, MultiSObject)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   847
        self.VariablesGrid.SetDefaultValue(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   848
            self.ObjTable.BACnetObjectType.DefaultValues)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   849
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   850
        # self.ObjTable: The table that contains the data displayed in the grid
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   851
        # This table was instantiated/created in the initializer for class _BacnetSlavePlug
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   852
        self.VariablesGrid.SetTable(self.ObjTable)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   853
        self.VariablesGrid.SetEditable(True)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   854
        # set the column attributes (width, alignment)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   855
        # NOTE: ObjTable.BACnetObjectType will contain the class name of one of the following classes
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   856
        # (BVObject, BIObject, BOObject, AVObject, AIObject, AOObject, MSVObject, MSIObject, MSOObject)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   857
        # which inherit from one of (BinaryObject, AnalogObject, MultiSObject)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   858
        ColumnAlignments = self.ObjTable.BACnetObjectType.ColumnAlignments
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   859
        ColumnSizes = self.ObjTable.BACnetObjectType.ColumnSizes
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   860
        for col in range(self.ObjTable.GetNumberCols()):
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   861
            attr = wx.grid.GridCellAttr()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   862
            attr.SetAlignment(ColumnAlignments[col], wx.ALIGN_CENTRE)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   863
            self.VariablesGrid.SetColAttr(col, attr)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   864
            self.VariablesGrid.SetColMinimalWidth(col, ColumnSizes[col])
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   865
            self.VariablesGrid.AutoSizeColumn(col, False)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   866
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   867
        # layout the items in all sizers, and show them too.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   868
        self.SetSizer(self.MainSizer)    # Have the wondow 'own' the sizer...
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   869
        # self.MainSizer.ShowItems(True)  # not needed once the window 'owns' the sizer (SetSizer())
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   870
        # self.MainSizer.Layout()         # not needed once the window 'owns' the sizer (SetSizer())
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   871
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   872
        # Refresh the view of the grid...
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   873
        #   We ask the table to do that, who in turn will configure the grid for us!!
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   874
        #   It will configure the CellRenderers and CellEditors taking into account the type of
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   875
        #   BACnet object being shown in the grid!!
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   876
        #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   877
        #   Yes, I (Mario de Sousa) know this architecture does not seem to make much sense.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   878
        #   It seems to me that the cell renderers etc. should all be configured right here.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   879
        #   Unfortunately we inherit from the customTable and customGrid classes in Beremiz
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   880
        #   (in order to maintain GUI consistency), so we have to adopt their way of doing things.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   881
        #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   882
        # NOTE: ObjectTable.ResetView() (remember, ObjTable is of class ObjectTable)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   883
        #         calls ObjectTable._updateColAttrs(), who will do the configuring.
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   884
        self.ObjTable.ResetView(self.VariablesGrid)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   885
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   886
    def RefreshView(self):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   887
        # print "ObjectEditor.RefreshView() called!!!"
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   888
        # Check for Duplicate Object IDs is only done within same BACnet object type (ID is unique by type).
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   889
        # The VariablesGrid class can handle it by itself.
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   890
        self.VariablesGrid.HighlightDuplicateObjectIDs()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   891
        # Check for Duplicate Object Names must be done globally (Object Name is unique within bacnet server)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   892
        # Only the BacnetSlaveEditorPlug can and will handle this.
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   893
        # self.window.HighlightAllDuplicateObjectNames()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   894
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   895
    #
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   896
    # Event handlers for the Variables Grid #
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   897
    #
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   898
    def OnVariablesGridCellChange(self, event):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   899
        col = event.GetCol()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   900
        # print "ObjectEditor.OnVariablesGridCellChange(row=%s, col=%s)
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   901
        # called!!!" % (row, col)
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   902
        self.ObjTable.ChangesToSave = True
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   903
        if self.ObjTable.GetColLabelValue(col) == "Object Identifier":
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   904
            # an Object ID was changed => must check duplicate object IDs.
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   905
            self.VariablesGrid.HighlightDuplicateObjectIDs()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   906
        if self.ObjTable.GetColLabelValue(col) == "Object Name":
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   907
            # an Object Name was changed => must check duplicate object names.
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   908
            # Note that this must be done to _all_ BACnet objects, and not just the objects
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   909
            # of the same BACnet class (Binary Value, Analog Input, ...)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   910
            # So we have the BacnetSlaveEditorPlug class do it...
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   911
            self.window.HighlightAllDuplicateObjectNames()
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   912
        # There are changes to save =>
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   913
        # udate the enabled/disabled state of the 'save' option in the 'file' menu
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   914
        self.window.RefreshBeremizWindow()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   915
        event.Skip()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   916
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   917
    def OnVariablesGridCellLeftClick(self, event):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   918
        pass
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   919
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   920
    def OnVariablesGridEditorShown(self, event):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   921
        pass
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   922
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   923
    def HighlightDuplicateObjectNames(self, AllObjectNamesFreq):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   924
        return self.VariablesGrid.HighlightDuplicateObjectNames(AllObjectNamesFreq)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   925
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   926
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   927
class BacnetSlaveEditorPlug(ConfTreeNodeEditor):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   928
    # inheritance tree
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   929
    #  wx.SplitterWindow-->EditorPanel-->ConfTreeNodeEditor-->BacnetSlaveEditorPlug
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   930
    #
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   931
    # self.Controller -> The object that controls the data displayed in this editor
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   932
    #                    In our case, the object of class _BacnetSlavePlug
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   933
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   934
    CONFNODEEDITOR_TABS = [
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   935
        (_("Analog Value Objects"),       "_create_AV_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   936
        (_("Analog Output Objects"),      "_create_AO_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   937
        (_("Analog Input Objects"),       "_create_AI_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   938
        (_("Binary Value Objects"),       "_create_BV_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   939
        (_("Binary Output Objects"),      "_create_BO_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   940
        (_("Binary Input Objects"),       "_create_BI_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   941
        (_("Multi-State Value Objects"),  "_create_MSV_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   942
        (_("Multi-State Output Objects"), "_create_MSO_ObjectEditor"),
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   943
        (_("Multi-State Input Objects"), "_create_MSI_ObjectEditor")]
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   944
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   945
    def _create_AV_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   946
        self.AV_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   947
            parent, self, self.Controler, self.Controler.ObjTables["AV_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   948
        return self.AV_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   949
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   950
    def _create_AO_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   951
        self.AO_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   952
            parent, self, self.Controler, self.Controler.ObjTables["AO_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   953
        return self.AO_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   954
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   955
    def _create_AI_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   956
        self.AI_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   957
            parent, self, self.Controler, self.Controler.ObjTables["AI_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   958
        return self.AI_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   959
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   960
    def _create_BV_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   961
        self.BV_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   962
            parent, self, self.Controler, self.Controler.ObjTables["BV_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   963
        return self.BV_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   964
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   965
    def _create_BO_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   966
        self.BO_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   967
            parent, self, self.Controler, self.Controler.ObjTables["BO_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   968
        return self.BO_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   969
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   970
    def _create_BI_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   971
        self.BI_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   972
            parent, self, self.Controler, self.Controler.ObjTables["BI_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   973
        return self.BI_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   974
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   975
    def _create_MSV_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   976
        self.MSV_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   977
            parent, self, self.Controler, self.Controler.ObjTables["MSV_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   978
        return self.MSV_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   979
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   980
    def _create_MSO_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   981
        self.MSO_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   982
            parent, self, self.Controler, self.Controler.ObjTables["MSO_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   983
        return self.MSO_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   984
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   985
    def _create_MSI_ObjectEditor(self, parent):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   986
        self.MSI_ObjectEditor = ObjectEditor(
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   987
            parent, self, self.Controler, self.Controler.ObjTables["MSI_Obj"])
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   988
        return self.MSI_ObjectEditor
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   989
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   990
    def __init__(self, parent, controler, window, editable=True):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   991
        self.Editable = editable
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   992
        ConfTreeNodeEditor.__init__(self, parent, controler, window)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   993
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   994
    def __del__(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   995
        self.Controler.OnCloseEditor(self)
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   996
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   997
    def GetConfNodeMenuItems(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
   998
        return []
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
   999
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1000
    def RefreshConfNodeMenu(self, confnode_menu):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1001
        return
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1002
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1003
    def RefreshView(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1004
        self.HighlightAllDuplicateObjectNames()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1005
        ConfTreeNodeEditor.RefreshView(self)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1006
        self. AV_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1007
        self. AO_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1008
        self. AI_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1009
        self. BV_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1010
        self. BO_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1011
        self. BI_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1012
        self.MSV_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1013
        self.MSO_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1014
        self.MSI_ObjectEditor.RefreshView()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1015
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1016
    def HighlightAllDuplicateObjectNames(self):
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1017
        ObjectNamesCount = self.Controler.GetObjectNamesCount()
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1018
        self. AV_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1019
        self. AO_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1020
        self. AI_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1021
        self. BV_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1022
        self. BO_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1023
        self. BI_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1024
        self.MSV_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1025
        self.MSO_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1026
        self.MSI_ObjectEditor.HighlightDuplicateObjectNames(ObjectNamesCount)
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1027
        return None
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1028
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1029
    def RefreshBeremizWindow(self):
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1030
        # self.ParentWindow is the top level Beremiz class (object) that
2020
6dddf3070806 Add BACnet extension from Mario de Sousa <msousa@fe.up.pt>
Edouard Tisserant
parents:
diff changeset
  1031
        #                   handles the beremiz window and layout
2250
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1032
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1033
        # Refresh the title of the Beremiz window
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1034
        #  (it changes depending on whether there are
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1035
        #   changes to save!! )
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1036
        self.ParentWindow.RefreshTitle()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1037
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1038
        # Refresh the enabled/disabled state of the
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1039
        #  entries in the main 'file' menu.
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1040
        #  ('Save' sub-menu should become enabled
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1041
        #   if there are changes to save! )
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1042
        self.ParentWindow.RefreshFileMenu()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1043
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1044
        # self.ParentWindow.RefreshEditMenu()
86f61c4dfe76 Passed bacnet*.py through autopep8, and attemped to fix manually what went wrong + fixed pylint complains
Edouard Tisserant
parents: 2020
diff changeset
  1045
        # self.ParentWindow.RefreshPageTitles()