コード例 #1
0
    def addBraCustomInfoToCppProject_(self, cppProject):
        '''
        Add custom information to the Visual Studio project (additional libraries, preprocessor definitions, etc.)
        for the annotations to compile.
        It creates a backup to be restored when the "Bug-reproducer Assistant" project is removed. 
        '''
        cppProjectBkp = project.getCppProjectFileBackup(cppProject)
        shutil.copy(cppProject, cppProjectBkp)
        
        installationFolder = config.installationConfig().getInstallationFolder()

        additionalDependencies = ['bug_reproducer_assistant.lib', 'jsoncpp.lib']
        preprocessorDefinitions = ['BUG_REPRODUCER_ASSISTANT_ENABLED']
        BOOST_LIB_FOLDER = config.instance().boostLibraryFolder
        LIBRARIES_LIB_PREFIX = os.path.join(installationFolder, 'C++', 'libs')
        
        additionalLibraryDirectoriesDebug = [BOOST_LIB_FOLDER, os.path.join(LIBRARIES_LIB_PREFIX, 'Debug')] 
        additionalLibraryDirectoriesRelease = [BOOST_LIB_FOLDER, os.path.join(LIBRARIES_LIB_PREFIX, 'Release')]
        
        additionalIncludeDirectories = [config.instance().boostIncludeFolder, os.path.join(installationFolder, 'C++', 'include')]
        
        myBraCustomProjectInfo = parse_project.BraCustomProjectInfo(additionalDependencies, preprocessorDefinitions, additionalLibraryDirectoriesDebug, additionalLibraryDirectoriesRelease, additionalIncludeDirectories)

        myProjectParser = parse_project.ProjectParser(cppProjectBkp, cppProject, 'vcxproj', myBraCustomProjectInfo)
        myProjectParser.parseProject()
コード例 #2
0
    def enableLanguageDependentControls(self, enable = True):
        '''
        Enable controls related to the programming language.
        '''
        if self.isEditMode_():
            #Language and main file are immutable, because they're
            #the core of the project annotations.
            #If user wants to change them,
            #she should create another project.
            self.languageComboBox.setEnabled(False)
            self.mainFileEditBox.setEnabled(False)
        else:
            myConfig = config.instance()
            self.mainFileEditBox.setEnabled(enable)
            self.mainFileSelectionButton.setEnabled(enable)
            language = self.getSelectedLanguage_()
            LANG = ProgramExecution.Languages
            exeCommand = myConfig.cpp_defaultExeCommand if language == LANG.C_PLUS_PLUS else myConfig.python_defaultExeCommand  
            self.exeCommandTextEdit.setText(exeCommand)

        self.mainFunctionComboBox.setEnabled(enable)
        
        if self.getSelectedLanguage_() == ProgramExecution.Languages.C_PLUS_PLUS:
            self.enableVisualStudioDependentControls(enable)
        else:
            self.enableVisualStudioDependentControls(enable = False)
コード例 #3
0
 def accept(self):
     '''
     User accept. If data is valid, save the options with the help of config.ConfigSerializer.
     '''
     ok = self.validateOptions_()
     if not ok:
         return
     myConfig = config.instance()
     myConfig.defaultLanguage = str(self.defaultLanguageComboBox.currentText())
     #C++
     myConfig.cpp_defaultRootFolder = str(self.cpp_defaultRootFolderEditBox.toPlainText())
     myConfig.defaultCompilingCommand = str(self.defaultCompilingCommandEditBox.toPlainText())
     myConfig.cpp_defaultExeCommand = str(self.cpp_defaultExeCommandEditBox.toPlainText())        
     #Visual Studio
     myConfig.visualStudioExe = str(self.visualStudioExeEditBox.toPlainText())
     myConfig.solutionExtensions = str(self.solutionExtensionsEditBox.toPlainText())
     myConfig.projectExtensions = str(self.projectExtensionsEditBox.toPlainText())        
     #Boost
     myConfig.boostIncludeFolder = str(self.boostIncludeFolderEditBox.toPlainText())
     myConfig.boostLibraryFolder = str(self.boostLibraryFolderEditBox.toPlainText())
     #Python
     myConfig.python_defaultRootFolder = str(self.python_defaultRootFolderEditBox.toPlainText())        
     myConfig.python_defaultExeCommand = str(self.python_defaultExeCommandEditBox.toPlainText())
         
     config.ConfigSerializer.saveConfig()
     QDialog.accept(self)
