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
9 changes: 5 additions & 4 deletions Container.py
Original file line number Diff line number Diff line change
Expand Up @@ -2151,9 +2151,9 @@ def OnPaste(self, event):
### adding model
self.AddShape(newShape)

### adding connectionShape
for cs in L:
cs.input = (D[cs.input[0]],cs.input[1])
### adding connectionShape only if the connection is connected on the two side with blocks.
for cs in [ a for a in L if a.input[0] in D and a.output[0] in D]:
cs.input = (D[cs.input[0]],cs.input[1])
cs.output = (D[cs.output[0]],cs.output[1])
self.AddShape(cs)

Expand Down Expand Up @@ -3981,7 +3981,8 @@ def __getattr__(self, name):
"""

if name == 'dump_attributes':
return ['shapes', 'priority_list', 'constants_dico', 'model_path', 'python_path','args'] + self.GetAttributes()
#return ['shapes', 'priority_list', 'constants_dico', 'model_path', 'python_path','args'] + self.GetAttributes()
return ['shapes', 'priority_list', 'constants_dico','args'] + self.GetAttributes()
#=======================================================================
elif name == 'dump_abstr_attributes':
return Abstractable.DUMP_ATTR if hasattr(self, 'layers') and hasattr(self, 'current_level') else []
Expand Down
4 changes: 2 additions & 2 deletions LibraryTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,10 +1117,10 @@ def OnLibDocumentation(self, evt):
dlg.CenterOnParent(wx.BOTH)
dlg.ShowModal()
else:
wx.MessageBox(_("No documentation!\n Please define the documentation of the model %s in the header of its python file.")%name, _("%s Documentation")%name, wx.OK|wx.ICON_INFORMATION)
wx.MessageBox(_("No documentation!\nPlease define the documentation of the model %s in the header of its python file.")%name, _("%s Documentation")%name, wx.OK|wx.ICON_INFORMATION)

###
def OnInfo(self, event):
"""
"""
wx.MessageBox(_('Libraries Import Manager.\nYou can import, refresh or upgrade libraries using right options.\nDefault libraries directory is %s.')%(DOMAIN_PATH))
wx.MessageBox(_('Libraries Import Manager.\nYou can import, refresh or upgrade libraries.\nDefault libraries directory is %s.')%(DOMAIN_PATH))
10 changes: 5 additions & 5 deletions Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,16 +513,16 @@ def __init__(self, parent):

helpModel = wx.MenuItem(self, ID_HELP, _('&DEVSimPy Help\tF1'), _("Help for DEVSimPy user"))
apiModel = wx.MenuItem(self, ID_API_HELP, _('&DEVSimPy API\tF2'), _("API for DEVSimPy user"))
updatePipPackage = wx.MenuItem(self, ID_UPDATE_PIP_PACKAGE, _('Dependencies (PIP Packages)\tF3'), _("Update of dependant pip packages"))
updateFromGitArchive = wx.MenuItem(self, ID_UPDATE_FROM_GIT_ARCHIVE, _('From Git Archive (zip)'), _("Update of DEVSimPy from Git archive"))
updateFromGitRepo = wx.MenuItem(self, ID_UPDATE_FROM_GIT_REPO, _('From Git Repository (Pull)'), _("Update of DEVSimPy from its Git repo"))
updatePipPackage = wx.MenuItem(self, ID_UPDATE_PIP_PACKAGE, _('All Dependencies (PIP Packages)\tF3'), _("Update of dependant pip packages"))
updateFromGitArchive = wx.MenuItem(self, ID_UPDATE_FROM_GIT_ARCHIVE, _('DEVSimPy From Git Archive (zip)'), _("Update of DEVSimPy from Git archive"))
updateFromGitRepo = wx.MenuItem(self, ID_UPDATE_FROM_GIT_REPO, _('DEVSimPy From Git Repository (Pull)'), _("Update of DEVSimPy from its Git repo"))
contactModel = wx.MenuItem(self, ID_CONTACT, _('Contact the Author...'), _("Send mail to the author"))
aboutModel = wx.MenuItem(self, ID_ABOUT, _('About DEVSimPy...'), _("About DEVSimPy"))

helpModel.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'search.png')))
updatePipPackage.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'update.png')))
updateFromGitArchive.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'update.png')))
updateFromGitRepo.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'update.png')))
updateFromGitArchive.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'zip.png')))
updateFromGitRepo.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'git.png')))
apiModel.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'api.png')))
contactModel.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'mail.png')))
aboutModel.SetBitmap(wx.Bitmap(os.path.join(ICON_PATH,'info.png')))
Expand Down
35 changes: 17 additions & 18 deletions Mixins/Abstractable.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#---------------------------------------------------------
class Abstractable:
""" Mixin class for the abstraction hierarchy
Adds dynamically the 'layers' attribute. This one contains the list of diagrams associated with one level
""" Mixin class for the abstraction hierarchy.
Adds dynamically the 'layers' attribute. This one contains the list of diagrams associated with one level.
"""

