msccondition.py 2.35 KB
Newer Older
1 2 3 4 5 6 7 8
#******************************************************************************
#
# TASTE Msc Diagram Editor
# http://taste.tuxfamily.org/
#
#  This file is part of TASTE Msc Editor.
#
#  TASTE Msc Diagram Editor is free software: you can redistribute it and/or
9
#  modify it under the terms of the GNU Lesser General Public License as published
10 11 12 13 14 15
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  TASTE Msc Diagram Editor is distributed in the hope that it will be
#  useful,(but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
#  GNU Lesser General Public License for more details.
17
#
18
#  You should have received a copy of the GNU Lesser General Public License
19 20 21 22 23 24
#  along with TASTE Msc Diagram Editor.  If not, see
#  <http://www.gnu.org/licenses/>.
#
#  Author: Angel Esquinas <aesquina@datsi.fi.upm.es>
#  Author of this module: Maxime Perrotin maxime.perrotin@esa.int
#
25
#  Copyright (c) 2014 UPM and European Space Agency
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
#
#******************************************************************************
u"""
The :class:`msccore.MscCondition` class represents a Condition within the MSC.

:class:`msccore.MscCondition`

"""
from mscelement import MscElement


class MscCondition(MscElement):
    u"""
    :param unicode name: Text of the condition
    :param int orderPos: Absolute pos of timer, when used as event.
    :param parent:
    :type parent: PySide.QtCore.QObject
    """
    TYPE = u"Condition"

    def __init__(self, name, orderPos=0, parent=None):
        '''
        Constructor
        '''
        super(MscCondition, self).__init__(name, parent, self.TYPE)
        self.setAbsPos(orderPos)

    def delete(self):
        """ Delete is the destructor of MscCondition
        The signal 'deleted' is emitted before destroy himself.
        """
        self.deleted.emit(self)
        self.deleteLater()

    #Order/Graphical Pos
    def setAbsPos(self, pos):
        self._absPos = pos

    def absPos(self):
        return self._absPos

    def accept(self, visitor):
        u""" Visitor Pattern"""
        visitor.visitorMscCondition(self)

    def __str__(self):
        return """<<{0}:{1}. Pos {3}>>\n
                comment: {4}""".format(self.TYPE, self.getName(),
                                       self.absPos(), self.comment())