コード例 #4
0
 def request_access(self,
                    folders,
                    questions=None,
                    reason=None,
                    send_notification=False):
     if questions:
         self.questions = questions
     if reason:
         self.reason = reason
     all_folders = self.normalize_folders()
     requested_folder_ids = [folder.folder_id for folder in folders]
     for i, folder in enumerate(all_folders):
         is_requested = folder.folder_id in requested_folder_ids
         # Set newly-requested folders while leaving previously requested
         # folders as-is.
         if is_requested:
             all_folders[i].has_requested = is_requested
     self.folders = all_folders
     self.put()
     if send_notification:
         build_server_config = config.instance()
         email_config = build_server_config['access_requests']['emails']
         req = {
             'email': self.email,
             'form': questions,
         }
         from . import access_requests
         access_requests.send_email_to_admins(req,
                                              email_config=email_config)
コード例 #5
0
    def loadControls(self):
        '''
        Initial load of this window's controls.
        '''
        self.enableVisualStudioDependentControls(enable = False)
        self.enableLanguageDependentControls(enable = False)
        if self.isEditMode_():
            projectName = self.projectToEdit_.getName() 
            projectsLocation = self.projectToEdit_.getFolder() 
            exeCommand = self.projectToEdit_.getExeCommand()
            language = self.projectToEdit_.getLanguage()
        else:
            myConfig = config.instance()
            projectName = ""
            projectsLocation = myConfig.getProjectsFolder()
            language = myConfig.defaultLanguage
            LANG = ProgramExecution.Languages
            exeCommand = myConfig.cpp_defaultExeCommand if language == LANG.C_PLUS_PLUS else myConfig.python_defaultExeCommand  
            
        self.projectNameTextEdit.setText(projectName)
        if self.isEditMode_():
            self.projectNameTextEdit.setEnabled(False)
        self.projectsLocationEditBox.setText(projectsLocation)
        self.exeCommandTextEdit.setText(exeCommand)

        languageIndex = 0 if not language else self.languageComboBox.findText(language)
        self.languageComboBox.setCurrentIndex(languageIndex)
        if languageIndex >= 0:
            self.languageHasBeenSelected_()          
コード例 #6
0
ファイル: mongodb.py プロジェクト: jasonbaker/shrapnel
    def do(self, *args):
        db = config.instance("{0}.{1}".format(self.provider, self.key))
        results = []
        exc = None

        try:
            for fn in args:
                for i in xrange(0, 2):
                    try:
                        results.append(fn(db))
                    except (pymongo.errors.AutoReconnect), e:
                        exc = e
                    else:
                        exc = None
                        break

                if exc:
                    raise exc

        finally:
            db.connection.end_request()

        if len(args) == 1:
            return results[0]

        return results
コード例 #7
0
    def setDefaultsToVisualStudioDependentControls(self):
        '''
        Set default values for VS-related controls.
        For C++ projects, get them from the configuration.
        For Python, set null values (the controls are disabled anyway).
        '''
        self.cppProjectEditBox.setText("")
        lang = self.getSelectedLanguage_()
        
        if self.isEditMode_():
            solutionFile = self.projectToEdit_.getSolutionFile()
            compilingCommand = self.projectToEdit_.getCompilingCommand()
            cppProject = self.projectToEdit_.getCppProject()
        else:
            #No Python, but during loading time it may not be set
            if lang == ProgramExecution.Languages.C_PLUS_PLUS:
                myConfig = config.instance()
                solutionFile = myConfig.cpp_defaultRootFolder
                compilingCommand = myConfig.defaultCompilingCommand
                cppProject = myConfig.cpp_defaultRootFolder
            else:
                solutionFile = ""
                compilingCommand = ""
                cppProject = ""

        self.solutionEditBox.setText(solutionFile)
        self.compilingCommandEditBox.setText(compilingCommand)
        self.cppProjectEditBox.setText(cppProject)
