Commit 6c8fdf8e authored by Georgios Dagkakis's avatar Georgios Dagkakis

ManPyObject to create id and name if not given

parent 0bbc3b3d
...@@ -35,7 +35,7 @@ from ManPyObject import ManPyObject ...@@ -35,7 +35,7 @@ from ManPyObject import ManPyObject
class CoreObject(ManPyObject): class CoreObject(ManPyObject):
class_name = 'Dream.CoreObject' class_name = 'Dream.CoreObject'
def __init__(self, id, name, inputsDict={}, **kw): def __init__(self, id, name, **kw):
ManPyObject.__init__(self,id,name) ManPyObject.__init__(self,id,name)
self.objName = name self.objName = name
# lists that hold the previous and next objects in the flow # lists that hold the previous and next objects in the flow
......
...@@ -33,10 +33,19 @@ Also only abstract ManPy classes inherit directly (CoreObject, Entity, ObjectRes ...@@ -33,10 +33,19 @@ Also only abstract ManPy classes inherit directly (CoreObject, Entity, ObjectRes
class ManPyObject(object): class ManPyObject(object):
def __init__(self, id, name,**kw): def __init__(self, id, name,**kw):
self.id=id if id:
self.name=name self.id=id
# if no id was given create a random one
else:
self.id=str(self.__class__.__name__)
import random
self.id=self.id+str(random.randint(1, 1000000))
if name:
self.name=name
# if no name was given give id as name
else:
self.name=self.id
#=========================================================================== #===========================================================================
# method used to request allocation from the Router # method used to request allocation from the Router
#=========================================================================== #===========================================================================
......
...@@ -77,13 +77,6 @@ class AssembleMouldError(Exception): ...@@ -77,13 +77,6 @@ class AssembleMouldError(Exception):
# the MachineManagedJob object # the MachineManagedJob object
# =========================================================================== # ===========================================================================
class MouldAssembly(MachineManagedJob): class MouldAssembly(MachineManagedJob):
# =======================================================================
# parses inputs if they are given in a dictionary
# =======================================================================
def parseInputs(self, **kw):
from Globals import G
G.MouldAssemblyList.append(self)
# ======================================================================= # =======================================================================
# the initialize method # the initialize method
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment