~ubuntu-branches/ubuntu/karmic/eric/karmic

« back to all changes in this revision

Viewing changes to eric/QScintilla/Lexers/LexerD.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-28 18:02:25 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080128180225-6nrox6yrworh2c4v
Tags: 4.0.4-1ubuntu1
* Add python-qt3 to build-depends becuase that's where Ubuntu puts 
  pyqtconfig
* Change maintainer to MOTU

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Copyright (c) 2007 Detlev Offenbach <detlev@die-offenbachs.de>
 
4
#
 
5
 
 
6
"""
 
7
Module implementing a D lexer with some additional methods.
 
8
"""
 
9
 
 
10
from PyQt4.Qsci import QsciLexerD, QsciScintilla
 
11
from PyQt4.QtCore import QString
 
12
 
 
13
from Lexer import Lexer
 
14
import Preferences
 
15
 
 
16
class LexerD(QsciLexerD, Lexer):
 
17
    """ 
 
18
    Subclass to implement some additional lexer dependant methods.
 
19
    """
 
20
    def __init__(self, parent=None):
 
21
        """
 
22
        Constructor
 
23
        
 
24
        @param parent parent widget of this lexer
 
25
        """
 
26
        QsciLexerD.__init__(self, parent)
 
27
        Lexer.__init__(self)
 
28
        
 
29
        self.commentString = QString("//")
 
30
        self.streamCommentString = {
 
31
            'start' : QString('/+ '),
 
32
            'end'   : QString(' +/')
 
33
        }
 
34
        self.boxCommentString = {
 
35
            'start'  : QString('/* '),
 
36
            'middle' : QString(' * '),
 
37
            'end'    : QString(' */')
 
38
        }
 
39
    
 
40
    def initProperties(self):
 
41
        """
 
42
        Public slot to initialize the properties.
 
43
        """
 
44
        self.setFoldComments(Preferences.getEditor("DFoldComment"))
 
45
        self.setFoldAtElse(Preferences.getEditor("DFoldAtElse"))
 
46
        indentStyle = 0
 
47
        if Preferences.getEditor("DIndentOpeningBrace"):
 
48
            indentStyle |= QsciScintilla.AiOpening
 
49
        if Preferences.getEditor("DIndentClosingBrace"):
 
50
            indentStyle |= QsciScintilla.AiClosing
 
51
        self.setAutoIndentStyle(indentStyle)
 
52
        self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))