コード例 #8
0
    def selectFile(self):
        '''
        User has selected "Select File" button.
        Open a file dialog, filtering according to the source extension.
        '''
        myConfig = config.instance()
        language = self.currentProject_.getLanguage()
        selectedFile = QFileDialog.getOpenFileName(
            self, 'Seleccione archivo fuente',
            str(self.fileNameTextEdit.toPlainText()),
            _getSourceFileFilter(language))
        if selectedFile:
            self.fileNameTextEdit.setText(selectedFile)

        #TODO GERVA: capturar evento de editar texto
        #y setear True userHasEditedHeader
        if not self.userHasEditedHeader_:
            defaultPath = self.getDefaultSourcesFolder_()
            fileName = str(self.fileNameTextEdit.toPlainText())

            #Normalize paths, to format the path to include
            defaultPath = normalizePathSeparators(defaultPath)
            fileName = normalizePathSeparators(fileName)
            if fileName.startswith(defaultPath):
                headerToInclude = fileName[len(defaultPath):]
                if headerToInclude.startswith('/'):
                    headerToInclude = headerToInclude[1:]
                if language == ProgramExecution.Languages.PYTHON:
                    #Get rid of extension
                    dotIndex = headerToInclude.rfind('.')
                    if dotIndex >= 0:
                        headerToInclude = headerToInclude[:dotIndex]
                    headerToInclude = headerToInclude.replace('/', '.')
                self.headerToIncludeTextEdit.setText(headerToInclude)
コード例 #9
0
    def enableLanguageDependentControls(self, enable=True):
        '''
        Enable controls related to the programming language.
        '''
        if self.isEditMode_():
            #Language and main file are immutable, because they're
            #the core of the project annotations.
            #If user wants to change them,
            #she should create another project.
            self.languageComboBox.setEnabled(False)
            self.mainFileEditBox.setEnabled(False)
        else:
            myConfig = config.instance()
            self.mainFileEditBox.setEnabled(enable)
            self.mainFileSelectionButton.setEnabled(enable)
            language = self.getSelectedLanguage_()
            LANG = ProgramExecution.Languages
            exeCommand = myConfig.cpp_defaultExeCommand if language == LANG.C_PLUS_PLUS else myConfig.python_defaultExeCommand
            self.exeCommandTextEdit.setText(exeCommand)

        self.mainFunctionComboBox.setEnabled(enable)

        if self.getSelectedLanguage_(
        ) == ProgramExecution.Languages.C_PLUS_PLUS:
            self.enableVisualStudioDependentControls(enable)
        else:
            self.enableVisualStudioDependentControls(enable=False)
コード例 #10
0
 def loadControls(self):
     '''
     Initial load of this window's controls.
     '''
     myConfig = config.instance()
     languageIndex = 0 if not myConfig.defaultLanguage else self.defaultLanguageComboBox.findText(
         myConfig.defaultLanguage)
     self.defaultLanguageComboBox.setCurrentIndex(0)
     self.cpp_defaultRootFolderEditBox.setText(
         myConfig.cpp_defaultRootFolder)
     self.python_defaultRootFolderEditBox.setText(
         myConfig.python_defaultRootFolder)
     self.defaultCompilingCommandEditBox.setText(
         myConfig.defaultCompilingCommand)
     self.cpp_defaultExeCommandEditBox.setText(
         myConfig.cpp_defaultExeCommand)
     self.python_defaultExeCommandEditBox.setText(
         myConfig.python_defaultExeCommand)
     #Boost
     self.boostIncludeFolderEditBox.setText(myConfig.boostIncludeFolder)
     self.boostLibraryFolderEditBox.setText(myConfig.boostLibraryFolder)
     #Visual Studio controls
     self.visualStudioExeEditBox.setText(myConfig.visualStudioExe)
     self.solutionExtensionsEditBox.setText(myConfig.solutionExtensions)
     self.projectExtensionsEditBox.setText(myConfig.projectExtensions)
コード例 #11
0
    def loadControls(self):
        '''
        Initial load of this window's controls.
        '''
        self.enableVisualStudioDependentControls(enable=False)
        self.enableLanguageDependentControls(enable=False)
        if self.isEditMode_():
            projectName = self.projectToEdit_.getName()
            projectsLocation = self.projectToEdit_.getFolder()
            exeCommand = self.projectToEdit_.getExeCommand()
            language = self.projectToEdit_.getLanguage()
        else:
            myConfig = config.instance()
            projectName = ""
            projectsLocation = myConfig.getProjectsFolder()
            language = myConfig.defaultLanguage
            LANG = ProgramExecution.Languages
            exeCommand = myConfig.cpp_defaultExeCommand if language == LANG.C_PLUS_PLUS else myConfig.python_defaultExeCommand

        self.projectNameTextEdit.setText(projectName)
        if self.isEditMode_():
            self.projectNameTextEdit.setEnabled(False)
        self.projectsLocationEditBox.setText(projectsLocation)
        self.exeCommandTextEdit.setText(exeCommand)

        languageIndex = 0 if not language else self.languageComboBox.findText(
            language)
        self.languageComboBox.setCurrentIndex(languageIndex)
        if languageIndex >= 0:
            self.languageHasBeenSelected_()