DUMP_ATTR = ['layers', 'current_level', 'DAM', 'UAM']
Expand Down Expand Up @@ -59,7 +59,7 @@ def __init__(self, dia):
#===============================================================================
###
def SetDiagram(self, diagram):
""" Set the diagram
""" Set the diagram.
"""

### if diagram has layers attribute and layer exist, then load it
Expand All @@ -75,7 +75,7 @@ def SetDiagram(self, diagram):

###
def GetDiagram(self):
""" Return Diagram instance
""" Return Diagram instance.
"""
return self.diagram
#===============================================================================
Expand All @@ -84,36 +84,36 @@ def GetDiagram(self):

###
def GetDiagramByLevel(self, l):
""" Return layer form level l
if layer dosen't exist, None is returned
""" Return layer form level l.
if layer dosen't exist, None is returned.
"""
return self.layers.get(l, None)

###
def SetDiagramByLevel(self, d, l):
""" Update the layers form diagram d at level l
""" Update the layers form diagram d at level l.
"""
self.layers.update({l:d})

###
def GetLayers(self):
""" Get layers dico
""" Get layers dico.
"""
return self.layers

###
def GetCurrentLevel(self):
""" Return the current layer viewed in the canvas
""" Return the current layer viewed in the canvas.
"""
return self.current_level

def GetUAM(self):
""" Return the dictionary of the code of Upward Atomic Model
""" Return the dictionary of the code of Upward Atomic Model.
"""
return self.UAM

def GetDAM(self):
""" Return the dictionary of the code of Downward Atomic Model
""" Return the dictionary of the code of Downward Atomic Model.
"""
return self.DAM

Expand All @@ -128,25 +128,25 @@ def SetUAM(self, cl, val):
self.UAM[cl] = val

def SetCurrentLevel(self, l):
""" Set the current level viewed in the canvas
""" Set the current level viewed in the canvas.
"""
self.current_level = l

###
def NextLevel(self):
""" return the last depth abstract level
""" return the last depth abstract level.
"""
return self.GetLevelLenght()

###
def GetLevelLenght(self):
""" Get the number of layers defined in the canvas
""" Get the number of layers defined in the canvas.
"""
return len(self.GetLayers())

###
def AddLayer(self, d, l):
""" Add the diagram d at level l
""" Add the diagram d at level l/
"""
if l in self.layers:
self.SetDiagramByLevel(d, l)
Expand All @@ -162,9 +162,8 @@ def AddLayer(self, d, l):

