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
12 changes: 9 additions & 3 deletions Components.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,15 @@ def GetClass(elem):
if isinstance(clsmembers, dict):
moduleName = path_to_module(elem)

for cls in list(clsmembers.values()):
if str(cls.__module__) in str(moduleName):
return cls
DomainClass = clsmembers['DomainBehavior'] if 'DomainBehavior' in clsmembers else clsmembers['DomainStructure']

### return only the class that inherite of DomainBehavoir or DomainStructure which are present in the clsmembers dict
return next(filter(lambda c: c != DomainClass and issubclass(c, DomainClass), clsmembers.values()), None)

#for cls in [c for c in clsmembers.values() if c != DomainClass]:
# if issubclass(cls, DomainClass):
#if str(cls.__module__) in str(moduleName):
# return cls
else:
return clsmembers

Expand Down
2 changes: 2 additions & 0 deletions Patterns/Factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def __init__(self, model=None, strategy='', prof=False, ntl=False, verbose=False
self.dynamic_structure_flag = dynamic_structure_flag
self.real_time_flag = real_time_flag

#self.deamon = True

self.end_flag = False
self.thread_suspend = False
self.sleep_time = 0.0
Expand Down
15 changes: 7 additions & 8 deletions SimulationGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,11 @@ def OnStop(self, event):
if self.thread:
self.thread.terminate(False)

import os
import signal
import platform
#import signal
#import platform

# get the current PID for safe terminate server if needed:
PID = os.getpid()
#PID = os.getpid()
# if platform.system() != 'Windows':
# PGID = os.getgid(PID)

Expand All @@ -547,10 +546,10 @@ def OnStop(self, event):
# else:
# os.kill(PID, signal.SIGTERM)

main_thread = threading.currentThread()
for t in threading.enumerate():
if t is not main_thread:
pass
#main_thread = threading.currentThread()
#for t in threading.enumerate():
# if t is not main_thread:
# pass

self.timer.Stop()

Expand Down
3 changes: 2 additions & 1 deletion ZipManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ def GetModule(self, rcp: bool=False)->types.ModuleType:
PluginManager.trigger_event("IMPORT_STRATEGIES", fn=self.fn)

try:
return self.ImportModule() if self.GetFullName() not in sys.modules else sys.modules[self.GetFullName()]
module = self.ImportModule() if self.GetFullName() not in sys.modules else sys.modules[self.GetFullName()]
return module
### model has not python file !
except Exception as e:
return e
Expand Down