# Path: Qt.py

# 
# Path: ts2/utils.py
# class Context:
# class FormatException(Exception):
# class MissingDependencyException(Exception):
# class DurationProba(QtCore.QObject):
#     GAME = 10
#     EDITORS = [20, 21, 22, 23, 24, 25]
#     EDITOR_GENERAL = 20
#     EDITOR_SCENERY = 21
#     EDITOR_ROUTES = 22
#     EDITOR_TRAINTYPES = 23
#     EDITOR_SERVICES = 24
#     EDITOR_TRAINS = 25
#     def __init__(self, arg):
#     def __init__(self, arg):
# def cumsum(lis):
#     def __init__(self, data):
#     def __str__(self):
#     def list(self):
#     def isNull(self):
#     def yieldValue(self):
# def to_json(data):
# def from_json(json_str):
# 
# Path: ts2/scenery/helper.py
# class TrackGraphicsItem(QtWidgets.QGraphicsItem):
# class TrackPropertiesModel(QtCore.QAbstractTableModel):
# class TIProperty:
#     def __init__(self, trackItem, itemId=0):
#     def boundingRect(self):
#     def shape(self):
#     def paint(self, painter, option, widget=None):
#     def mousePressEvent(self, event):
#     def mouseMoveEvent(self, event):
#     def dragEnterEvent(self, event):
#     def dragLeaveEvent(self, event):
#     def dropEvent(self, event):
#     def __init__(self, trackItems):
#     def rowCount(self, parent=None, *args):
#     def columnCount(self, parent=None, *args):
#     def data(self, index, role=Qt.DisplayRole):
#     def setData(self, index, value, role=Qt.EditRole):
#     def headerData(self, section, orientation, role=Qt.DisplayRole):
#     def flags(self, index):
#     def __init__(self, name, display, readOnly=False, propType="str",
#                  enumNames=None, enumValues=None):
# 
# Path: ts2/scenery/abstract.py
# def qPointFStrizer(attr):
#     def getter(self):
# def qPointFDestrizer(attr):
#     def setter(self, value):
# def qPointFTupler(attr):
#     def getter(self):
# def qPointFDetupler(attr):
#     def setter(self, value):
#     def __init__(self, parameters):
#     def updateFromParameters(self, parameters):
#     def initialize(self, simulation):
#     def updateData(self, msg):
#     def getProperties():
#     def getMultiProperties():
#     def for_json(self):
#     def _getOrigin(self):
#     def _setOrigin(self, pos):
#     def _getEnd(self):
#     def _getName(self):
#     def _setName(self, value):
#     def maxSpeed(self):
#     def maxSpeed(self, value):
#     def toolTipText(self):
#     def tiTypeStr(self):
#     def highlighted(self):
#     def _getRealLength(self):
#     def place(self):
#     def nextItem(self):
#     def nextItem(self, ni):
#     def previousItem(self):
#     def previousItem(self, pi):
#     def _getGraphicsItem(self):
#     def _getSelected(self):
#     def _setSelected(self, value):
#     def conflictTI(self):
#     def conflictTiId(self):
#     def conflictTiId(self, value):
#     def getFollowingItem(self, precedingItem, direction=-1):
#     def trainPresent(self):
#     def distanceToTrainEnd(self, pos):
#     def isOnPosition(self, p):
#     def setupTriggers(self):
#     def __eq__(self, ti):
#     def __ne__(self, ti):
#     def __updateGraphics(self):
#     def removeAllGraphicsItems(self):
#     def updateGraphics(self):
#     def updateTrain(self):
#     def getPen(self):
#     def drawConnectionRect(self, painter, point):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsShape(self, shape, itemId):
#     def graphicsPaint(self, painter, options, itemId, widget=None):
#     def graphicsMousePressEvent(self, event, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
#     def graphicsDragEnterEvent(self, event, itemId):
#     def graphicsDragLeaveEvent(self, event, itemId):
#     def graphicsDropEvent(self, event, itemId):
#     def updateFromParameters(self, parameters):
#     def getProperties():
#     def for_json(self):
#     def _setOrigin(self, pos):
#     def _setEnd(self, pos):
#     def _getStart(self):
#     def _setStart(self, pos):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
# class TrackItem(QtCore.QObject):
# class ResizableItem(TrackItem):


from Qt import QtCore, QtWidgets, Qt
from ts2 import utils
from ts2.scenery import helper, abstract
                precedingItem == self.reverseItem:
            return self.commonItem
        else:
            raise Exception("Items not linked: %s and %s" %
                            (self.tiId, precedingItem.tiId))

    # ## Graphics methods ###############################################

    def graphicsPaint(self, p, options, itemId, widget=None):
        """Draws the points on the painter given as parameter.
        This function is called by PointsGraphicsItem.paint.
        @param p The painter on which to draw the signal."""
        pen = self.getPen()

        if self.simulation.context == utils.Context.EDITOR_SCENERY:
            p.setPen(pen)
            p.drawLine(self.commonEnd, self.middle)
            pen.setWidth(2)
            p.setPen(pen)
            p.drawLine(self.normalEnd, self.middle)
            pen.setWidth(1)
            p.setPen(pen)
            p.drawLine(self.reverseEnd, self.middle)

            # Draw the connection rects
            self.drawConnectionRect(p, self.commonEnd)
            self.drawConnectionRect(p, self.normalEnd)
            self.drawConnectionRect(p, self.reverseEnd)
        else:
            if self.trainPresent():

# Path: Qt.py

