Py3 usual encoding, ints and exceptions fixes.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 31 May 2023 10:38:03 +0200
changeset 3816 032bf4f225d0
parent 3815 56f08ab3a491
child 3817 3deeda82636a
Py3 usual encoding, ints and exceptions fixes.
ProjectController.py
controls/LogViewer.py
util/ProcessLogger.py
--- a/ProjectController.py	Tue May 30 13:00:50 2023 +0200
+++ b/ProjectController.py	Wed May 31 10:38:03 2023 +0200
@@ -1202,7 +1202,7 @@
             LibCFilesAndCFLAGS, LibLDFLAGS, LibExtraFiles = self.GetLibrariesCCode(
                 buildpath)
         except UserAddressedException as e:
-            self.logger.write_error(e.message)
+            self.logger.write_error(str(e))
             return False
         except Exception as e:
             self.logger.write_error(
@@ -1216,7 +1216,7 @@
                 buildpath,
                 self.PLCGeneratedLocatedVars)
         except UserAddressedException as e:
-            self.logger.write_error(e.message)
+            self.logger.write_error(str(e))
             return False
         except Exception:
             self.logger.write_error(
--- a/controls/LogViewer.py	Tue May 30 13:00:50 2023 +0200
+++ b/controls/LogViewer.py	Wed May 31 10:38:03 2023 +0200
@@ -39,7 +39,8 @@
 THUMB_SIZE_RATIO = 1. / 8.
 
 
-def ArrowPoints(direction, width, height, xoffset, yoffset):
+def ArrowPoints(*args):
+    direction, width, height, xoffset, yoffset = map(lambda x:x if type(x)==int else int(x), args)
     if direction == wx.TOP:
         return [wx.Point(xoffset + 1, yoffset + height - 2),
                 wx.Point(xoffset + width // 2, yoffset + 1),
--- a/util/ProcessLogger.py	Tue May 30 13:00:50 2023 +0200
+++ b/util/ProcessLogger.py	Wed May 31 10:38:03 2023 +0200
@@ -91,7 +91,7 @@
                 else:
                     self.Command.append(word)
         else:
-            self.Command = Command
+            self.Command = [x if type(x)==str else x.decode() for x in Command]
             self.Command_str = subprocess.list2cmdline(self.Command)
 
         fsencoding = sys.getfilesystemencoding()