mscgraphevent.py 1.89 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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
#******************************************************************************
#
# 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
#  modify it under the terms of the GNU General Public License as published
#  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
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with TASTE Msc Diagram Editor.  If not, see
#  <http://www.gnu.org/licenses/>.
#
#  Author: Angel Esquinas <aesquina@datsi.fi.upm.es>
#
#  Copyright (c) 2012 European Space Agency
#
#******************************************************************************
from PySide.QtCore import QObject, Signal


class MscGraphEvent(QObject):
    '''
    Class that only represent the position in the instance
    '''
    yChanged = Signal(float)
    xChanged = Signal(float)

    def __init__(self, element=None, label='', parent=None):
        '''
        Constructor
        '''
        super(MscGraphEvent, self).__init__(parent)

        self.setElement(element)

        self.label = label

    def setElement(self, element):
        'Asociate the element with the event and update the coordY'
        self.element = element

    def pos(self):
        '''Pos of the parent'''
        return self.parent().pos()

    def posElement(self):
        return self.element.pos()

    def upperLimitInstance(self):
        return self.parent().posStartAxisInstance()

    def bottomLimitInstance(self):
        return self.parent().posEndAxisInstance()