# 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):


from Qt import QtCore, Qt
from ts2 import utils

    def initialize(self, simulation):
        """Initializes the simulation variable once it is loaded."""
        self.simulation = simulation

    def for_json(self):
        """Dumps this trainType to JSON"""
        return {
            "__type__": "TrainType",
            "code": self.code,
            "description": self.description,
            "maxSpeed": self.maxSpeed,
            "stdAccel": self.stdAccel,
            "stdBraking": self.stdBraking,
            "emergBraking": self.emergBraking,
            "length": self.length,
            "elements": self._elements
        }

    @property
    def code(self):
        """
        :return: the unique code of this rolling stock type
        :rtype: str
        """
        return self._code
    
    @code.setter
    def code(self, value):
        """Setter function for the code property"""

# 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/trains/traintype.py
from Qt import QtCore, Qt
from ts2 import utils


    def initialize(self, simulation):
        """Initializes the simulation variable once it is loaded."""
        self.simulation = simulation

    def for_json(self):
        """Dumps this trainType to JSON"""
        return {
            "__type__": "TrainType",
            "code": self.code,
            "description": self.description,
            "maxSpeed": self.maxSpeed,
            "stdAccel": self.stdAccel,
            "stdBraking": self.stdBraking,
            "emergBraking": self.emergBraking,
            "length": self.length,
            "elements": self._elements
        }

    @property
    def code(self):
        """
        :return: the unique code of this rolling stock type
        :rtype: str
        """
        return self._code
    
    @code.setter
    def code(self, value):
        """Setter function for the code property"""

        if self.simulation.context == utils.Context.EDITOR_TRAINTYPES: