diff -r efe069d7562d -r 3cb4ff958e33 QScintilla/TypingCompleters/CompleterPython.py --- a/QScintilla/TypingCompleters/CompleterPython.py Thu Aug 18 12:36:53 2011 +0200 +++ b/QScintilla/TypingCompleters/CompleterPython.py Fri Aug 19 17:36:45 2011 +0200 @@ -35,6 +35,7 @@ self.__classRX = QRegExp(r"""^[ \t]*class \w+\(""") self.__importRX = QRegExp(r"""^[ \t]*from [\w.]+ """) self.__classmethodRX = QRegExp(r"""^[ \t]*@classmethod""") + self.__staticmethodRX = QRegExp(r"""^[ \t]*@staticmethod""") self.__defOnlyRX = QRegExp(r"""^[ \t]*def """) @@ -107,9 +108,12 @@ txt = self.editor.text(line)[:col] if self.__insertSelf and \ self.__defRX.exactMatch(txt): - if self.__isClassmethodDef(): + if self.__isClassMethodDef(): self.editor.insert('cls') self.editor.setCursorPosition(line, col + 3) + elif self.__isStaticMethodDef(): + # nothing to insert + pass elif self.__isClassMethod(): self.editor.insert('self') self.editor.setCursorPosition(line, col + 4) @@ -364,12 +368,12 @@ curLine -= 1 return False - def __isClassmethodDef(self): + def __isClassMethodDef(self): """ - Private method to check, if the user is defing a classmethod - (@classmethod) method. + Private method to check, if the user is defing a class method + (@classmethod). - @return flag indicating the definition of a classmethod method (boolean) + @return flag indicating the definition of a class method (boolean) """ line, col = self.editor.getCursorPosition() indentation = self.editor.indentation(line) @@ -379,6 +383,21 @@ return True return False + def __isStaticMethodDef(self): + """ + Private method to check, if the user is defing a static method + (@staticmethod) method. + + @return flag indicating the definition of a static method (boolean) + """ + line, col = self.editor.getCursorPosition() + indentation = self.editor.indentation(line) + curLine = line - 1 + if self.__staticmethodRX.indexIn(self.editor.text(curLine)) == 0 and \ + self.editor.indentation(curLine) == indentation: + return True + return False + def __inComment(self, line, col): """ Private method to check, if the cursor is inside a comment