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


import sys
import traceback
import ts2
from Qt import QtCore, QtWidgets, Qt
from ts2.gui import servicelistview
from ts2.utils import settings
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.serviceListView)
        layout.addWidget(buttonBox)
        self.setLayout(layout)
        self.resize(600, 300)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        self.serviceListView.doubleClicked.connect(self.accept)

        settings.restoreWindow(self)

    def getServiceCode(self):
        index = self.serviceListView.selectionModel().selection().indexes()[0]
        if index.isValid():
            return index.data()
        else:
            return ""

    @staticmethod
    def reassignServiceToTrain(simulation, trainId):
        """Reassigns a service to the train given by trainId by poping-up a
        reassignServiceDialog."""
        sad = ServiceAssignDialog(simulation.simulationWindow, simulation)
        if sad.exec_() == QtWidgets.QDialog.Accepted:
            newServiceCode = sad.getServiceCode()
            if newServiceCode != "":
                simulation.simulationWindow.webSocket.sendRequest("train", "setService",
                                                                  {'id': int(trainId), 'service': newServiceCode})


# 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/gui/dialogs.py
import sys
import traceback
import ts2
from Qt import QtCore, QtWidgets, Qt
from ts2.gui import servicelistview
from ts2.utils import settings

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.serviceListView)
        layout.addWidget(buttonBox)
        self.setLayout(layout)
        self.resize(600, 300)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        self.serviceListView.doubleClicked.connect(self.accept)

        settings.restoreWindow(self)

    def getServiceCode(self):
        index = self.serviceListView.selectionModel().selection().indexes()[0]
        if index.isValid():
            return index.data()
        else:
            return ""

    @staticmethod
    def reassignServiceToTrain(simulation, trainId):
        """Reassigns a service to the train given by trainId by poping-up a
        reassignServiceDialog."""
        sad = ServiceAssignDialog(simulation.simulationWindow, simulation)
        if sad.exec_() == QtWidgets.QDialog.Accepted:
            newServiceCode = sad.getServiceCode()
            if newServiceCode != "":
                simulation.simulationWindow.webSocket.sendRequest("train", "setService",
                                                                  {'id': int(trainId), 'service': newServiceCode})


    def closeEvent(self, event):