コード例 #12
0
    def setDefaultsToVisualStudioDependentControls(self):
        '''
        Set default values for VS-related controls.
        For C++ projects, get them from the configuration.
        For Python, set null values (the controls are disabled anyway).
        '''
        self.cppProjectEditBox.setText("")
        lang = self.getSelectedLanguage_()

        if self.isEditMode_():
            solutionFile = self.projectToEdit_.getSolutionFile()
            compilingCommand = self.projectToEdit_.getCompilingCommand()
            cppProject = self.projectToEdit_.getCppProject()
        else:
            #No Python, but during loading time it may not be set
            if lang == ProgramExecution.Languages.C_PLUS_PLUS:
                myConfig = config.instance()
                solutionFile = myConfig.cpp_defaultRootFolder
                compilingCommand = myConfig.defaultCompilingCommand
                cppProject = myConfig.cpp_defaultRootFolder
            else:
                solutionFile = ""
                compilingCommand = ""
                cppProject = ""

        self.solutionEditBox.setText(solutionFile)
        self.compilingCommandEditBox.setText(compilingCommand)
        self.cppProjectEditBox.setText(cppProject)
コード例 #13
0
 def selectSolution(self):
     '''
     User selects the Visual Studio solution.
     '''
     solutionExtensions = config.instance().solutionExtensions
     selectedFile = QFileDialog.getOpenFileName(self, 'Seleccione la solucion de Visual Studio', str(self.solutionEditBox.toPlainText()), solutionExtensions)
     if selectedFile:
         self.solutionEditBox.setText(selectedFile)
コード例 #14
0
 def validateCppProject_(self, projectFile, warnToUser = True):
     '''
     Validate Visual Studio project selected by the user.
     '''
     noPathMessage = 'La ruta del proyecto C++ es invalida. Por favor, seleccione una correcta.'
     projectExtensions = config.instance().projectExtensions
     badExtensionMessage = 'El archivo de la solucion no tiene una extension correcta (' + projectExtensions + '). Por favor, seleccione una solucion valida.'
     return self.validateFile_(self.cppProjectSelectionButton, projectFile, projectExtensions, noPathMessage, badExtensionMessage, warnToUser)
コード例 #15
0
 def selectCppProject(self):
     '''
     User selects the Visual Studio project.
     '''
     projectExtensions = config.instance().projectExtensions
     selectedFile = QFileDialog.getOpenFileName(self, 'Seleccione el proyecto de Visual Studio', str(self.cppProjectEditBox.toPlainText()), projectExtensions)
     if selectedFile:
         self.cppProjectEditBox.setText(selectedFile)
コード例 #16
0
 def validateCppProject_(self, projectFile, warnToUser=True):
     '''
     Validate Visual Studio project selected by the user.
     '''
     noPathMessage = 'La ruta del proyecto C++ es invalida. Por favor, seleccione una correcta.'
     projectExtensions = config.instance().projectExtensions
     badExtensionMessage = 'El archivo de la solucion no tiene una extension correcta (' + projectExtensions + '). Por favor, seleccione una solucion valida.'
     return self.validateFile_(self.cppProjectSelectionButton, projectFile,
                               projectExtensions, noPathMessage,
                               badExtensionMessage, warnToUser)
コード例 #17
0
 def selectSolution(self):
     '''
     User selects the Visual Studio solution.
     '''
     solutionExtensions = config.instance().solutionExtensions
     selectedFile = QFileDialog.getOpenFileName(
         self, 'Seleccione la solucion de Visual Studio',
         str(self.solutionEditBox.toPlainText()), solutionExtensions)
     if selectedFile:
         self.solutionEditBox.setText(selectedFile)
コード例 #18
0
 def selectCppProject(self):
     '''
     User selects the Visual Studio project.
     '''
     projectExtensions = config.instance().projectExtensions
     selectedFile = QFileDialog.getOpenFileName(
         self, 'Seleccione el proyecto de Visual Studio',
         str(self.cppProjectEditBox.toPlainText()), projectExtensions)
     if selectedFile:
         self.cppProjectEditBox.setText(selectedFile)
