Skip to content

Commit dee2860

Browse files
authored
Port to wx python 4.2.1 and Python3 (#2)
* Bump version to 3.4 * Refactor majority of UI to use wxPython 4.2.1 * Update workflow yml to include required build dependancies * Add wxPython to setup dependancies
1 parent f5772e0 commit dee2860

File tree

12 files changed

+288
-284
lines changed

12 files changed

+288
-284
lines changed

.github/workflows/python-package.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
python-version: ${{ matrix.python-version }}
2323
cache: 'pip'
2424
cache-dependency-path: '**/setup.py'
25+
- name: Install gtk3
26+
run: |
27+
sudo apt install libgtk-3-dev
2528
- name: Install dependencies
2629
run: |
2730
python -m pip install --upgrade pip setuptools wheel

.github/workflows/python-publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
uses: actions/setup-python@v4
3131
with:
3232
python-version: ${{ matrix.python-version }}
33+
- name: Install gtk3
34+
run: |
35+
sudo apt install libgtk-3-dev
3336
- name: Install dependencies
3437
run: |
3538
python -m pip install --upgrade pip setuptools wheel

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# For a discussion on single-sourcing the version across setup.py and the
3131
# project code, see
3232
# https://packaging.python.org/en/latest/single_source_version.html
33-
version='3.3.post1', # Required
33+
version='3.4.post1', # Required
3434

3535
# This is a one-line description or tagline of what your project does. This
3636
# corresponds to the "Summary" metadata field:
@@ -148,6 +148,7 @@
148148
'jsonschema',
149149
'colorama',
150150
'deepdiff',
151+
'wxPython',
151152
],
152153

153154
# List additional groups of dependencies here (e.g. development

src/objdictgen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
LoadJson = Node.LoadJson
2828

2929
ODG_PROGRAM = "odg"
30-
ODG_VERSION = "3.3"
30+
ODG_VERSION = "3.4"
3131

3232
SCRIPT_DIRECTORY = os.path.split(__file__)[0]
3333

src/objdictgen/node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ def GetTypeList(self):
984984
list_ = Find.TypeList(MAPPING_DICTIONARY)
985985
for mapping in self.GetMappings():
986986
list_.extend(Find.TypeList(mapping))
987-
return ",".join(sorted(list_))
987+
return list_
988988

989989
def GenerateMapName(self, name, index, subindex): # pylint: disable=unused-argument
990990
return "%s (0x%4.4X)" % (name, index)
@@ -1036,7 +1036,7 @@ def GetMapList(self):
10361036
Return the list of variables that can be mapped for the current node
10371037
"""
10381038
list_ = ["None"] + [self.GenerateMapName(name, index, subindex) for index, subindex, size, name in self.GetMapVariableList()]
1039-
return ",".join(list_)
1039+
return list_
10401040

10411041
def GetAllParameters(self, sort=False):
10421042
""" Get a list of all the parameters """

src/objdictgen/nodemanager.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,14 @@ def AddSubentriesToCurrent(self, index, number, node=None):
335335
default = subentry_infos["default"]
336336
else:
337337
default = self.GetTypeDefaultValue(subentry_infos["type"])
338-
# First case entry is record
338+
# First case entry is array
339339
if infos["struct"] & OD.IdenticalSubindexes:
340340
for i in range(1, min(number, subentry_infos["nbmax"] - length) + 1):
341341
node.AddEntry(index, length + i, default)
342342
if not disable_buffer:
343343
self.BufferCurrentNode()
344344
return
345-
# Second case entry is array, only possible for manufacturer specific
345+
# Second case entry is record (and array), only possible for manufacturer specific
346346
if infos["struct"] & OD.MultipleSubindexes and 0x2000 <= index <= 0x5FFF:
347347
values = {"name": "Undefined", "type": 5, "access": "rw", "pdo": True}
348348
for i in range(1, min(number, 0xFE - length) + 1):
@@ -363,8 +363,8 @@ def RemoveSubentriesFromCurrent(self, index, number):
363363
nbmin = infos["nbmin"]
364364
else:
365365
nbmin = 1
366-
# Entry is a record, or is an array of manufacturer specific
367-
if infos["struct"] & OD.IdenticalSubindexes or 0x2000 <= index <= 0x5FFF and infos["struct"] & OD.IdenticalSubindexes:
366+
# Entry is an array, or is an array/record of manufacturer specific
367+
if infos["struct"] & OD.IdenticalSubindexes or 0x2000 <= index <= 0x5FFF and infos["struct"] & OD.MultipleSubindexes:
368368
for i in range(min(number, length - nbmin)):
369369
self.RemoveCurrentVariable(index, length - i)
370370
self.BufferCurrentNode()
@@ -1043,10 +1043,14 @@ def GetNodeEntryValues(self, node, index):
10431043
dic["buffer_size"] = ""
10441044
try:
10451045
fmt = "0x%0" + str(int(values[1]) // 4) + "X"
1046-
dic["value"] = fmt % dic["value"]
10471046
except ValueError as exc:
10481047
log.debug("ValueError: '%s': %s" % (values[1], exc))
10491048
raise # FIXME: Originial code swallows exception
1049+
try:
1050+
dic["value"] = fmt % dic["value"]
1051+
except TypeError as exc:
1052+
log.debug("ValueError: '%s': %s" % (dic["value"], exc))
1053+
pass # FIXME: dict["value"] can contain $NODEID for PDOs which is not an int i.e. $NODEID+0x200
10501054
editor["value"] = "string"
10511055
if values[0] == "INTEGER":
10521056
editor["value"] = "number"

0 commit comments

Comments
 (0)