# 
# Path: ts2/utils.py
# class Context:
# class FormatException(Exception):
# class MissingDependencyException(Exception):
# class DurationProba(QtCore.QObject):
#     GAME = 10
#     EDITORS = [20, 21, 22, 23, 24, 25]
#     EDITOR_GENERAL = 20
#     EDITOR_SCENERY = 21
#     EDITOR_ROUTES = 22
#     EDITOR_TRAINTYPES = 23
#     EDITOR_SERVICES = 24
#     EDITOR_TRAINS = 25
#     def __init__(self, arg):
#     def __init__(self, arg):
# def cumsum(lis):
#     def __init__(self, data):
#     def __str__(self):
#     def list(self):
#     def isNull(self):
#     def yieldValue(self):
# def to_json(data):
# def from_json(json_str):
# 
# Path: ts2/scenery/helper.py
# class TrackGraphicsItem(QtWidgets.QGraphicsItem):
# class TrackPropertiesModel(QtCore.QAbstractTableModel):
# class TIProperty:
#     def __init__(self, trackItem, itemId=0):
#     def boundingRect(self):
#     def shape(self):
#     def paint(self, painter, option, widget=None):
#     def mousePressEvent(self, event):
#     def mouseMoveEvent(self, event):
#     def dragEnterEvent(self, event):
#     def dragLeaveEvent(self, event):
#     def dropEvent(self, event):
#     def __init__(self, trackItems):
#     def rowCount(self, parent=None, *args):
#     def columnCount(self, parent=None, *args):
#     def data(self, index, role=Qt.DisplayRole):
#     def setData(self, index, value, role=Qt.EditRole):
#     def headerData(self, section, orientation, role=Qt.DisplayRole):
#     def flags(self, index):
#     def __init__(self, name, display, readOnly=False, propType="str",
#                  enumNames=None, enumValues=None):
# 
# Path: ts2/scenery/abstract.py
# def qPointFStrizer(attr):
#     def getter(self):
# def qPointFDestrizer(attr):
#     def setter(self, value):
# def qPointFTupler(attr):
#     def getter(self):
# def qPointFDetupler(attr):
#     def setter(self, value):
#     def __init__(self, parameters):
#     def updateFromParameters(self, parameters):
#     def initialize(self, simulation):
#     def updateData(self, msg):
#     def getProperties():
#     def getMultiProperties():
#     def for_json(self):
#     def _getOrigin(self):
#     def _setOrigin(self, pos):
#     def _getEnd(self):
#     def _getName(self):
#     def _setName(self, value):
#     def maxSpeed(self):
#     def maxSpeed(self, value):
#     def toolTipText(self):
#     def tiTypeStr(self):
#     def highlighted(self):
#     def _getRealLength(self):
#     def place(self):
#     def nextItem(self):
#     def nextItem(self, ni):
#     def previousItem(self):
#     def previousItem(self, pi):
#     def _getGraphicsItem(self):
#     def _getSelected(self):
#     def _setSelected(self, value):
#     def conflictTI(self):
#     def conflictTiId(self):
#     def conflictTiId(self, value):
#     def getFollowingItem(self, precedingItem, direction=-1):
#     def trainPresent(self):
#     def distanceToTrainEnd(self, pos):
#     def isOnPosition(self, p):
#     def setupTriggers(self):
#     def __eq__(self, ti):
#     def __ne__(self, ti):
#     def __updateGraphics(self):
#     def removeAllGraphicsItems(self):
#     def updateGraphics(self):
#     def updateTrain(self):
#     def getPen(self):
#     def drawConnectionRect(self, painter, point):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsShape(self, shape, itemId):
#     def graphicsPaint(self, painter, options, itemId, widget=None):
#     def graphicsMousePressEvent(self, event, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
#     def graphicsDragEnterEvent(self, event, itemId):
#     def graphicsDragLeaveEvent(self, event, itemId):
#     def graphicsDropEvent(self, event, itemId):
#     def updateFromParameters(self, parameters):
#     def getProperties():
#     def for_json(self):
#     def _setOrigin(self, pos):
#     def _setEnd(self, pos):
#     def _getStart(self):
#     def _setStart(self, pos):
#     def graphicsBoundingRect(self, itemId):
#     def graphicsMouseMoveEvent(self, event, itemId=0):
# class TrackItem(QtCore.QObject):
# class ResizableItem(TrackItem):


# Path: ts2/scenery/pointsitem.py
from Qt import QtCore, QtWidgets, Qt
from ts2 import utils
from ts2.scenery import helper, abstract

                precedingItem == self.reverseItem:
            return self.commonItem
        else:
            raise Exception("Items not linked: %s and %s" %
                            (self.tiId, precedingItem.tiId))

    # ## Graphics methods ###############################################

    def graphicsPaint(self, p, options, itemId, widget=None):
        """Draws the points on the painter given as parameter.
        This function is called by PointsGraphicsItem.paint.
        @param p The painter on which to draw the signal."""
        pen = self.getPen()

        if self.simulation.context == utils.Context.EDITOR_SCENERY:
            p.setPen(pen)
            p.drawLine(self.commonEnd, self.middle)
            pen.setWidth(2)
            p.setPen(pen)
            p.drawLine(self.normalEnd, self.middle)
            pen.setWidth(1)
            p.setPen(pen)
            p.drawLine(self.reverseEnd, self.middle)

            # Draw the connection rects
            self.drawConnectionRect(p, self.commonEnd)
            self.drawConnectionRect(p, self.normalEnd)
            self.drawConnectionRect(p, self.reverseEnd)
        else:
            if self.trainPresent():

                pen.setColor(Qt.red)