|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the QScintilla Calltips configuration page. |
|
8 """ |
|
9 |
|
10 from PyQt4.Qsci import QsciScintilla |
|
11 |
|
12 from ConfigurationPageBase import ConfigurationPageBase |
|
13 from Ui_EditorCalltipsQScintillaPage import Ui_EditorCalltipsQScintillaPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 class EditorCalltipsQScintillaPage(ConfigurationPageBase, |
|
18 Ui_EditorCalltipsQScintillaPage): |
|
19 """ |
|
20 Class implementing the QScintilla Calltips configuration page. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 ConfigurationPageBase.__init__(self) |
|
27 self.setupUi(self) |
|
28 self.setObjectName("EditorCalltipsQScintillaPage") |
|
29 |
|
30 # set initial values |
|
31 ctContext = Preferences.getEditor("CallTipsStyle") |
|
32 if ctContext == QsciScintilla.CallTipsNoContext: |
|
33 self.ctNoContextButton.setChecked(True) |
|
34 elif ctContext == QsciScintilla.CallTipsNoAutoCompletionContext: |
|
35 self.ctNoAutoCompletionButton.setChecked(True) |
|
36 elif ctContext == QsciScintilla.CallTipsContext: |
|
37 self.ctContextButton.setChecked(True) |
|
38 |
|
39 def save(self): |
|
40 """ |
|
41 Public slot to save the EditorCalltips configuration. |
|
42 """ |
|
43 if self.ctNoContextButton.isChecked(): |
|
44 Preferences.setEditor("CallTipsStyle", |
|
45 QsciScintilla.CallTipsNoContext) |
|
46 elif self.ctNoAutoCompletionButton.isChecked(): |
|
47 Preferences.setEditor("CallTipsStyle", |
|
48 QsciScintilla.CallTipsNoAutoCompletionContext) |
|
49 elif self.ctContextButton.isChecked(): |
|
50 Preferences.setEditor("CallTipsStyle", |
|
51 QsciScintilla.CallTipsContext) |
|
52 |
|
53 def create(dlg): |
|
54 """ |
|
55 Module function to create the configuration page. |
|
56 |
|
57 @param dlg reference to the configuration dialog |
|
58 """ |
|
59 page = EditorCalltipsQScintillaPage() |
|
60 return page |