Example #1
0
    def __init__(self, mainWindow):
        QObject.__init__(self)

        # To control the user interface elements
        self.__mainWindow = mainWindow
        self.__state = self.STATE_STOPPED

        self.__stopAtFirstLine = None

        self.__procWrapper = None
        self.__procuuid = None
        self.__fileName = None
        self.__runParameters = None
        self.__debugSettings = None

        self.__breakpointModel = BreakPointModel(self)
        self.__watchpointModel = WatchPointModel(self)

        self.__breakpointModel.rowsAboutToBeRemoved.connect(
            self.__deleteBreakPoints)
        self.__breakpointModel.sigDataAboutToBeChanged.connect(
            self.__breakPointDataAboutToBeChanged)
        self.__breakpointModel.dataChanged.connect(self.__changeBreakPoints)
        self.__breakpointModel.rowsInserted.connect(self.__addBreakPoints)
        self.sigClientClearBreak.connect(self.__clientClearBreakPoint)
        self.sigClientBreakConditionError.connect(
            self.__clientBreakConditionError)

        self.__handlers = {}
        self.__initHandlers()
Example #2
0
    def __init__(self, cacheDir):
        QObject.__init__(self)

        self.__md5ToFileName = {}
        self.__threads = {}
        self.__cacheDir = os.path.normpath(cacheDir) + os.path.sep

        if os.path.exists(self.__cacheDir):
            if os.path.isdir(self.__cacheDir):
                if os.access(self.__cacheDir, os.W_OK):
                    self.__loadCache()
                    self.__saveCache()
                else:
                    logging.error('The plantUML render cache directory (' +
                                  self.__cacheDir + ') does not '
                                  'have write permissions. There will be no '
                                  'plantUML rendering')
                    self.__cacheDir = None
            else:
                logging.error('The plantUML render cache directory path (' +
                              self.__cacheDir + ') exists and '
                              'is not a directory. There will be no pluntUML '
                              'rendering')
                self.__cacheDir = None
        else:
            # Try to create the dir
            try:
                os.mkdir(self.__cacheDir)
            except Exception as exc:
                logging.error(
                    'Error creating pluntUML render cache directory ' +
                    self.__cacheDir + ': ' + str(exc) +
                    ' There will be no plantUML rendering')
                self.__cacheDir = None
Example #3
0
    def __init__(self, cacheDir):
        QObject.__init__(self)

        self.__urlToFileName = {}
        self.__threads = {}
        self.__cacheDir = os.path.normpath(cacheDir) + os.path.sep

        if os.path.exists(self.__cacheDir):
            if os.path.isdir(self.__cacheDir):
                if os.access(self.__cacheDir, os.W_OK):
                    self.__loadCache()
                    self.__saveCache()
                else:
                    logging.error(
                        'The web resource cache directory (%s) '
                        'does not have write permissions. There '
                        'will be no web resource downloading', self.__cacheDir)
                    self.__cacheDir = None
            else:
                logging.error(
                    'The web resource cache directory path (%s) '
                    'exists and is not a directory. There will be '
                    'no web resource downloading', self.__cacheDir)
                self.__cacheDir = None
        else:
            # Try to create the dir
            try:
                os.mkdir(self.__cacheDir)
            except Exception as exc:
                logging.error(
                    'Error creating the web resource cache directory '
                    '%s: %s '
                    'There will be no web resource downloading',
                    self.__cacheDir, str(exc))
                self.__cacheDir = None
Example #4
0
    def __init__(self):
        QObject.__init__(self)
        PluginManager.__init__(self, None,
                               [SETTINGS_DIR + "plugins",
                                "/usr/share/codimension3-plugins",
                                VENV_PLUGINS_PATH], "cdmp")

        self.inactivePlugins = {}   # Categorized inactive plugins
        self.activePlugins = {}     # Categorized active plugins
        self.unknownPlugins = []    # Unknown plugins
