QScintilla/Lexers/LexerPO.py

changeset 3557
3ea8ba471d96
child 3656
441956d8fce5
equal deleted inserted replaced
3556:40e205ef1470 3557:3ea8ba471d96
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a Gettext lexer with some additional methods.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt4.Qsci import QsciLexerPO
13
14 from .Lexer import Lexer
15 import Preferences
16
17
18 class LexerPO(Lexer, QsciLexerPO):
19 """
20 Subclass to implement some additional lexer dependant methods.
21 """
22 def __init__(self, parent=None):
23 """
24 Constructor
25
26 @param parent parent widget of this lexer
27 """
28 QsciLexerPO.__init__(self, parent)
29 Lexer.__init__(self)
30
31 self.commentString = "#"
32
33 def initProperties(self):
34 """
35 Public slot to initialize the properties.
36 """
37 self.setFoldComments(Preferences.getEditor("PoFoldComment"))
38 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
39
40 def isCommentStyle(self, style):
41 """
42 Public method to check, if a style is a comment style.
43
44 @param style style to check (integer)
45 @return flag indicating a comment style (boolean)
46 """
47 return style in [QsciLexerPO.Comment, QsciLexerPO.ProgrammerComment]
48
49 def isStringStyle(self, style):
50 """
51 Public method to check, if a style is a string style.
52
53 @param style style to check (integer)
54 @return flag indicating a string style (boolean)
55 """
56 return style in [QsciLexerPO.MessageIdText,
57 QsciLexerPO.MessageStringText,
58 QsciLexerPO.MessageContextText]
59
60 def defaultKeywords(self, kwSet):
61 """
62 Public method to get the default keywords.
63
64 @param kwSet number of the keyword set (integer)
65 @return string giving the keywords (string) or None
66 """
67 return QsciLexerPO.keywords(self, kwSet)

eric ide

mercurial