def test_read_ninja_project(self):

        path = self.tmpdir
        project = 'This is My Project'
        structure = dict(foo='bar')

        structure = read_ninja_project(path)
        self.assertEqual(structure, dict())

        structure = dict(foo='bar')
        create_ninja_project(path, project, structure)
        structure = read_ninja_project(path)
        assert structure['foo'] == 'bar'
Пример #2
0
    def test_read_ninja_project(self):

        path = self.tmpdir
        project = 'This is My Project'
        structure = dict(foo='bar')

        structure = read_ninja_project(path)
        self.assertEquals(structure, dict())

        structure = dict(foo='bar')
        create_ninja_project(path, project, structure)
        structure = read_ninja_project(path)
        assert structure['foo'] == 'bar'
Пример #3
0
    def __init__(self, path):
        super(NProject, self).__init__()
        project = json_manager.read_ninja_project(path)

        self.path = path
        self._name = project.get('name', '')
        if not self._name:
            self._name = file_manager.get_basename(path)
        self.project_type = project.get('project-type', '')
        self.description = project.get('description', '')
        if self.description == '':
            self.description = translations.TR_NO_DESCRIPTION
        self.url = project.get('url', '')
        self.license = project.get('license', '')
        self.main_file = project.get('mainFile', '')
        self.pre_exec_script = project.get('preExecScript', '')
        self.post_exec_script = project.get('postExecScript', '')
        self.indentation = project.get('indentation', settings.INDENT)
        self.use_tabs = project.get('use-tabs', settings.USE_TABS)
        self.extensions = project.get('supported-extensions',
                                      settings.SUPPORTED_EXTENSIONS)
        self.python_exec = project.get('pythonExec', settings.PYTHON_EXEC)
        self.python_path = project.get('PYTHONPATH', '')
        self.additional_builtins = project.get('additional_builtins', [])
        self.program_params = project.get('programParams', '')
        self.venv = project.get('venv', '')
        self.related_projects = project.get('relatedProjects', [])
        self.added_to_console = False
        # TODO: handle this
        self.is_current = True
        # Model is a QFileSystemModel to be set on runtime
        self.__model = None
Пример #4
0
    def save_recent_projects(self, folder):
        recent_project_list = QSettings(
            resources.SETTINGS_PATH,
            QSettings.IniFormat).value('recentProjects', {})
        #if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get('name', '')
        description = projectProperties.get('description', '')

        if name == '':
            name = file_manager.get_basename(folder)

        if description == '':
            description = _translate("_s_ExplorerContainer", 'no description available')

        if folder in recent_project_list:
            properties = recent_project_list[folder]
            properties["lastopen"] = QDateTime.currentDateTime()
            properties["name"] = name
            properties["description"] = description
            recent_project_list[folder] = properties
        else:
            recent_project_list[folder] = {
                "name": name,
                "description": description,
                "isFavorite": False, "lastopen": QDateTime.currentDateTime()}
            #if the length of the project list it's high that 10 then delete
            #the most old
            #TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open()]
        QSettings(resources.SETTINGS_PATH, QSettings.IniFormat).setValue(
            'recentProjects', recent_project_list)
Пример #5
0
    def save_recent_projects(self, folder):
        recent_project_list = QSettings().value('recentProjects', {}).toMap()
        #if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get('name', '')
        description = projectProperties.get('description', '')

        if name == '':
            name = file_manager.get_basename(folder)

        if description == '':
            description = self.tr('no description available')

        if QString(folder) in recent_project_list:
            properties = recent_project_list[QString(folder)].toMap()
            properties[QString("lastopen")] = QDateTime.currentDateTime()
            properties[QString("name")] = name
            properties[QString("description")] = description
            recent_project_list[QString(folder)] = properties
        else:
            recent_project_list[QString(folder)] = {
                "name": name,
                "description": description,
                "isFavorite": False,
                "lastopen": QDateTime.currentDateTime()
            }
            #if the length of the project list it's high that 10 then delete
            #the most old
            #TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open()]
        QSettings().setValue('recentProjects', recent_project_list)
