Skip to content
Snippets Groups Projects
Commit d47826b8 authored by Stefano Borini's avatar Stefano Borini
Browse files

Introduced base model object

parent 82dffe0e
No related branches found
No related tags found
1 merge request!173Introduced base model object
from traits.api import ABCHasStrictTraits, Instance
from force_bdss.core.base_factory import BaseFactory
class BaseModel(ABCHasStrictTraits):
"""Base class for all the models of all the factories."""
#: A reference to the creating factory, so that we can
#: retrieve it as the originating factory.
factory = Instance(BaseFactory, visible=False, transient=True)
def __init__(self, factory, *args, **kwargs):
super(BaseModel, self).__init__(factory=factory, *args, **kwargs)
from traits.api import (
ABCHasStrictTraits, Instance, List, Event, on_trait_change
Instance, List, Event, on_trait_change
)
from force_bdss.core.base_model import BaseModel
from force_bdss.core.input_slot_info import InputSlotInfo
from force_bdss.core.output_slot_info import OutputSlotInfo
from force_bdss.data_sources.i_data_source_factory import IDataSourceFactory
class BaseDataSourceModel(ABCHasStrictTraits):
class BaseDataSourceModel(BaseModel):
"""Base class for the factory specific DataSource models.
This model will also provide, through traits/traitsui magic the View
that will appear in the workflow manager UI.
......@@ -38,10 +39,6 @@ class BaseDataSourceModel(ABCHasStrictTraits):
#: this and adapt the visual entries.
changes_slots = Event()
def __init__(self, factory, *args, **kwargs):
self.factory = factory
super(BaseDataSourceModel, self).__init__(*args, **kwargs)
def __getstate__(self):
state = super(BaseDataSourceModel, self).__getstate__()
state["input_slot_info"] = [
......
from traits.api import ABCHasStrictTraits, Instance, List
from traits.api import Instance, List
from force_bdss.core.base_model import BaseModel
from force_bdss.core.kpi_specification import KPISpecification
from .parameters.base_mco_parameter import BaseMCOParameter
from .i_mco_factory import IMCOFactory
class BaseMCOModel(ABCHasStrictTraits):
class BaseMCOModel(BaseModel):
"""Base class for the specific MCO models.
This model will also provide, through traits/traitsui magic the View
that will appear in the workflow manager UI.
......@@ -14,16 +15,10 @@ class BaseMCOModel(ABCHasStrictTraits):
"""
#: A reference to the creating factory, so that we can
#: retrieve it as the originating factory.
factory = Instance(IMCOFactory,
visible=False,
transient=True)
factory = Instance(IMCOFactory, visible=False, transient=True)
#: A list of the parameters for the MCO
parameters = List(BaseMCOParameter, visible=False)
#: A list of KPI specification objects and their objective.
kpis = List(KPISpecification, visible=False)
def __init__(self, factory, *args, **kwargs):
self.factory = factory
super(BaseMCOModel, self).__init__(*args, **kwargs)
from traits.api import HasStrictTraits, String, Instance
from traits.api import String, Instance
from force_bdss.core.base_model import BaseModel
from force_bdss.mco.parameters.base_mco_parameter_factory import \
BaseMCOParameterFactory
from force_bdss.local_traits import Identifier
class BaseMCOParameter(HasStrictTraits):
class BaseMCOParameter(BaseModel):
"""The base class of all MCO Parameter models.
Must be reimplemented by specific classes handling the specific parameter
that MCOs understand.
......@@ -19,7 +20,3 @@ class BaseMCOParameter(HasStrictTraits):
#: A CUBA key describing the type of the parameter
type = String(visible=False)
def __init__(self, factory, *args, **kwargs):
self.factory = factory
super(BaseMCOParameter, self).__init__(*args, **kwargs)
from traits.api import ABCHasStrictTraits, Instance
from traits.api import Instance
from force_bdss.core.base_model import BaseModel
from force_bdss.notification_listeners.i_notification_listener_factory import \
INotificationListenerFactory
class BaseNotificationListenerModel(ABCHasStrictTraits):
class BaseNotificationListenerModel(BaseModel):
"""Base class for the specific Notification Listener models.
This model will also provide, through traits/traitsui magic the View
that will appear in the workflow manager UI.
......@@ -16,7 +17,3 @@ class BaseNotificationListenerModel(ABCHasStrictTraits):
factory = Instance(INotificationListenerFactory,
visible=False,
transient=True)
def __init__(self, factory, *args, **kwargs):
self.factory = factory
super(BaseNotificationListenerModel, self).__init__(*args, **kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment