コード例 #1
0
ファイル: JESProgram.py プロジェクト: Bail-jw/mediacomp-jes
    def checkTabs(self):

        if self.filename != '':
            #tabnanny sends the response to stdout, this redirects that output

            badLine = JESTabnanny.check(self.filename)
            # tabnanny calls tokenizer.tokenize, which can
            # throw a TokenError exception
            # we catch it when we call checkTabs

            return badLine
        return ''
コード例 #2
0
ファイル: JESProgram.py プロジェクト: apple1986/mediacomp-jes
    def checkTabs(self):

        if self.filename != '':
            #tabnanny sends the response to stdout, this redirects that output

            badLine = JESTabnanny.check(self.filename)
            # tabnanny calls tokenizer.tokenize, which can
            # throw a TokenError exception
            # we catch it when we call checkTabs

            return badLine
        return ''
コード例 #3
0
ファイル: JESProgram.py プロジェクト: NicMcPhee/jes
    def loadFile(self):
        if self.filename == ' ':
            self.setErrorByHand(JESConstants.JESPROGRAM_NO_FILE, 0)
        else:  # error 1. didn't occur

            try:
                file = open(self.filename, 'r')
                fileText = file.read()
                file.close()
            except:
                self.setErrorByHand(
                    JESConstants.JESPROGRAM_ERROR_LOADING_FILE + self.filename + '\n', 0)

            else:  # error 2. didn't occur
                try:
                    lineWithError = JESTabnanny.check(self.filename)

                except:

                    import sys
                    a, b, c = sys.exc_info()

                    self.setErrorFromUserCode(a, b, c)
                    return

                #this is clugy
                # JESTabnanny can either throw an exception,
                # or return a line number.
                # both signal an error, and we handle them seperatly
                # error 3. didn't occur
                if not lineWithError is None:
                    # an error has occured in the file
                    self.setErrorByHand(JESConstants.TAB_ERROR_MESSAGE + '%d\n' % lineWithError,
                                        lineWithError)

                    return

                # error 4. didn't occur,
                # Cancel the prompt, since .load() will redisplay it
                # anyway
                self.gui.commandWindow.cancelPrompt()
                self.gui.commandWindow.display(
                    "======= Loading Program =======", 'system-message')
                self.interpreter.runFile(self.filename)
                self.interpreter.debugger.setTargetFilenames([self.filename])
                self.gui.commandWindow.requestFocus()
                self.gui.editor.getDocument().removeErrorHighlighting()
                self.gui.loadCurrent()
コード例 #4
0
ファイル: JESProgram.py プロジェクト: apple1986/mediacomp-jes
    def loadFile(self):
        if self.filename == ' ':
            self.setErrorByHand(JESConstants.JESPROGRAM_NO_FILE, 0)
        else:  # error 1. didn't occur

            try:
                file = open(self.filename, 'r')
                fileText = file.read()
                file.close()
            except:
                self.setErrorByHand(
                    JESConstants.JESPROGRAM_ERROR_LOADING_FILE +
                    self.filename + '\n', 0)

            else:  # error 2. didn't occur
                self.gui.commandWindow.setKeymap(None)
                try:
                    lineWithError = JESTabnanny.check(self.filename)

                except:

                    import sys
                    a, b, c = sys.exc_info()

                    self.setErrorFromUserCode(a, b, c)
                    return

                #this is clugy
                #JESTabnanny can either throw an exception,
                # or return a line number.
                # both signal an error, and we handle them seperatly
                # error 3. didn't occur
                if not lineWithError is None:
                    # an error has occured in the file
                    self.setErrorByHand(
                        JESConstants.TAB_ERROR_MESSAGE +
                        '%d\n' % lineWithError, lineWithError)

                    return

                # error 4. didn't occur,
                # give the command area the focus
                self.gui.commandWindow.showText(
                    "\n======= Loading Progam =======\n")
                self.interpreter.load(self.filename)
                self.gui.commandWindow.requestFocus()
                self.gui.editor.getDocument().removeErrorHighlighting()
コード例 #5
0
ファイル: JESProgram.py プロジェクト: Bail-jw/mediacomp-jes
    def loadFile(self):
        if self.filename == ' ':
            self.setErrorByHand(JESConstants.JESPROGRAM_NO_FILE, 0)
        else: # error 1. didn't occur
          
            try:
                file = open(self.filename, 'r')
                fileText = file.read()
                file.close()
            except:
                self.setErrorByHand(JESConstants.JESPROGRAM_ERROR_LOADING_FILE +   self.filename + '\n',0)

            else: # error 2. didn't occur
                self.gui.commandWindow.setKeymap(None)
                try:
                    lineWithError = JESTabnanny.check(self.filename)

      
                except:

                    import sys
                    a,b,c = sys.exc_info()

                    self.setErrorFromUserCode( a,b,c )
                    return

                #this is clugy
                #JESTabnanny can either throw an exception,
                # or return a line number.
                # both signal an error, and we handle them seperatly
                # error 3. didn't occur
                if not lineWithError is None:
                    # an error has occured in the file
                    self.setErrorByHand(JESConstants.TAB_ERROR_MESSAGE +'%d\n' % lineWithError,
                                         lineWithError)

                    return

                # error 4. didn't occur,
                # give the command area the focus
		self.gui.commandWindow.showText("\n======= Loading Progam =======\n")
                self.interpreter.load( self.filename)   
                self.gui.commandWindow.requestFocus()
                self.gui.editor.getDocument().removeErrorHighlighting()