コード例 #19
0
    def addBraCustomInfoToCppProject_(self, cppProject):
        '''
        Add custom information to the Visual Studio project (additional libraries, preprocessor definitions, etc.)
        for the annotations to compile.
        It creates a backup to be restored when the "Bug-reproducer Assistant" project is removed. 
        '''
        cppProjectBkp = project.getCppProjectFileBackup(cppProject)
        shutil.copy(cppProject, cppProjectBkp)

        installationFolder = config.installationConfig().getInstallationFolder(
        )

        additionalDependencies = [
            'bug_reproducer_assistant.lib', 'jsoncpp.lib'
        ]
        preprocessorDefinitions = ['BUG_REPRODUCER_ASSISTANT_ENABLED']
        BOOST_LIB_FOLDER = config.instance().boostLibraryFolder
        LIBRARIES_LIB_PREFIX = os.path.join(installationFolder, 'C++', 'libs')

        additionalLibraryDirectoriesDebug = [
            BOOST_LIB_FOLDER,
            os.path.join(LIBRARIES_LIB_PREFIX, 'Debug')
        ]
        additionalLibraryDirectoriesRelease = [
            BOOST_LIB_FOLDER,
            os.path.join(LIBRARIES_LIB_PREFIX, 'Release')
        ]

        additionalIncludeDirectories = [
            config.instance().boostIncludeFolder,
            os.path.join(installationFolder, 'C++', 'include')
        ]

        myBraCustomProjectInfo = parse_project.BraCustomProjectInfo(
            additionalDependencies, preprocessorDefinitions,
            additionalLibraryDirectoriesDebug,
            additionalLibraryDirectoriesRelease, additionalIncludeDirectories)

        myProjectParser = parse_project.ProjectParser(cppProjectBkp,
                                                      cppProject, 'vcxproj',
                                                      myBraCustomProjectInfo)
        myProjectParser.parseProject()
コード例 #20
0
 def send_email_notification(self, request):
     build_server_config = config.instance()
     email_config = build_server_config['access_requests']['emails']
     user = PersistentUser.get(request.user.email)
     email = user.email
     kwargs = {
         'folders': user.folders,
     }
     from . import access_requests
     access_requests.send_email_to_existing_user(email, email_config,
                                                 kwargs)
     resp = GetUserResponse()
     return resp
コード例 #21
0
    def setDefaultsToLanguageDependentControls(self):
        '''
        Set default values for controls related to the programming language.
        '''
        if self.isEditMode_():
            mainFile = self.projectToEdit_.getMainFile()
            self.mainFileEditBox.setText(mainFile)
            self.loadMainFunctionComboBox_()
        else:
            lang = self.getSelectedLanguage_()
            conf = config.instance()
            mainFile = conf.cpp_defaultRootFolder if lang == ProgramExecution.Languages.C_PLUS_PLUS else conf.python_defaultRootFolder
            self.mainFileEditBox.setText(mainFile)

        self.setDefaultsToVisualStudioDependentControls()
コード例 #22
0
 def setDefaultsToLanguageDependentControls(self):
     '''
     Set default values for controls related to the programming language.
     '''
     if self.isEditMode_():
         mainFile = self.projectToEdit_.getMainFile()
         self.mainFileEditBox.setText(mainFile)
         self.loadMainFunctionComboBox_() 
     else:
         lang = self.getSelectedLanguage_()
         conf = config.instance()
         mainFile = conf.cpp_defaultRootFolder if lang == ProgramExecution.Languages.C_PLUS_PLUS else conf.python_defaultRootFolder
         self.mainFileEditBox.setText(mainFile)
     
     self.setDefaultsToVisualStudioDependentControls()
