From 7b877be851bb2907ec897bf37a019969b37906a3 Mon Sep 17 00:00:00 2001 From: Capocchi Date: Thu, 11 Sep 2025 22:00:43 +0200 Subject: [PATCH 1/2] bug fix --- devsimpy/Container.py | 6 +++--- devsimpy/InteractionYAML.py | 7 +++++-- devsimpy/Mixins/Savable.py | 9 +++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/devsimpy/Container.py b/devsimpy/Container.py index e959f5f5..8a330336 100644 --- a/devsimpy/Container.py +++ b/devsimpy/Container.py @@ -1347,9 +1347,9 @@ def draw(self, dc): dc.SetPen(wx.Pen(*pen_args)) if self.dashed: - self.pen[2] = wx.PENSTYLE_DOT_DASH + self.pen[2] = 104 # wx.PENSTYLE_DOT_DASH else: - self.pen[2] = wx.PENSTYLE_SOLID + self.pen[2] = 100 # wx.PENSTYLE_SOLID # Set the brush color dc.SetBrush(wx.Brush(brushclr)) @@ -2981,7 +2981,7 @@ def OnMotion(self, event): ### dot trace to prepare connection if len(s.pen)>2: - s.pen[2]= wx.PENSTYLE_DOT + s.pen[2]= 101 #wx.PENSTYLE_DOT if cursor != wx.StockCursor(wx.CURSOR_HAND): cursor = wx.StockCursor(wx.CURSOR_HAND) diff --git a/devsimpy/InteractionYAML.py b/devsimpy/InteractionYAML.py index 9f71629a..e0d8517f 100644 --- a/devsimpy/InteractionYAML.py +++ b/devsimpy/InteractionYAML.py @@ -26,8 +26,11 @@ def to_Python(val): return val elif str(val).replace('.','').replace('-','').isdigit(): return eval(str(val)) - elif isinstance(eval(val),list) or isinstance(eval(val),tuple): - return eval(val) + elif isinstance(eval(val), (list, tuple)): + return eval(val) + elif isinstance(val, (list, tuple)): + val = [to_Python(v) for v in val] + return val return val diff --git a/devsimpy/Mixins/Savable.py b/devsimpy/Mixins/Savable.py index d694c40e..4fdd2972 100644 --- a/devsimpy/Mixins/Savable.py +++ b/devsimpy/Mixins/Savable.py @@ -517,7 +517,7 @@ def Save(self, obj_dumped, fileName=None) -> bool: yaml.register_class(PickledCollection) with open(fileName, 'w') as yf: - yaml.dump(PickledCollection(obj_dumped), stream=yf, default_flow_style=False) + yaml.dump(PickledCollection(obj_dumped), stream=yf) except (AttributeError, Exception) as error: sys.stderr.write(f"Warning: First attempt to save YAML failed, retrying in 'unsafe' mode: {error}\n") @@ -548,6 +548,7 @@ def Open(fileName:str): Args: fileName (str): YAML filename """ + global _ ## try to open f with compressed mode try: @@ -595,8 +596,12 @@ def Load(self, obj_loaded, fileName=None) -> bool: sys.stderr.write(f"Problem loading file '{fileName}': {tb}\n") return False + if not dsp: + sys.stderr.write(f"Failed to load data from file '{fileName}'.\n") + return False + # Vérification de la correspondance des longueurs - if len(dsp) != len(obj_loaded.dump_attributes): + if (len(dsp) != len(obj_loaded.dump_attributes)): raise ValueError(f"Mismatch between attributes and dumped data: {len(obj_loaded.dump_attributes)} != {len(dsp)}") # Assignation des attributs en utilisant zip From 2abe22179a813638b6ac63d07d4a8234e06c6c89 Mon Sep 17 00:00:00 2001 From: Capocchi Date: Fri, 12 Sep 2025 14:20:55 +0200 Subject: [PATCH 2/2] bug fix --- devsimpy/Domain/Collector/Plotly_For_Class.py | 1 - devsimpy/Domain/Collector/To_Stdout.py | 2 -- devsimpy/Domain/Generator/Generator.py | 2 +- devsimpy/Domain/Generator/RandomGenerator.py | 3 +-- devsimpy/WizardGUI.py | 2 +- 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/devsimpy/Domain/Collector/Plotly_For_Class.py b/devsimpy/Domain/Collector/Plotly_For_Class.py index 09d3baa8..210351fb 100644 --- a/devsimpy/Domain/Collector/Plotly_For_Class.py +++ b/devsimpy/Domain/Collector/Plotly_For_Class.py @@ -13,7 +13,6 @@ ### Specific import ------------------------------------------------------------ from DomainInterface import DomainBehavior -from DomainInterface import Message import chart_studio.plotly as py import plotly.graph_objects as go diff --git a/devsimpy/Domain/Collector/To_Stdout.py b/devsimpy/Domain/Collector/To_Stdout.py index a3d37e17..6f2d5d0f 100644 --- a/devsimpy/Domain/Collector/To_Stdout.py +++ b/devsimpy/Domain/Collector/To_Stdout.py @@ -13,9 +13,7 @@ ### Specific import ------------------------------------------------------------ from DomainInterface import DomainBehavior -from DomainInterface import Message -import sys ### Model class ---------------------------------------------------------------- class To_Stdout(DomainBehavior): diff --git a/devsimpy/Domain/Generator/Generator.py b/devsimpy/Domain/Generator/Generator.py index 3c1a2a32..edff31e9 100644 --- a/devsimpy/Domain/Generator/Generator.py +++ b/devsimpy/Domain/Generator/Generator.py @@ -12,7 +12,7 @@ from DomainInterface import DomainBehavior -from DomainInterface import Message +from DomainInterface.Object import Message import os.path diff --git a/devsimpy/Domain/Generator/RandomGenerator.py b/devsimpy/Domain/Generator/RandomGenerator.py index f9bbc75a..1283ef1e 100644 --- a/devsimpy/Domain/Generator/RandomGenerator.py +++ b/devsimpy/Domain/Generator/RandomGenerator.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- from DomainInterface import DomainBehavior -from DomainInterface import Message +from DomainInterface.Object import Message -import sys import random class RandomGenerator(DomainBehavior): diff --git a/devsimpy/WizardGUI.py b/devsimpy/WizardGUI.py index 5d6b01c8..fed1da97 100644 --- a/devsimpy/WizardGUI.py +++ b/devsimpy/WizardGUI.py @@ -71,7 +71,7 @@ def atomicCode(label): ### Specific import ------------------------------------------------------------ from DomainInterface import DomainBehavior -from DomainInterface import Message +from DomainInterface.Object import Message ### Model class ---------------------------------------------------------------- class %s(DomainBehavior):