Example #5
0
    def __init__(self, path, serverPort, redirected, kind):
        QObject.__init__(self)
        self.procuuid = str(uuid.uuid1())
        self.path = path
        self.redirected = redirected
        self.kind = kind
        self.state = None
        self.startTime = None
        self.finishTime = None

        self.__serverPort = serverPort
        self.__clientSocket = None
        self.__proc = None
Example #6
0
    def __init__(self, manager, pluginID, plugin):
        QObject.__init__(self)

        self.manager = manager
        self.pluginID = pluginID
        self.plugin = plugin
        self.thread = None  # VCSPluginThread
        self.indicators = {}  # ID -> VCSIndicator

        self.__getPluginIndicators()
        self.thread = VCSPluginThread(plugin)
        self.thread.start()

        self.thread.VCSStatus.connect(self.__onStatus)
Example #7
0
    def __init__(self, mainWindow):
        QObject.__init__(self)
        self.__mainWindow = mainWindow
        self.__processes = []
        self.__prologueProcesses = []

        self.__tcpServer = QTcpServer()
        self.__tcpServer.newConnection.connect(self.__newConnection)
        self.__tcpServer.listen(QHostAddress.LocalHost)

        self.__waitTimer = QTimer(self)
        self.__waitTimer.setSingleShot(True)
        self.__waitTimer.timeout.connect(self.__onWaitTimer)

        self.__prologueTimer = QTimer(self)
        self.__prologueTimer.setSingleShot(True)
        self.__prologueTimer.timeout.connect(self.__onPrologueTimer)
Example #8
0
    def __init__(self, excludeFilters, dirToWatch):
        QObject.__init__(self)
        self.__dirWatcher = QFileSystemWatcher(self)

        # data members
        self.__excludeFilter = []  # Files exclude filter
        self.__srcDirsToWatch = set()  # Came from the user

        self.__fsTopLevelSnapshot = {}  # Current snapshot
        self.__fsSnapshot = {}  # Current snapshot

        # Sets of dirs which are currently watched
        self.__dirsToWatch = set()
        self.__topLevelDirsToWatch = set()  # Generated till root

        # precompile filters
        for flt in excludeFilters:
            self.__excludeFilter.append(re.compile(flt))

        # Initialise the list of dirs to watch
        self.__srcDirsToWatch.add(dirToWatch)

        self.__topLevelDirsToWatch = self.__buildTopDirsList(
            self.__srcDirsToWatch)
        self.__fsTopLevelSnapshot = self.__buildTopLevelSnapshot(
            self.__topLevelDirsToWatch, self.__srcDirsToWatch)
        self.__dirsToWatch = self.__buildSnapshot()

        # Here __dirsToWatch and __topLevelDirsToWatch have a complete
        # set of what should be watched

        # Add the dirs to the watcher
        dirs = []
        for path in self.__dirsToWatch | self.__topLevelDirsToWatch:
            dirs.append(path)
        self.__dirWatcher.addPaths(dirs)
        self.__dirWatcher.directoryChanged.connect(self.__onDirChanged)

        # self.debug()
        return
Example #9
0
    def __init__(self):
        QObject.__init__(self)
        DebuggerEnvironment.__init__(self)
        SearchEnvironment.__init__(self)
        FileSystemEnvironment.__init__(self)
        RunParametersCache.__init__(self)
        FilePositions.__init__(self)
        FileEncodings.__init__(self)

        self.__dirWatcher = None

        # Avoid pylint complains
        self.fileName = ""
        self.userProjectDir = ""  # Directory in ~/.codimension3/uuidNN/
        self.filesList = set()

        self.props = copy.deepcopy(_DEFAULT_PROJECT_PROPS)

        # Precompile the exclude filters for the project files list
        self.__excludeFilter = []
        for flt in Settings()['projectFilesFilters']:
            self.__excludeFilter.append(re.compile(flt))