Пример #6
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(Qt.darkGray))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.preExecScript = project.get('preExecScript', '')
     self.postExecScript = project.get('postExecScript', '')
     self.extensions = project.get('supported-extensions',
                                   settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.addedToConsole = False
Пример #7
0
    def locate_code(self):
        explorerContainer = explorer_container.ExplorerContainer()
        projects_obj = explorerContainer.get_opened_projects()
        projects = [p.path for p in projects_obj]
        if not projects:
            return
        queue = Queue.Queue()
        for project in projects:
            queue.put(project)
        while not self._cancel and not queue.empty():
            current_dir = QDir(queue.get())
            #Skip not readable dirs!
            if not current_dir.isReadable():
                continue

            project_data = project = json_manager.read_ninja_project(
                current_dir.path())
            extensions = project_data.get('supported-extensions',
                settings.SUPPORTED_EXTENSIONS)

            queue_folders = Queue.Queue()
            queue_folders.put(current_dir)
            self.__locate_code_in_project(queue_folders, extensions)
        self.dirty = True
        self.get_locations()
Пример #8
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(QColor(255, 165, 0)))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.preExecScript = project.get('preExecScript', '')
     self.postExecScript = project.get('postExecScript', '')
     self.indentation = project.get('indentation', settings.INDENT)
     self.useTabs = project.get('use-tabs', settings.USE_TABS)
     self.extensions = project.get('supported-extensions',
         settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.PYTHONPATH = project.get('PYTHONPATH', '')
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.related_projects = project.get('relatedProjects', [])
     self.update_paths()
     self.addedToConsole = False
Пример #9
0
    def save_recent_projects(self, folder):
        settings = IDE.data_settings()
        recent_project_list = settings.value('recentProjects', {})
        # if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get('name', '')
        description = projectProperties.get('description', '')

        if name == '':
            name = file_manager.get_basename(folder)

        if description == '':
            description = translations.TR_NO_DESCRIPTION

        if folder in recent_project_list:
            properties = recent_project_list[folder]
            properties["lastopen"] = QDateTime.currentDateTime()
            properties["name"] = name
            properties["description"] = description
            recent_project_list[folder] = properties
        else:
            recent_project_list[folder] = {
                "name": name,
                "description": description,
                "isFavorite": False,
                "lastopen": QDateTime.currentDateTime()
            }
            # if the length of the project list it's high that 10 then delete
            # the most old
            # TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open(
                    recent_project_list)]
        settings.setValue('recentProjects', recent_project_list)
Пример #10
0
    def execute_project(self):
        """Execute the project marked as Main Project."""
        mainFile = self.ide.explorer.get_project_main_file()
        if not mainFile and self.ide.explorer._treeProjects and \
          self.ide.explorer._treeProjects._actualProject:
            self.ide.explorer._treeProjects.open_project_properties()
        elif mainFile:
            self.save_project()
            path = self.ide.explorer.get_actual_project()
            #emit a signal for plugin!
            self.emit(SIGNAL("projectExecuted(QString)"), path)

            # load our jutsus!
            project = json_manager.read_ninja_project(path)
            python_exec = project.get('venv', False)
            if not python_exec:
                python_exec = project.get('pythonPath', 'python')
            PYTHONPATH = project.get('PYTHONPATH', None)
            params = project.get('programParams', '')
            preExec = project.get('preExecScript', '')
            postExec = project.get('postExecScript', '')
            mainFile = file_manager.create_path(path, mainFile)
            self.ide.misc.run_application(mainFile, pythonPath=python_exec,
                PYTHONPATH=PYTHONPATH,
                programParams=params, preExec=preExec, postExec=postExec)
Пример #11
0
    def save_recent_projects(self, folder):
        settings = IDE.data_settings()
        recent_project_list = settings.value('recentProjects', {})
        #if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get('name', '')
        description = projectProperties.get('description', '')

        if name == '':
            name = file_manager.get_basename(folder)

        if description == '':
            description = translations.TR_NO_DESCRIPTION

        if folder in recent_project_list:
            properties = recent_project_list[folder]
            properties["lastopen"] = QDateTime.currentDateTime()
            properties["name"] = name
            properties["description"] = description
            recent_project_list[folder] = properties
        else:
            recent_project_list[folder] = {
                "name": name,
                "description": description,
                "isFavorite": False, "lastopen": QDateTime.currentDateTime()}
            #if the length of the project list it's high that 10 then delete
            #the most old
            #TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open(
                    recent_project_list)]
        settings.setValue('recentProjects', recent_project_list)
