Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions InteractionYAML.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
def to_Python(val):
if val in ('true', 'True'):
return True
if val in ('false', 'False'):
elif val in ('false', 'False'):
return False
if str(val).replace('.','').replace('-','').isdigit():
elif str(val).replace('.','').replace('-','').isdigit():
return eval(str(val))
return val

class YAMLHandler:
""" class providing methods for YAML file handling
""" class providing methods for YAML file handling.
"""
def __init__ (self, filename):
"""
""" Constructor.
"""
from Container import Diagram

self.filename = filename
self.modelname = os.path.basename(self.filename)

self.report = {'model_name' : self.modelname}
self.report = {'model_name' : self.modelname}

self.json_obj = None

Expand Down Expand Up @@ -57,7 +57,7 @@ def getYAMLBlockModelsList(self):

def getYAMLBlockModelArgs(self, label):
""" Returns the parameters (name and value) of the block identified by the label
composing the model described in the file
composing the model described in the file.
"""

if self.filename_is_valid != True: return False
Expand All @@ -68,8 +68,8 @@ def getYAMLBlockModelArgs(self, label):

def setYAMLBlockModelArgs(self, label, new_args):
""" Saves in YAML file the new values of the parameters
of the block identified by the label
Returns the updated block parameters
of the block identified by the label.
Returns the updated block parameters.
"""

if self.filename_is_valid != True: return False
Expand All @@ -85,7 +85,7 @@ def setYAMLBlockModelArgs(self, label, new_args):
return {'success' : success, 'args' : self.getYAMLBlockModelArgs(label)}

def getJSON(self, diagram=None):
""" Make JSON representation of the model from YAML file
""" Make JSON representation of the model from YAML file.
"""
from Container import ConnectionShape, CodeBlock, ContainerBlock

Expand Down Expand Up @@ -170,9 +170,8 @@ def getJSON(self, diagram=None):

return self.json_obj


def getDevsInstance(self):
""" Returns the DEVS instance built from YAML file
""" Returns the DEVS instance built from YAML file.
"""
from Container import Diagram

Expand All @@ -188,7 +187,7 @@ def getDevsInstance(self):
return False

def getJS(self):
"""
"""
"""

from Join import makeDEVSConf, makeJoin
Expand Down
12 changes: 3 additions & 9 deletions devsimpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,12 @@ def Seti18n(self):
self.locale.AddCatalog(domain)

# language config from .devsimpy file
if self.language == 'en':
if self.language in ('en','fr'):
try:
locale.setlocale(locale.LC_ALL, 'en')
locale.setlocale(locale.LC_ALL, self.language)
except:
sys.stdout.write(_('new local (since wx 4.1.0) setting not applied'))
translation = gettext.translation(domain, localedir, languages=['en']) # English
elif self.language =='fr':
try:
locale.setlocale(locale.LC_ALL, 'fr')
except:
sys.stdout.write(_('new local (since wx 4.1.0) setting not applied'))
translation = gettext.translation(domain, localedir, languages=['fr']) # French
translation = gettext.translation(domain, localedir, languages=[self.language])
else:
try:
locale.setlocale(locale.LC_ALL, '')
Expand Down
3 changes: 0 additions & 3 deletions plugins/state_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ def PlotStateTrajectory(m):
for func_name,st in m.state_trajectory.items():
#states = list(set(st.values()))

x = []
y = []

### adapted to PyPDEVS
times_lst = list(map(lambda a: a[0] if isinstance(a, tuple) else a, st.keys()))

Expand Down