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
3 changes: 1 addition & 2 deletions Menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,6 @@ def __init__(self, shape, event):
self.__canvas.Bind(wx.EVT_MENU, self.__canvas.OnLock, id=ID_LOCK_SHAPE)
self.__canvas.Bind(wx.EVT_MENU, self.__canvas.OnUnLock, id=ID_UNLOCK_SHAPE)


elif isinstance(shape, Container.ResizeableNode):
Delete_menu = AppendItem(delete)

Expand All @@ -1013,7 +1012,7 @@ def __init__(self, shape, event):
else:
Edit_menu = AppendItem(edit)

if shape.isPYC():
if isinstance(shape, Container.CodeBlock) and shape.isPYC():
Edit_menu.Enable(False)

Log_menu = AppendItem(log)
Expand Down
22 changes: 14 additions & 8 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,28 +54,34 @@ 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 = [setattr(self, name, '') for name in L if not hasattr(self, name)]
self.attributes = L

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

###
def RemoveAttribute(self, name):
""" Remove attribute name.
""" Remove attribute name
"""
### delete the attribute
if hasattr(self,name):
Expand Down
18 changes: 9 additions & 9 deletions Mixins/Savable.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ def Load(self, obj_loaded, fileName = None):
### Check comparison between serialized attribut (L) and normal attribut (dump_attributes)
### for model build with a version of devsimpy <= 2.5
### font checking
# if len(obj_loaded.dump_attributes) != len(L):
# if fileName.endswith(DumpZipFile.ext[-1]):
# if not isinstance(L[9], list):
# import wx
# L.insert(9, [FONT_SIZE, 74, 93, 700, 'Arial'])
# else:
# if not isinstance(L[6], list):
# import wx
# L.insert(6, [FONT_SIZE, 74, 93, 700, 'Arial'])
if len(obj_loaded.dump_attributes) != len(L):
if fileName.endswith(DumpZipFile.ext[-1]):
if not isinstance(L[9], list):
import wx
L.insert(9, [FONT_SIZE, 74, 93, 700, 'Arial'])
else:
if not isinstance(L[6], list):
import wx
L.insert(6, [FONT_SIZE, 74, 93, 700, 'Arial'])

#=======================================================================

Expand Down
6 changes: 3 additions & 3 deletions ZipManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def GetModule(self, rcp: bool=False)->types.ModuleType:
try:
### module is referenced in sys.modules with the format: <LibName><ModelName><amd|cmd>
### the last tag allow to differenciate the model with the same name but different extention in the same lib.
fullname = "".join([os.path.basename(os.path.dirname(self.fn)), py_fn.split('.py')[0],self.fn.split('.')[-1]])
fullname = "".join([os.path.basename(os.path.dirname(self.fn)), py_fn.split('.py')[0], self.fn.split('.')[-1]])
return self.ImportModule() if fullname not in sys.modules else sys.modules[fullname]
### model has not python file !
except Exception as e:
Expand Down Expand Up @@ -428,7 +428,7 @@ def ImportModule(self)->types.ModuleType:
### Now import of .amd or .cmd module is composed by DomainModel (no point!).
### Example : import CollectorMessageCollectoramd or CollectorMessageCollectorcmd

fullname = "".join([os.path.basename(os.path.dirname(self.fn)), getPythonModelFileName(self.fn).split('.py')[0],self.fn.split('.')[-1]])
fullname = "".join([os.path.basename(os.path.dirname(self.fn)), getPythonModelFileName(self.fn).split('.py')[0], self.fn.split('.')[-1]])
sys.modules[fullname] = module

return module
Expand All @@ -444,7 +444,7 @@ def ReImport(self):
try:

### reload submodule from module dependencies!
fullname = "".join([os.path.basename(os.path.dirname(self.fn)), getPythonModelFileName(self.fn).split('.py')[0]])
fullname = "".join([os.path.basename(os.path.dirname(self.fn)), getPythonModelFileName(self.fn).split('.py')[0], self.fn.split('.')[-1]])
module = sys.modules[fullname]
domain_name = os.path.basename(os.path.dirname(self.fn))
for name in dir(module):
Expand Down