# Path: Extensions/Workspace.py
# class Workspace(QtGui.QDialog):
# 
#     def __init__(self, parent=None):
#         QtGui.QDialog.__init__(self, parent,
#                                QtCore.Qt.Window | QtCore.Qt.WindowCloseButtonHint)
# 
#         self.setWindowTitle("Workspace")
#         self.setWindowIcon(
#             QtGui.QIcon(os.path.join("Resources", "images", "Icon")))
#         self.setFixedSize(500, 130)
# 
#         self.createWorkSpaceThread = CreateWorkSpaceThread()
#         self.createWorkSpaceThread.finished.connect(self.completeWorkspace)
# 
#         mainLayout = QtGui.QVBoxLayout()
#         self.setLayout(mainLayout)
# 
#         mainLayout.addWidget(
#             QtGui.QLabel("Choose the location of your Workspace:"))
# 
#         self.choiceBox = QtGui.QComboBox()
#         self.choiceBox.addItem("Choose an existing one")
#         self.choiceBox.addItem("Create new")
#         mainLayout.addWidget(self.choiceBox)
# 
#         self.getPathLine = GetPathLine()
#         mainLayout.addWidget(self.getPathLine)
# 
#         mainLayout.addStretch(1)
# 
#         hbox = QtGui.QHBoxLayout()
#         mainLayout.addLayout(hbox)
# 
#         self.statusLabel = QtGui.QLabel()
#         hbox.addWidget(self.statusLabel)
# 
#         hbox.addStretch(1)
# 
#         self.okButton = QtGui.QPushButton("Done")
#         self.okButton.clicked.connect(self.accept)
#         hbox.addWidget(self.okButton)
# 
#         self.cancelButton = QtGui.QPushButton("Cancel")
#         self.cancelButton.clicked.connect(self.cancel)
#         hbox.addWidget(self.cancelButton)
# 
#         self.created = False
# 
#         self.exec_()
# 
#     def completeWorkspace(self):
#         QtGui.QApplication.restoreOverrideCursor()
#         if self.createWorkSpaceThread.errors is None:
#             self.path = os.path.join(
#                 self.createWorkSpaceThread.path, "PcodeProjects")
#             self.created = True
#             self.close()
#         else:
#             self.statusLabel.clear()
#             message = QtGui.QMessageBox.warning(
#                 self, "Workspace", "Error creating workspace:\n\n{0}".format(self.createWorkSpaceThread.errors))
#             self.okButton.setDisabled(False)
#             self.cancelButton.setDisabled(False)
#             self.getPathLine.setDisabled(False)
#             self.choiceBox.setDisabled(False)
# 
#     def accept(self):
#         path = self.getPathLine.text()
#         if os.path.exists(path):
#             if self.choiceBox.currentIndex() == 0:
#                 if os.path.basename(path) == "PcodeProjects":
#                     self.path = path
#                     self.created = True
#                     self.close()
#                 else:
#                     message = QtGui.QMessageBox.warning(
#                         self, "Workspace", "The workspace is not valid!")
#                     return
#             else:
#                 self.okButton.setDisabled(True)
#                 self.cancelButton.setDisabled(True)
#                 self.getPathLine.setDisabled(True)
#                 self.choiceBox.setDisabled(True)
#                 self.statusLabel.setText("Creating workspace...")
#                 QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
# 
#                 self.createWorkSpaceThread.createWorkspace(path)
#         else:
#             message = QtGui.QMessageBox.warning(
#                 self, "Workspace", "Path does not exist.")
# 
#     def cancel(self):
#         self.created = False
#         self.close()


import os
import sys
import re
import codecs
import traceback
import logging
        import winreg
from PyQt4 import QtCore, QtXml
from PyQt4.Qsci import QsciScintilla
from Extensions.Workspace import Workspace
                       'Move-To-Start-Of-Display-Line': ['Alt+Home', 2345],
                       'Move-To-End-Of-Next-Word': ['', 2441],
                       'Duplicate-The-Current-Line': ['', 2404],
                       'Move-To-End-Of-Display-Line': ['Alt+End', 2347],
                       'Extend-Selection-To-End-Of-Document': ['Ctrl+Shift+End', 2319],
                       'Extend-Selection-Up-One-Page': ['Shift+PgUp', 2321],
                       'Scroll-To-End-Of-Document': ['', 2629]}
            }

        self.CUSTOM_SHORTCUTS = {'Ide': {}, 'Editor': {}}

        # load configuration from file
        tempList = []
        file = open("settings.ini", "r")
        for i in file.readlines():
            if i.strip() == '':
                pass
            else:
                tempList.append(tuple(i.strip().split('=')))
        file.close()
        self.settings = dict(tempList)

        self.loadAppData()
        self.loadUseData()

        self.SETTINGS["InstalledInterpreters"] = self.getPythonExecutables()

    def loadAppData(self):
        self.workspaceDir = self.settings["workspace"]
        if not os.path.exists(self.workspaceDir):