コード例 #23
0
 def loadControls(self):
     '''
     Initial load of this window's controls.
     '''
     myConfig = config.instance()
     languageIndex = 0 if not myConfig.defaultLanguage else self.defaultLanguageComboBox.findText(myConfig.defaultLanguage) 
     self.defaultLanguageComboBox.setCurrentIndex(0)
     self.cpp_defaultRootFolderEditBox.setText(myConfig.cpp_defaultRootFolder)
     self.python_defaultRootFolderEditBox.setText(myConfig.python_defaultRootFolder)
     self.defaultCompilingCommandEditBox.setText(myConfig.defaultCompilingCommand)
     self.cpp_defaultExeCommandEditBox.setText(myConfig.cpp_defaultExeCommand)
     self.python_defaultExeCommandEditBox.setText(myConfig.python_defaultExeCommand)
     #Boost
     self.boostIncludeFolderEditBox.setText(myConfig.boostIncludeFolder)
     self.boostLibraryFolderEditBox.setText(myConfig.boostLibraryFolder)
     #Visual Studio controls
     self.visualStudioExeEditBox.setText(myConfig.visualStudioExe)
     self.solutionExtensionsEditBox.setText(myConfig.solutionExtensions)
     self.projectExtensionsEditBox.setText(myConfig.projectExtensions)
コード例 #24
0
def replaceTags(strWithTags, mainFile, projectName, solutionPath,
                cppProjectFile):
    '''
    In a command string, replace special tags with the actual values.
    For instance: "[MAIN_FILE]" should be replaced by mainFile parameter.
    '''
    def getNameFromPath(aPath):
        theName = os.path.basename(aPath)
        #Skip extension
        theName = theName[:theName.find('.')]
        return theName

    if strWithTags.find(MAIN_FILE_MARK) >= 0:
        strWithTags = strWithTags.replace(MAIN_FILE_MARK, mainFile)
    if strWithTags.find(PROJECT_NAME_MARK) >= 0:
        strWithTags = strWithTags.replace(PROJECT_NAME_MARK, projectName)
    if strWithTags.find(SOLUTION_PATH_MARK) >= 0:
        strWithTags = strWithTags.replace(SOLUTION_PATH_MARK, solutionPath)
    if strWithTags.find(SOLUTION_FOLDER_MARK) >= 0:
        solutionFolder = os.path.dirname(solutionPath)
        strWithTags = strWithTags.replace(SOLUTION_FOLDER_MARK, solutionFolder)
    if strWithTags.find(SOLUTION_NAME_MARK) >= 0:
        solutionName = getNameFromPath(solutionPath)
        strWithTags = strWithTags.replace(SOLUTION_NAME_MARK, solutionName)
    if strWithTags.find(CPP_PROJECT_NAME_MARK) >= 0:
        cppProjectName = getNameFromPath(cppProjectFile)
        strWithTags = strWithTags.replace(CPP_PROJECT_NAME_MARK,
                                          cppProjectName)
    if strWithTags.find(VISUAL_STUDIO_EXE_MARK) >= 0:
        strWithTags = strWithTags.replace(VISUAL_STUDIO_EXE_MARK,
                                          config.instance().visualStudioExe)

    #Just in case there's a double \\ (for instance: concatenating solution folder with Debug subdirectory
    #for exe command
    strWithTags = strWithTags.replace("\\\\", "\\")
    strWithTags = strWithTags.replace("\\/", "\\")
    strWithTags = strWithTags.replace("/\\", "\\")

    return strWithTags
コード例 #25
0
ファイル: caching.py プロジェクト: jasonbaker/shrapnel
        def decorated(*args, **kwargs):
            generator = undecorated(*args, **kwargs)

            if not type(generator) == types.GeneratorType:
                raise_error("It must return a generator.")

            mc = config.instance("memcache.{0}".format(memcached_instance))

            if not callable(getattr(mc, 'get', None)) or not callable(getattr(mc, 'set', None)):
                raise_error("The <memcached> instance for this function must support the .get(...) and .set(...) methods.")

            try:
                key_format_args = generator.next()
            except StopIteration:
                raise_error("It must yield format arguments to be applied to key_format.")
                
            if not isinstance(key_format_args, tuple):
                key_format_args = (key_format_args,)

            try:
                key = key_format.format(*key_format_args)
            except Exception, e:
                raise_error(str(e))