Пример #12
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(Qt.darkGray))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.preExecScript = project.get('preExecScript', '')
     self.postExecScript = project.get('postExecScript', '')
     self.extensions = project.get('supported-extensions',
         settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.addedToConsole = False
Пример #13
0
    def locate_code(self):
        explorerContainer = explorer_container.ExplorerContainer()
        projects_obj = explorerContainer.get_opened_projects()
        projects = [p.path for p in projects_obj]
        if not projects:
            return
        queue = Queue.Queue()
        for project in projects:
            queue.put(project)
        while not self._cancel and not queue.empty():
            current_dir = QDir(queue.get())
            #Skip not readable dirs!
            if not current_dir.isReadable():
                continue

            project_data = project = json_manager.read_ninja_project(
                unicode(current_dir.path()))
            extensions = project_data.get('supported-extensions',
                                          settings.SUPPORTED_EXTENSIONS)

            queue_folders = Queue.Queue()
            queue_folders.put(current_dir)
            self.__locate_code_in_project(queue_folders, extensions)
        self.dirty = True
        self.get_locations()
Пример #14
0
 def __init__(self, parent, _name, path):
     QTreeWidgetItem.__init__(self, parent)
     self._parent = parent
     self.setText(0, _name)
     self.path = path
     self.isFolder = True
     self.setForeground(0, QBrush(QColor(255, 165, 0)))
     project = json_manager.read_ninja_project(path)
     self.name = project.get('name', '')
     if self.name == '':
         self.name = _name
     self.setText(0, self.name)
     self.projectType = project.get('project-type', '')
     self.description = project.get('description', '')
     self.url = project.get('url', '')
     self.license = project.get('license', '')
     self.mainFile = project.get('mainFile', '')
     self.preExecScript = project.get('preExecScript', '')
     self.postExecScript = project.get('postExecScript', '')
     self.indentation = project.get('indentation', settings.INDENT)
     self.useTabs = project.get('use-tabs', settings.USE_TABS)
     self.extensions = project.get('supported-extensions',
                                   settings.SUPPORTED_EXTENSIONS)
     self.pythonPath = project.get('pythonPath', settings.PYTHON_PATH)
     self.PYTHONPATH = project.get('PYTHONPATH', '')
     self.programParams = project.get('programParams', '')
     self.venv = project.get('venv', '')
     self.related_projects = project.get('relatedProjects', [])
     self.update_paths()
     self.addedToConsole = False
Пример #15
0
    def save_recent_projects(self, folder):
        recent_project_list = QSettings().value('recentProjects', {}).toMap()
        #if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get('name', '')
        description = projectProperties.get('description', '')

        if name == '':
            name = file_manager.get_basename(folder)

        if description == '':
            description = self.tr('no description available')

        if QString(folder) in recent_project_list:
            properties = recent_project_list[QString(folder)].toMap()
            properties[QString("lastopen")] = QDateTime.currentDateTime()
            properties[QString("name")] = name
            properties[QString("description")] = description
            recent_project_list[QString(folder)] = properties
        else:
            recent_project_list[QString(folder)] = {
                "name": name,
                "description": description,
                "isFavorite": False, "lastopen": QDateTime.currentDateTime()}
            #if the length of the project list it's high that 10 then delete
            #the most old
            #TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open()]
        QSettings().setValue('recentProjects', recent_project_list)
Пример #16
0
 def open_project_folder(self, folderName='', notIDEStart=True):
     if not self._treeProjects and notIDEStart:
         QMessageBox.information(self, self.tr("Projects Disabled"),
             self.tr("Project support has been disabled from Preferences"))
         return
     if not folderName:
         if settings.WORKSPACE:
             directory = settings.WORKSPACE
         else:
             directory = self._workingDirectory
         folderName = unicode(QFileDialog.getExistingDirectory(self,
             self.tr("Open Project Directory"), directory))
     try:
         if not folderName:
             return
         self._workingDirectory = folderName
         if not self._treeProjects.is_open(folderName):
             project = json_manager.read_ninja_project(folderName)
             extensions = project.get('supported-extensions',
                 settings.SUPPORTED_EXTENSIONS)
             if extensions != settings.SUPPORTED_EXTENSIONS:
                 structure = file_manager.open_project_with_extensions(
                     folderName, extensions)
             else:
                 structure = file_manager.open_project(folderName)
             self._treeProjects.load_project(structure, folderName)
             self.save_recent_projects(folderName)
         else:
             self._treeProjects._set_current_project(folderName)
         self.emit(SIGNAL("projectOpened(QString)"), folderName)
     except Exception, reason:
         logger.error('open_project_folder: %s', reason)
         if not notIDEStart:
             QMessageBox.information(self, self.tr("Incorrect Project"),
                 self.tr("The project could not be loaded!"))
Пример #17
0
 def open_project_folder(self, folderName='', notIDEStart=True):
     if not self._treeProjects and notIDEStart:
         QMessageBox.information(self, self.tr("Projects Disabled"),
             self.tr("Project support has been disabled from Preferences"))
         return
     if not folderName:
         if settings.WORKSPACE:
             directory = settings.WORKSPACE
         else:
             directory = self._workingDirectory
         folderName = unicode(QFileDialog.getExistingDirectory(self,
             self.tr("Open Project Directory"), directory))
     try:
         if not folderName:
             return
         self._workingDirectory = folderName
         if not self._treeProjects.is_open(folderName):
             project = json_manager.read_ninja_project(folderName)
             extensions = project.get('supported-extensions',
                 settings.SUPPORTED_EXTENSIONS)
             if extensions != settings.SUPPORTED_EXTENSIONS:
                 structure = file_manager.open_project_with_extensions(
                     folderName, extensions)
             else:
                 structure = file_manager.open_project(folderName)
             self._treeProjects.load_project(structure, folderName)
             self.save_recent_projects(folderName)
         else:
             self._treeProjects._set_current_project(folderName)
         self.emit(SIGNAL("projectOpened(QString)"), folderName)
     except Exception, reason:
         logger.error('open_project_folder: %s', reason)
         if not notIDEStart:
             QMessageBox.information(self, self.tr("Incorrect Project"),
                 self.tr("The project could not be loaded!"))
Пример #18
0
    def execute_project(self):
        """Execute the project marked as Main Project."""
        mainFile = self.ide.explorer.get_project_main_file()
        if not mainFile and self.ide.explorer._treeProjects and \
          self.ide.explorer._treeProjects._actualProject:
            self.ide.explorer._treeProjects.open_project_properties()
        elif mainFile:
            self.save_project()
            path = self.ide.explorer.get_actual_project()
            #emit a signal for plugin!
            self.emit(SIGNAL("projectExecuted(QString)"), path)

            # load our jutsus!
            project = json_manager.read_ninja_project(path)
            python_exec = project.get('venv', False)
            if not python_exec:
                python_exec = project.get('pythonPath', 'python')
            PYTHONPATH = project.get('PYTHONPATH', None)
            params = project.get('programParams', '')
            preExec = project.get('preExecScript', '')
            postExec = project.get('postExecScript', '')
            mainFile = file_manager.create_path(path, mainFile)
            self.ide.misc.run_application(mainFile,
                                          pythonPath=python_exec,
                                          PYTHONPATH=PYTHONPATH,
                                          programParams=params,
                                          preExec=preExec,
                                          postExec=postExec)
Пример #19
0
    def __init__(self, path):
        super(NProject, self).__init__()
        project = json_manager.read_ninja_project(path)

        self.path = path
        self._name = project.get('name', '')
        if self._name == '':
            self._name = file_manager.get_basename(path)
        self.project_type = project.get('project-type', '')
        self.description = project.get('description', '')
        if self.description == '':
            self.description = translations.TR_NO_DESCRIPTION
        self.url = project.get('url', '')
        self.license = project.get('license', '')
        self.main_file = project.get('mainFile', '')
        self.pre_exec_script = project.get('preExecScript', '')
        self.post_exec_script = project.get('postExecScript', '')
        self.indentation = project.get('indentation', settings.INDENT)
        self.use_tabs = project.get('use-tabs', settings.USE_TABS)
        self.extensions = project.get('supported-extensions',
            settings.SUPPORTED_EXTENSIONS)
        self.python_exec = project.get('pythonExec', settings.PYTHON_EXEC)
        self.python_path = project.get('PYTHONPATH', '')
        self.additional_builtins = project.get('additional_builtins', [])
        self.program_params = project.get('programParams', '')
        self.venv = project.get('venv', '')
        self.related_projects = project.get('relatedProjects', [])
        self.added_to_console = False
        self.is_current = False
        #Model is a QFileSystemModel to be set on runtime
        self.__model = None
Пример #20
0
    def save_recent_projects(self, folder):
        recent_project_list = QSettings().value("recentProjects", {})
        # if already exist on the list update the date time
        projectProperties = json_manager.read_ninja_project(folder)
        name = projectProperties.get("name", "")
        description = projectProperties.get("description", "")

        if name == "":
            name = file_manager.get_basename(folder)

        if description == "":
            description = self.tr("no description available")

        if folder in recent_project_list:
            properties = recent_project_list[folder]
            properties["lastopen"] = QDateTime.currentDateTime()
            properties["name"] = name
            properties["description"] = description
            recent_project_list[folder] = properties
        else:
            recent_project_list[folder] = {
                "name": name,
                "description": description,
                "isFavorite": False,
                "lastopen": QDateTime.currentDateTime(),
            }
            # if the length of the project list it's high that 10 then delete
            # the most old
            # TODO: add the length of available projects to setting
            if len(recent_project_list) > 10:
                del recent_project_list[self.find_most_old_open()]
        QSettings().setValue("recentProjects", recent_project_list)
    def test_read_ninja_bad_file_project(self):

        path = self.tmpdir
        frula_file = os.path.join(path, 'frula.nja')
        with open(frula_file, 'w') as fp:
            fp.write('frula\n')

        structure = read_ninja_project(path)
        assert structure == dict()
Пример #22
0
    def test_read_ninja_bad_file_project(self):

        path = self.tmpdir
        frula_file = os.path.join(path, 'frula.nja')
        with open(frula_file, 'w') as fp:
            fp.write('frula\n')

        structure = read_ninja_project(path)
        assert structure == dict()
Пример #23
0
    def change_log_folder(self):
        folder = self.explorer_s.get_tree_projects()._get_project_root().path
        plugin = json_manager.read_ninja_project(folder)

        self.logFolder = QFileDialog.getExistingDirectory(
            self, self.tr("Select Log Folder"), plugin["logfolder"])

        if self.logFolder != "":
            plugin["logfolder"] = self.logFolder
            json_manager.create_ninja_project(folder, plugin["name"], plugin)
Пример #24
0
    def change_log_folder(self):
        folder = self.explorer_s.get_tree_projects()._get_project_root().path
        plugin = json_manager.read_ninja_project(folder)

        self.logFolder = QFileDialog.getExistingDirectory(
            self, self.tr("Select Log Folder"), plugin["logfolder"])

        if self.logFolder != "":
            plugin["logfolder"] = self.logFolder
            json_manager.create_ninja_project(folder, plugin["name"], plugin)
Пример #25
0
    def _thread_open_project(self):
        try:
            project = json_manager.read_ninja_project(self._folder_path)
            extensions = project.get("supported-extensions", settings.SUPPORTED_EXTENSIONS)
            if extensions != settings.SUPPORTED_EXTENSIONS:
                structure = file_manager.open_project_with_extensions(self._folder_path, extensions)
            else:
                structure = file_manager.open_project(self._folder_path)

            self.emit(SIGNAL("folderDataAcquired(PyQt_PyObject)"), (self._folder_path, structure))
        except:
            self.emit(SIGNAL("folderDataAcquired(PyQt_PyObject)"), (self._folder_path, None))
Пример #26
0
    def _thread_open_project(self):
        try:
            project = json_manager.read_ninja_project(self._folder_path)
            extensions = project.get('supported-extensions',
                                     settings.SUPPORTED_EXTENSIONS)
            if extensions != settings.SUPPORTED_EXTENSIONS:
                structure = file_manager.open_project_with_extensions(
                    self._folder_path, extensions)
            else:
                structure = file_manager.open_project(self._folder_path)

            self.folderDataAcquired.emit((self._folder_path, structure))
        except:
            self.folderDataAcquired.emit((self._folder_path, None))
Пример #27
0
 def execute_project(self):
     mainFile = self.ide.explorer.get_project_main_file()
     if not mainFile and self.ide.explorer._treeProjects and \
       self.ide.explorer._treeProjects._actualProject:
         self.ide.explorer._treeProjects.open_project_properties()
     elif mainFile:
         self.save_project()
         #emit a signal for plugin!
         self.emit(SIGNAL("projectExecuted(QString)"), mainFile)
         path = self.ide.explorer.get_actual_project()
         project = json_manager.read_ninja_project(path)
         venv = project.get('venv', False)
         params = project.get('programParams', '')
         mainFile = file_manager.create_path(path, mainFile)
         self.ide.misc.run_application(mainFile, pythonPath=venv,
             programParams=params)
Пример #28
0
 def execute_project(self):
     mainFile = self.ide.explorer.get_project_main_file()
     if not mainFile and self.ide.explorer._treeProjects and \
       self.ide.explorer._treeProjects._actualProject:
         self.ide.explorer._treeProjects.open_project_properties()
     elif mainFile:
         self.save_project()
         path = self.ide.explorer.get_actual_project()
         #emit a signal for plugin!
         self.emit(SIGNAL("projectExecuted(QString)"), path)
         project = json_manager.read_ninja_project(path)
         venv = project.get('venv', False)
         params = project.get('programParams', '')
         mainFile = file_manager.create_path(path, mainFile)
         self.ide.misc.run_application(mainFile, pythonPath=venv,
             programParams=params)
Пример #29
0
 def _thread_open_project(self, folderName):
     self._treeProjects.mute_signals = True
     try:
         project = json_manager.read_ninja_project(folderName)
         extensions = project.get('supported-extensions',
                                  settings.SUPPORTED_EXTENSIONS)
         if extensions != settings.SUPPORTED_EXTENSIONS:
             structure = file_manager.open_project_with_extensions(
                 folderName, extensions)
         else:
             structure = file_manager.open_project(folderName)
         self._thread_execution[folderName].storage_values = (structure,
                                                              folderName)
         self._thread_execution[folderName].signal_return = folderName
     except Exception, reason:
         logger.error('open_project_folder: %s', reason)
         self._treeProjects.remove_loading_icon(folderName)
Пример #30
0
 def _thread_open_project(self, folderName):
     self._treeProjects.mute_signals = True
     try:
         project = json_manager.read_ninja_project(folderName)
         extensions = project.get('supported-extensions',
             settings.SUPPORTED_EXTENSIONS)
         if extensions != settings.SUPPORTED_EXTENSIONS:
             structure = file_manager.open_project_with_extensions(
                 folderName, extensions)
         else:
             structure = file_manager.open_project(folderName)
         self._thread_execution[folderName].storage_values = (
             structure, folderName)
         self._thread_execution[folderName].signal_return = folderName
     except Exception, reason:
         logger.error('open_project_folder: %s', reason)
         self._treeProjects.remove_loading_icon(folderName)
Пример #31
0
 def open_project_folder(self, folderName='', notIDEStart=True):
     self._treeProjects.mute_signals = True
     if not self._treeProjects and notIDEStart:
         QMessageBox.information(self, self.tr("Projects Disabled"),
             self.tr("Project support has been disabled from Preferences"))
         return
     if not folderName:
         if settings.WORKSPACE:
             directory = settings.WORKSPACE
         else:
             directory = os.path.expanduser("~")
             current_project = self.get_actual_project()
             mainContainer = main_container.MainContainer()
             editorWidget = mainContainer.get_actual_editor()
             if current_project is not None:
                 directory = current_project
             elif editorWidget is not None and editorWidget.ID:
                 directory = file_manager.get_folder(editorWidget.ID)
         folderName = unicode(QFileDialog.getExistingDirectory(self,
             self.tr("Open Project Directory"), directory))
     try:
         if not folderName:
             return
         if not self._treeProjects.is_open(folderName):
             project = json_manager.read_ninja_project(folderName)
             extensions = project.get('supported-extensions',
                 settings.SUPPORTED_EXTENSIONS)
             if extensions != settings.SUPPORTED_EXTENSIONS:
                 structure = file_manager.open_project_with_extensions(
                     folderName, extensions)
             else:
                 structure = file_manager.open_project(folderName)
             self._treeProjects.load_project(structure, folderName)
             self.save_recent_projects(folderName)
         else:
             self._treeProjects._set_current_project(folderName)
         self.emit(SIGNAL("projectOpened(QString)"), folderName)
     except Exception, reason:
         logger.error('open_project_folder: %s', reason)
         if not notIDEStart:
             QMessageBox.information(self, self.tr("Incorrect Project"),
                 self.tr("The project could not be loaded!"))