# Path: Extensions/Workspace.py
# class Workspace(QtGui.QDialog):
# 
#     def __init__(self, parent=None):
#         QtGui.QDialog.__init__(self, parent,
#                                QtCore.Qt.Window | QtCore.Qt.WindowCloseButtonHint)
# 
#         self.setWindowTitle("Workspace")
#         self.setWindowIcon(
#             QtGui.QIcon(os.path.join("Resources", "images", "Icon")))
#         self.setFixedSize(500, 130)
# 
#         self.createWorkSpaceThread = CreateWorkSpaceThread()
#         self.createWorkSpaceThread.finished.connect(self.completeWorkspace)
# 
#         mainLayout = QtGui.QVBoxLayout()
#         self.setLayout(mainLayout)
# 
#         mainLayout.addWidget(
#             QtGui.QLabel("Choose the location of your Workspace:"))
# 
#         self.choiceBox = QtGui.QComboBox()
#         self.choiceBox.addItem("Choose an existing one")
#         self.choiceBox.addItem("Create new")
#         mainLayout.addWidget(self.choiceBox)
# 
#         self.getPathLine = GetPathLine()
#         mainLayout.addWidget(self.getPathLine)
# 
#         mainLayout.addStretch(1)
# 
#         hbox = QtGui.QHBoxLayout()
#         mainLayout.addLayout(hbox)
# 
#         self.statusLabel = QtGui.QLabel()
#         hbox.addWidget(self.statusLabel)
# 
#         hbox.addStretch(1)
# 
#         self.okButton = QtGui.QPushButton("Done")
#         self.okButton.clicked.connect(self.accept)
#         hbox.addWidget(self.okButton)
# 
#         self.cancelButton = QtGui.QPushButton("Cancel")
#         self.cancelButton.clicked.connect(self.cancel)
#         hbox.addWidget(self.cancelButton)
# 
#         self.created = False
# 
#         self.exec_()
# 
#     def completeWorkspace(self):
#         QtGui.QApplication.restoreOverrideCursor()
#         if self.createWorkSpaceThread.errors is None:
#             self.path = os.path.join(
#                 self.createWorkSpaceThread.path, "PcodeProjects")
#             self.created = True
#             self.close()
#         else:
#             self.statusLabel.clear()
#             message = QtGui.QMessageBox.warning(
#                 self, "Workspace", "Error creating workspace:\n\n{0}".format(self.createWorkSpaceThread.errors))
#             self.okButton.setDisabled(False)
#             self.cancelButton.setDisabled(False)
#             self.getPathLine.setDisabled(False)
#             self.choiceBox.setDisabled(False)
# 
#     def accept(self):
#         path = self.getPathLine.text()
#         if os.path.exists(path):
#             if self.choiceBox.currentIndex() == 0:
#                 if os.path.basename(path) == "PcodeProjects":
#                     self.path = path
#                     self.created = True
#                     self.close()
#                 else:
#                     message = QtGui.QMessageBox.warning(
#                         self, "Workspace", "The workspace is not valid!")
#                     return
#             else:
#                 self.okButton.setDisabled(True)
#                 self.cancelButton.setDisabled(True)
#                 self.getPathLine.setDisabled(True)
#                 self.choiceBox.setDisabled(True)
#                 self.statusLabel.setText("Creating workspace...")
#                 QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)
# 
#                 self.createWorkSpaceThread.createWorkspace(path)
#         else:
#             message = QtGui.QMessageBox.warning(
#                 self, "Workspace", "Path does not exist.")
# 
#     def cancel(self):
#         self.created = False
#         self.close()


# Path: Extensions/UseData.py
import os
import sys
import re
import codecs
import traceback
import logging
        import winreg
from PyQt4 import QtCore, QtXml
from PyQt4.Qsci import QsciScintilla
from Extensions.Workspace import Workspace

                       'Move-To-Start-Of-Display-Line': ['Alt+Home', 2345],
                       'Move-To-End-Of-Next-Word': ['', 2441],
                       'Duplicate-The-Current-Line': ['', 2404],
                       'Move-To-End-Of-Display-Line': ['Alt+End', 2347],
                       'Extend-Selection-To-End-Of-Document': ['Ctrl+Shift+End', 2319],
                       'Extend-Selection-Up-One-Page': ['Shift+PgUp', 2321],
                       'Scroll-To-End-Of-Document': ['', 2629]}
            }

        self.CUSTOM_SHORTCUTS = {'Ide': {}, 'Editor': {}}

        # load configuration from file
        tempList = []
        file = open("settings.ini", "r")
        for i in file.readlines():
            if i.strip() == '':
                pass
            else:
                tempList.append(tuple(i.strip().split('=')))
        file.close()
        self.settings = dict(tempList)

        self.loadAppData()
        self.loadUseData()

        self.SETTINGS["InstalledInterpreters"] = self.getPythonExecutables()

    def loadAppData(self):
        self.workspaceDir = self.settings["workspace"]
        if not os.path.exists(self.workspaceDir):

            newWorkspace = Workspace()