Example #10
0
    def __init__(self):
        QObject.__init__(self)

        self.dirCache = VCSStatusCache()  # Path -> VCSStatus
        self.fileCache = VCSStatusCache()  # Path -> VCSStatus
        self.activePlugins = {}  # Plugin ID -> VCSPluginDescriptor
        self.systemIndicators = {}  # ID -> VCSIndicator

        self.__firstFreeIndex = 0

        self.__readSettingsIndicators()
        self.__dirRequestLoopTimer = QTimer(self)
        self.__dirRequestLoopTimer.setSingleShot(True)
        self.__dirRequestLoopTimer.timeout.connect(
            self.__onDirRequestLoopTimer)

        GlobalData().project.sigProjectChanged.connect(self.__onProjectChanged)
        GlobalData().project.sigFSChanged.connect(self.__onFSChanged)
        GlobalData().pluginManager.sigPluginActivated.connect(
            self.__onPluginActivated)

        # Plugin deactivation must be done via dismissPlugin(...)
        return
Example #11
0
    def __init__(self):
        QObject.__init__(self)
        DebuggerEnvironment.__init__(self)
        SearchEnvironment.__init__(self)
        FileSystemEnvironment.__init__(self)
        RunParametersCache.__init__(self)
        FilePositions.__init__(self)
        FileEncodings.__init__(self)
        FlowUICollapsedGroups.__init__(self)

        self.minTextZoom = None
        self.minCFlowZoom = None

        self.__values = deepcopy(_DEFAULT_SETTINGS)

        # make sure that the directory exists
        if not os.path.exists(SETTINGS_DIR):
            os.makedirs(SETTINGS_DIR)

        RunParametersCache.setup(self, SETTINGS_DIR)
        DebuggerEnvironment.setup(self, SETTINGS_DIR)
        SearchEnvironment.setup(self, SETTINGS_DIR)
        FileSystemEnvironment.setup(self, SETTINGS_DIR)
        FilePositions.setup(self, SETTINGS_DIR)
        FileEncodings.setup(self, SETTINGS_DIR)
        FlowUICollapsedGroups.setup(self, SETTINGS_DIR)

        self.webResourceCache = WebResourceCache(SETTINGS_DIR + os.path.sep +
                                                 'webresourcecache')
        self.plantUMLCache = PlantUMLCache(SETTINGS_DIR + os.path.sep +
                                           'plantumlcache')

        # Save the config file name
        self.__fullFileName = SETTINGS_DIR + "settings.json"

        # Create file if does not exist
        if not os.path.exists(self.__fullFileName):
            # Save to file
            self.flush()
            return

        readErrors = []

        # Load the previous session settings
        try:
            with open(self.__fullFileName, "r",
                      encoding=SETTINGS_ENCODING) as diskfile:
                diskValues = json.load(diskfile, object_hook=settingsFromJSON)
        except Exception as exc:
            # Bad error - save default
            self.__saveErrors('Could not read setting from ' +
                              self.__fullFileName + ': ' + str(exc) +
                              'Overwriting with the default settings...')
            self.flush()
            return

        for item, val in diskValues.items():
            if item in self.__values:
                if type(self.__values[item]) != type(val):
                    readErrors.append("Settings '" + item +
                                      "' type from the disk file " +
                                      self.__fullFileName +
                                      ' does not match the expected one. '
                                      'The default value is used.')
                else:
                    self.__values[item] = val
            else:
                readErrors.append('Disk file ' + self.__fullFileName +
                                  " contains extra value '" + item +
                                  "'. It will be lost.")

        # If format is bad then overwrite the file
        if readErrors:
            self.__saveErrors("\n".join(readErrors))
            self.flush()

        SearchEnvironment.setLimit(self, self.__values['maxSearchEntries'])
        FileSystemEnvironment.setLimit(self, self.__values['maxRecentFiles'])
Example #12
0
    def __init__(self):
        IPlugin.__init__(self)
        QObject.__init__(self)

        self.ide = IDEAccess(self)