From 92b52ec0fd319311d5f91c7e67701a4b513b068e Mon Sep 17 00:00:00 2001
From: Capocchi L
Date: Sat, 31 Oct 2020 21:12:55 +0100
Subject: [PATCH 1/2] Add code coverage badge
---
.coveralls.yml | 2 ++
README.md | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 .coveralls.yml
diff --git a/.coveralls.yml b/.coveralls.yml
new file mode 100644
index 00000000..dae9ac17
--- /dev/null
+++ b/.coveralls.yml
@@ -0,0 +1,2 @@
+service_name: travis-pro
+repo_token: 0lYPQVdrYdZNaCbvjgXY6FqdZNaCXzdwx
\ No newline at end of file
diff --git a/README.md b/README.md
index 2b85c217..71747777 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[](https://travis-ci.org/capocchi/DEVSimPy)
-
+[](http://makeapullrequest.com)
# What is DEVSimPy
DEVSimPy is an open Source project (under GPL V.3 license) supported by the [SPE](http://http://spe.univ-corse.fr/) (Sciences pour l'Environnement) team of the UMR CNRS 6134 Lab. of the [University of Corsica "Pasquale Paoli"](http://univ-corse.fr). This aim is to provide a GUI for the Modeling & Simulation of PyDEVS and [PyPDEVS](http://msdl.cs.mcgill.ca/projects/DEVS/PythonPDEVS) models. PyDEVS is an API allowing the implementation of the DEVS formalism in Python language. PyPDEVS is the parallel version of PyDEVS based on Parallel DEVS formalism which is an extension of the DEVS formalism.
From 4fbed69e6264a216e7142283bc61b4bee93dcc51 Mon Sep 17 00:00:00 2001
From: Capocchi L
Date: Sat, 31 Oct 2020 21:37:46 +0100
Subject: [PATCH 2/2] update badges
---
Mixins/Savable.py | 114 +++++++++++++++++++++++-----------------------
README.md | 2 +
2 files changed, 60 insertions(+), 56 deletions(-)
diff --git a/Mixins/Savable.py b/Mixins/Savable.py
index 417dc872..75ab4da0 100644
--- a/Mixins/Savable.py
+++ b/Mixins/Savable.py
@@ -148,81 +148,83 @@ class DumpZipFile(DumpBase):
ext = [".amd", ".cmd"]
def Save(self, obj_dumped, fileName = None):
- """ Function that save the codeblock on the disk.
+ """ Function that save the codeblock on the disk.
"""
- assert(fileName.endswith(tuple(DumpZipFile.ext)))
+ assert(fileName.endswith(tuple(DumpZipFile.ext)))
- ### local copy of paths
- python_path = obj_dumped.python_path
- image_path = obj_dumped.image_path
+ ### local copy of paths
+ python_path = obj_dumped.python_path
+ image_path = obj_dumped.image_path
- ### Now, file paths are in the compressed file
- if os.path.isabs(python_path):
- path = os.path.join(fileName, os.path.basename(obj_dumped.python_path))
- if os.path.exists(path):
- obj_dumped.python_path = path
+ ### Now, file paths are in the compressed file
+ if os.path.isabs(python_path):
+ path = os.path.join(fileName, os.path.basename(obj_dumped.python_path))
+ if os.path.exists(path):
+ obj_dumped.python_path = path
- if os.path.isabs(image_path):
- obj_dumped.image_path = os.path.join(fileName, os.path.basename(obj_dumped.image_path))
+ if os.path.isabs(image_path):
+ obj_dumped.image_path = os.path.join(fileName, os.path.basename(obj_dumped.image_path))
- obj_dumped.model_path = fileName
+ obj_dumped.model_path = fileName
- ### args is constructor args and we save these and not the current value
- if hasattr(obj_dumped, 'args'):
- obj_dumped.args = Components.GetArgs(Components.GetClass(obj_dumped.python_path))
- try:
+ ### args is constructor args and we save these and not the current value
+ if hasattr(obj_dumped, 'args'):
+ obj_dumped.args = Components.GetArgs(Components.GetClass(obj_dumped.python_path))
+ try:
- fn = 'DEVSimPyModel.dat'
+ fn = 'DEVSimPyModel.dat'
- ### dump attributes in fn file
- pickle.dump( obj = PickledCollection(obj_dumped),
- file = open(fn, "wb"),
- protocol = 0)
+ ### dump attributes in fn file
+ pickle.dump( obj = PickledCollection(obj_dumped),
+ file = open(fn, "wb"),
+ protocol = 0)
- except Exception as info:
- tb = traceback.format_exc()
- sys.stderr.write(_("Problem saving (during the dump): %s -- %s\n")%(str(fileName),str(tb)))
- return False
- else:
+ except Exception as info:
+ tb = traceback.format_exc()
+ sys.stderr.write(_("Problem saving (during the dump): %s -- %s\n")%(str(fileName),str(tb)))
+ return False
+ else:
- try:
+ try:
- zf = ZipManager.Zip(fileName)
+ zf = ZipManager.Zip(fileName)
- ### create or update fileName
- if os.path.exists(fileName):
- zf.Update(replace_files = [fn, python_path, image_path])
- else:
- zf.Create(add_files = [fn, python_path, image_path])
+ ### create or update fileName
+ if os.path.exists(fileName):
+ zf.Update(replace_files = [fn, python_path, image_path])
+ else:
+ zf.Create(add_files = [fn, python_path, image_path])
- os.remove(fn)
+ os.remove(fn)
- ## abs path of the directory that contains the file to export (str() to avoid unicode)
- newExportPath = str(os.path.dirname(fileName))
+ ## abs path of the directory that contains the file to export (str() to avoid unicode)
+ newExportPath = str(os.path.dirname(fileName))
- mainW = getTopLevelWindow()
- ### if export on local directory, we insert the path in the config file
- if not os.path.basename(DOMAIN_PATH) in newExportPath.split(os.sep):
- ### update of .devsimpy config file
- mainW.exportPathsList = eval(mainW.cfg.Read("exportPathsList"))
- if newExportPath not in mainW.exportPathsList:
- mainW.exportPathsList.append(str(newExportPath))
- mainW.cfg.Write("exportPathsList", str(eval("mainW.exportPathsList")))
+ mainW = getTopLevelWindow()
+ ### if export on local directory, we insert the path in the config file
+ if os.path.basename(DOMAIN_PATH) not in newExportPath.split(
+ os.sep
+ ):
+ ### update of .devsimpy config file
+ mainW.exportPathsList = eval(mainW.cfg.Read("exportPathsList"))
+ if newExportPath not in mainW.exportPathsList:
+ mainW.exportPathsList.append(str(newExportPath))
+ mainW.cfg.Write("exportPathsList", str(eval("mainW.exportPathsList")))
- ### if lib is already in the lib tree, we update the tree
- mainW.tree.UpdateDomain(newExportPath)
- ### to sort lib tree
- mainW.tree.SortChildren(mainW.tree.root)
+ ### if lib is already in the lib tree, we update the tree
+ mainW.tree.UpdateDomain(newExportPath)
+ ### to sort lib tree
+ mainW.tree.SortChildren(mainW.tree.root)
- except Exception as info:
- tb = traceback.format_exc()
- NotificationMessage(_('Error'), _("Problem saving (during the zip handling): %s -- %s\n")%(str(fileName),info), parent=getTopLevelWindow(), timeout=5)
- sys.stderr.write(_("Problem saving (during the zip handling): %s -- %s\n")%(str(fileName),str(tb)))
+ except Exception as info:
+ tb = traceback.format_exc()
+ NotificationMessage(_('Error'), _("Problem saving (during the zip handling): %s -- %s\n")%(str(fileName),info), parent=getTopLevelWindow(), timeout=5)
+ sys.stderr.write(_("Problem saving (during the zip handling): %s -- %s\n")%(str(fileName),str(tb)))
- return False
- else:
+ return False
+ else:
- return True
+ return True
def Load(self, obj_loaded, fileName = None):
""" Load codeblock (obj_loaded) from fileName
diff --git a/README.md b/README.md
index 71747777..a2b3384a 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@
[](https://travis-ci.org/capocchi/DEVSimPy)
[](http://makeapullrequest.com)
+
+
# What is DEVSimPy
DEVSimPy is an open Source project (under GPL V.3 license) supported by the [SPE](http://http://spe.univ-corse.fr/) (Sciences pour l'Environnement) team of the UMR CNRS 6134 Lab. of the [University of Corsica "Pasquale Paoli"](http://univ-corse.fr). This aim is to provide a GUI for the Modeling & Simulation of PyDEVS and [PyPDEVS](http://msdl.cs.mcgill.ca/projects/DEVS/PythonPDEVS) models. PyDEVS is an API allowing the implementation of the DEVS formalism in Python language. PyPDEVS is the parallel version of PyDEVS based on Parallel DEVS formalism which is an extension of the DEVS formalism.