コード例 #26
0
    def accept(self):
        '''
        User accept. If data is valid, save the options with the help of config.ConfigSerializer.
        '''
        ok = self.validateOptions_()
        if not ok:
            return
        myConfig = config.instance()
        myConfig.defaultLanguage = str(
            self.defaultLanguageComboBox.currentText())
        #C++
        myConfig.cpp_defaultRootFolder = str(
            self.cpp_defaultRootFolderEditBox.toPlainText())
        myConfig.defaultCompilingCommand = str(
            self.defaultCompilingCommandEditBox.toPlainText())
        myConfig.cpp_defaultExeCommand = str(
            self.cpp_defaultExeCommandEditBox.toPlainText())
        #Visual Studio
        myConfig.visualStudioExe = str(
            self.visualStudioExeEditBox.toPlainText())
        myConfig.solutionExtensions = str(
            self.solutionExtensionsEditBox.toPlainText())
        myConfig.projectExtensions = str(
            self.projectExtensionsEditBox.toPlainText())
        #Boost
        myConfig.boostIncludeFolder = str(
            self.boostIncludeFolderEditBox.toPlainText())
        myConfig.boostLibraryFolder = str(
            self.boostLibraryFolderEditBox.toPlainText())
        #Python
        myConfig.python_defaultRootFolder = str(
            self.python_defaultRootFolderEditBox.toPlainText())
        myConfig.python_defaultExeCommand = str(
            self.python_defaultExeCommandEditBox.toPlainText())

        config.ConfigSerializer.saveConfig()
        QDialog.accept(self)
コード例 #27
0
def replaceTags(strWithTags, mainFile, projectName, solutionPath, cppProjectFile):
    '''
    In a command string, replace special tags with the actual values.
    For instance: "[MAIN_FILE]" should be replaced by mainFile parameter.
    '''
    def getNameFromPath(aPath):
        theName = os.path.basename(aPath)
        #Skip extension
        theName = theName[ : theName.find('.') ]
        return theName

    if strWithTags.find(MAIN_FILE_MARK) >= 0:
        strWithTags = strWithTags.replace(MAIN_FILE_MARK, mainFile)
    if strWithTags.find(PROJECT_NAME_MARK) >= 0:
        strWithTags = strWithTags.replace(PROJECT_NAME_MARK, projectName)
    if strWithTags.find(SOLUTION_PATH_MARK) >= 0:
        strWithTags = strWithTags.replace(SOLUTION_PATH_MARK, solutionPath)
    if strWithTags.find(SOLUTION_FOLDER_MARK) >= 0:
        solutionFolder = os.path.dirname(solutionPath)
        strWithTags = strWithTags.replace(SOLUTION_FOLDER_MARK, solutionFolder)
    if strWithTags.find(SOLUTION_NAME_MARK) >= 0:
        solutionName = getNameFromPath(solutionPath)
        strWithTags = strWithTags.replace(SOLUTION_NAME_MARK, solutionName)
    if strWithTags.find(CPP_PROJECT_NAME_MARK) >= 0:
        cppProjectName = getNameFromPath(cppProjectFile)
        strWithTags = strWithTags.replace(CPP_PROJECT_NAME_MARK, cppProjectName)
    if strWithTags.find(VISUAL_STUDIO_EXE_MARK) >= 0:
        strWithTags = strWithTags.replace(VISUAL_STUDIO_EXE_MARK, config.instance().visualStudioExe)

    #Just in case there's a double \\ (for instance: concatenating solution folder with Debug subdirectory
    #for exe command
    strWithTags = strWithTags.replace("\\\\", "\\")
    strWithTags = strWithTags.replace("\\/", "\\")
    strWithTags = strWithTags.replace("/\\", "\\")
    
    return strWithTags
コード例 #28
0
from locale_redirect_middleware import LocaleRedirectMiddleware
from static_file_server_app import StaticFileServerApplication
from sheets_auth_middleware import SheetsAuthMiddleware
from protorpc.wsgi import service
import access_requests
import cors
import logging
import protected_middleware
import os
import search_app
import users
import webapp2
import yaml

build_server_config = config.instance()

backend = webapp2.WSGIApplication([
    access_requests.FormResponseHandler.mapping(),
    ('/_grow/access-requests/approve/(.*)', access_requests.ApproveAccessRequestHandler),
    ('/_grow/access-requests/process', access_requests.ProcessHandler),
    ('/_grow/access-requests', access_requests.ManageAccessHandler),
    ('/_grow/users/csv', access_requests.DownloadCsvHandler),
    ('/_grow/users/import', access_requests.ImportFromSheetsHandler),
    ('/_grow/users/(.*)', access_requests.ManageUserHandler),
    ('/_grow/users', access_requests.ManageUsersHandler),
    ('/_grow/protected/cache-sheets', protected_middleware.CacheSheetsHandler),
    ('/_grow/search/index', search_app.IndexHandler),
    ('/_ah/warmup', search_app.IndexHandler),
], config=build_server_config)