Esempio n. 1
0
    def check_style(self, ev=None):
        """ Runs pep8 stylecheck, captures output and prints to new
            output window."""

        sbind = ScriptBinding(self.editwin)
        filename = sbind.getfilename()

        if filename:
            try:
                p = sub.Popen(['pep8', filename],
                              stdout=sub.PIPE, stderr=sub.PIPE)
                output, errors = p.communicate()

                if output.strip():
                    output_short = '\n'.join(
                        [line.split('/')[-1]
                         for line in output.split('\n')[:-1]])
                    # shorten pathname in each line of output
                else:
                    output_short = "Passed all checks!"

            except OSError:
                output_short = "Please install pep8."

            win = OutputWindow(self.editwin.flist)
            win.write(output_short)
Esempio n. 2
0
 def write(self, s, tags=()):
     try:
         self.text.mark_gravity("iomark", "right")
         OutputWindow.write(self, s, tags, "iomark")
         self.text.mark_gravity("iomark", "left")
     except:
         pass
     if self.canceled:
         self.canceled = 0
         if not use_subprocess:
             raise KeyboardInterrupt
Esempio n. 3
0
 def write(self, s, tags=()):
     try:
         self.text.mark_gravity("iomark", "right")
         OutputWindow.write(self, s, tags, "iomark")
         self.text.mark_gravity("iomark", "left")
     except:
         raise ###pass  # ### 11Aug07 KBK if we are expecting exceptions
                        # let's find out what they are and be specific.
     if self.canceled:
         self.canceled = 0
         if not use_subprocess:
             raise KeyboardInterrupt
Esempio n. 4
0
    def write(self, s, tags = ()):
        try:
            self.text.mark_gravity('iomark', 'right')
            OutputWindow.write(self, s, tags, 'iomark')
            self.text.mark_gravity('iomark', 'left')
        except:
            pass

        if self.canceled:
            self.canceled = 0
            if not use_subprocess:
                raise KeyboardInterrupt
Esempio n. 5
0
 def write(self, s, tags=()):
     try:
         self.text.mark_gravity("iomark", "right")
         OutputWindow.write(self, s, tags, "iomark")
         self.text.mark_gravity("iomark", "left")
     except:
         raise ###pass  # ### 11Aug07 KBK if we are expecting exceptions
                        # let's find out what they are and be specific.
     if self.canceled:
         self.canceled = 0
         if not use_subprocess:
             raise KeyboardInterrupt
Esempio n. 6
0
    def write(self, s, tags=()):
        try:
            self.text.mark_gravity('iomark', 'right')
            OutputWindow.write(self, s, tags, 'iomark')
            self.text.mark_gravity('iomark', 'left')
        except:
            pass

        if self.canceled:
            self.canceled = 0
            if not use_subprocess:
                raise KeyboardInterrupt
Esempio n. 7
0
    def doc_test(self, ev=None):
        """ Run doctests on the current module"""

        sbind = ScriptBinding(self.editwin)
        filename = sbind.getfilename()

        if filename:
            p = sub.Popen(['python', '-m', 'doctest', '-v', filename],
                            stdout=sub.PIPE, stderr=sub.PIPE)
            output, errors = p.communicate()

            win = OutputWindow(self.editwin.flist)
            win.write(output + '\n' + errors)  # write to output window
Esempio n. 8
0
    def doc_test(self, ev=None):
        """ Run doctests on the current module"""

        sbind = ScriptBinding(self.editwin)
        filename = sbind.getfilename()

        if filename:
            p = sub.Popen(['python', '-m', 'doctest', '-v', filename],
                          stdout=sub.PIPE,
                          stderr=sub.PIPE)
            output, errors = p.communicate()

            win = OutputWindow(self.editwin.flist)
            win.write(output + '\n' + errors)  # write to output window