###
def LoadDiagram(self, l):
""" Load diagram at the level l in the current canvas
""" Load diagram at the level l in the current canvas.
"""

layers = self.GetLayers()
canvas = self

Expand All @@ -186,7 +185,7 @@ def LoadDiagram(self, l):
canvas.SetCurrentLevel(l)
#canvas.SetDiagram(dia)

print("New diagram at level %s"%l, self.layers)
sys.stdout.write("New diagram at level %s"%l, self.layers)

### add new or update new attributes layers and current_layer to diagram
setattr(dia, 'layers', canvas.GetLayers())
Expand Down
4 changes: 2 additions & 2 deletions Mixins/Achievable.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

#-------------------------------------------------------------------------------
class Achievable(Components.DEVSComponent):
""" Achievable mixin to create corresponding behavioral model (DEVS) of block
""" Achievable mixin to create corresponding behavioral model (DEVS) of block.
"""

###
def __init__(self):
""" Constructor
""" Constructor.
"""

Components.DEVSComponent.__init__(self)
Expand Down
22 changes: 8 additions & 14 deletions Mixins/Attributable.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#---------------------------------------------------------
class Attributable:
""" AttributeEditor mixin class to edit shape properties
""" AttributeEditor mixin class to edit shape properties.
"""

### Static variable for default graphical properties display
Expand All @@ -44,7 +44,7 @@ def __init__(self):

###
def AddAttribute(self, name, typ=""):
""" Add attribute if not exist
""" Add attribute if not exist.
"""

if not hasattr(self, name):
Expand All @@ -54,34 +54,28 @@ def AddAttribute(self, name, typ=""):

###
def GetAttributes(self):
""" Return attributes attribute
""" Return attributes attribute.
"""
return self.attributes

###
def SetAttributes(self, L):
""" Set attributes list
""" Set attributes list.
"""
assert(isinstance(L,list))

### set attribute
for name in L:
if not hasattr(self, name):
setattr(self, name, '')

### set attributes list
self.attributes = L
self.attributes = [setattr(self, name, '') for name in L if not hasattr(self, name)]

###
def AddAttributes(self, attrs):
""" Extend attributes list
""" Extend attributes list.
"""
for attr in [a for a in attrs if a not in self.attributes]:
self.attributes.append(attr)
self.attributes.extend([a for a in attrs if a not in self.attributes])

###
def RemoveAttribute(self, name):
""" Remove attribute name
""" Remove attribute name.
"""
### delete the attribute
if hasattr(self,name):
Expand Down
4 changes: 1 addition & 3 deletions Mixins/Connectable.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
#
## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##

#---------------------------------------------------------
class Connectable:
""" Mixin to create connectable nodes or ports
""" Mixin to create connectable nodes or ports.
"""

###
def __init__(self, nb_in = 1, nb_out = 3):
""" Constructor.
"""

self.input = nb_in
self.output = nb_out

Expand Down
17 changes: 8 additions & 9 deletions Mixins/Plugable.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@

import Decorators

#---------------------------------------------------------
class Plugable:
""" Plugable Mixin
""" Plugable Mixin.
"""

@staticmethod
def Load_Module(fileName):
""" Load module without load_module from importer. \
In this way, we can change the name of module in the built-in.
def Load_Module(fileName:str):
""" Load module without load_module from importer.
In this way, we can change the name of module in the built-in.
"""

### import zipfile model
Expand Down Expand Up @@ -66,10 +65,10 @@ def Load_Module(fileName):
return None

@Decorators.BuzyCursorNotification
def LoadPlugins(self, fileName):
""" Method which load plug-ins from zip
Used for define or redefine method of amd. and .cmd model
The name of plug-in file must be "plugins.py"
def LoadPlugins(self, fileName:str):
""" Method which load plug-ins from zip.
Used for define or redefine method of amd. and .cmd model.
The name of plug-in file must be "plugins.py".
"""

### if list of activated plug-ins is not empty
Expand Down
6 changes: 4 additions & 2 deletions Mixins/Resizeable.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@

#---------------------------------------------------------
class Resizeable:
""" Mixin that creates resizable nodes that can be drug around the canvas\
to alter the shape or size of the Shape.
""" Mixin that creates resizable nodes that can be drug around the canvas
to alter the shape or size of the Shape.
"""
def __init__(self):
""" Constructor.
"""
pass

def main():
Expand Down
Loading