# 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/widgets.py
# class ClockWidget(QtWidgets.QLCDNumber):
# class ZoomWidget(QtWidgets.QWidget):
# class XGraphicsView(QtWidgets.QGraphicsView):
# class StatusBar(QtWidgets.QStatusBar):
# class ToolBarGroup(QtWidgets.QWidget):
# class VBoxWidget(QtWidgets.QWidget):
# class HBoxWidget(QtWidgets.QWidget):
# class HeaderLabel(QtWidgets.QLabel):
#     def __init__(self, parent):
#     def setTime(self, t):
#     def __init__(self, parent=None):
#     def setDefaultZoom(self):
#     def __init__(self, parent=None):
#     def wheelEvent(self, ev):
#     def __init__(self, parent=None):
#     def showMessage(self, txt, timeout=0, info=False, warn=False):
#     def onProgressTimeout(self):
#     def showBusy(self, is_busy):
#     def __init__(self, parent=None, title=None, fg=None, bg=None):
#     def updateStyle(self):
#     def setTitle(self, title):
#     def addWidget(self, widget):
#     def addAction(self, action):
#     def __init__(self, parent=None, margin=0):
#     def addWidget(self, widget, stretch=0):
#     def addLayout(self, layout, stretch=0):
#     def __init__(self, parent=None, margin=0):
#     def addWidget(self, widget, stretch=0):
#     def addLayout(self, layout, stretch=0):
#     def __init__(self, parent=None, text="", start=None, end=None, align=None):


import os
import tempfile
import zipfile
import fnmatch
import json
import ts2
from urllib import request
from Qt import QtCore, QtWidgets, Qt
from ts2.utils import settings
from ts2.gui import widgets
                                            zipArchive.read(fileName),
                                            compress_type=zipfile.ZIP_BZIP2)

        QtWidgets.qApp.restoreOverrideCursor()

        self.statusBar.showBusy(False)
        self.statusBar.showMessage("Download done", timeout=2)
        self.buttDownload.setDisabled(False)
        self.onRefreshSims()

    def onNavButtClicked(self, butt):

        idx = self.buttGroup.id(butt)

        if idx == NAV.sims:
            self.onRefreshSims()

        elif idx == NAV.recent:
            self.onRefreshRecent()

        self.stackWidget.setCurrentIndex(idx)

    def onRefreshSims(self):
        """Reloads the simulations dir"""
        self.statusBar.showMessage("Loading")
        self.treeSims.clear()

        ts2_files = {}
        for root, dirnames, filenames in os.walk(settings.simulationsDir):
            for filename in fnmatch.filter(filenames, '*.ts2'):

# 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/widgets.py
# class ClockWidget(QtWidgets.QLCDNumber):
# class ZoomWidget(QtWidgets.QWidget):
# class XGraphicsView(QtWidgets.QGraphicsView):
# class StatusBar(QtWidgets.QStatusBar):
# class ToolBarGroup(QtWidgets.QWidget):
# class VBoxWidget(QtWidgets.QWidget):
# class HBoxWidget(QtWidgets.QWidget):
# class HeaderLabel(QtWidgets.QLabel):
#     def __init__(self, parent):
#     def setTime(self, t):
#     def __init__(self, parent=None):
#     def setDefaultZoom(self):
#     def __init__(self, parent=None):
#     def wheelEvent(self, ev):
#     def __init__(self, parent=None):
#     def showMessage(self, txt, timeout=0, info=False, warn=False):
#     def onProgressTimeout(self):
#     def showBusy(self, is_busy):
#     def __init__(self, parent=None, title=None, fg=None, bg=None):
#     def updateStyle(self):
#     def setTitle(self, title):
#     def addWidget(self, widget):
#     def addAction(self, action):
#     def __init__(self, parent=None, margin=0):
#     def addWidget(self, widget, stretch=0):
#     def addLayout(self, layout, stretch=0):
#     def __init__(self, parent=None, margin=0):
#     def addWidget(self, widget, stretch=0):
#     def addLayout(self, layout, stretch=0):
#     def __init__(self, parent=None, text="", start=None, end=None, align=None):


# Path: ts2/gui/opendialog.py
import os
import tempfile
import zipfile
import fnmatch
import json
import ts2
from urllib import request
from Qt import QtCore, QtWidgets, Qt
from ts2.utils import settings
from ts2.gui import widgets

                                            zipArchive.read(fileName),
                                            compress_type=zipfile.ZIP_BZIP2)

        QtWidgets.qApp.restoreOverrideCursor()

        self.statusBar.showBusy(False)
        self.statusBar.showMessage("Download done", timeout=2)
        self.buttDownload.setDisabled(False)
        self.onRefreshSims()

    def onNavButtClicked(self, butt):

        idx = self.buttGroup.id(butt)

        if idx == NAV.sims:
            self.onRefreshSims()

        elif idx == NAV.recent:
            self.onRefreshRecent()

        self.stackWidget.setCurrentIndex(idx)

    def onRefreshSims(self):
        """Reloads the simulations dir"""
        self.statusBar.showMessage("Loading")
        self.treeSims.clear()

        ts2_files = {}
        for root, dirnames, filenames in os.walk(settings.simulationsDir):
            for filename in fnmatch.filter(filenames, '*.ts2'):

                d = root.split(QtCore.QDir.separator())[-1]