|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the QScintilla Autocompletion configuration page. |
|
8 """ |
|
9 |
|
10 from PyQt4.Qsci import QsciScintilla |
|
11 |
|
12 from ConfigurationPageBase import ConfigurationPageBase |
|
13 from Ui_EditorAutocompletionQScintillaPage import Ui_EditorAutocompletionQScintillaPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 class EditorAutocompletionQScintillaPage(ConfigurationPageBase, |
|
18 Ui_EditorAutocompletionQScintillaPage): |
|
19 """ |
|
20 Class implementing the QScintilla Autocompletion configuration page. |
|
21 """ |
|
22 def __init__(self): |
|
23 """ |
|
24 Constructor |
|
25 """ |
|
26 ConfigurationPageBase.__init__(self) |
|
27 self.setupUi(self) |
|
28 self.setObjectName("EditorAutocompletionQScintillaPage") |
|
29 |
|
30 # set initial values |
|
31 self.acShowSingleCheckBox.setChecked(\ |
|
32 Preferences.getEditor("AutoCompletionShowSingle")) |
|
33 self.acFillupsCheckBox.setChecked(\ |
|
34 Preferences.getEditor("AutoCompletionFillups")) |
|
35 |
|
36 acSource = Preferences.getEditor("AutoCompletionSource") |
|
37 if acSource == QsciScintilla.AcsDocument: |
|
38 self.acSourceDocumentRadioButton.setChecked(True) |
|
39 elif acSource == QsciScintilla.AcsAPIs: |
|
40 self.acSourceAPIsRadioButton.setChecked(True) |
|
41 elif acSource == QsciScintilla.AcsAll: |
|
42 self.acSourceAllRadioButton.setChecked(True) |
|
43 |
|
44 def save(self): |
|
45 """ |
|
46 Public slot to save the Editor Autocompletion configuration. |
|
47 """ |
|
48 Preferences.setEditor("AutoCompletionShowSingle", |
|
49 int(self.acShowSingleCheckBox.isChecked())) |
|
50 Preferences.setEditor("AutoCompletionFillups", |
|
51 int(self.acFillupsCheckBox.isChecked())) |
|
52 if self.acSourceDocumentRadioButton.isChecked(): |
|
53 Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsDocument) |
|
54 elif self.acSourceAPIsRadioButton.isChecked(): |
|
55 Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsAPIs) |
|
56 elif self.acSourceAllRadioButton.isChecked(): |
|
57 Preferences.setEditor("AutoCompletionSource", QsciScintilla.AcsAll) |
|
58 |
|
59 def create(dlg): |
|
60 """ |
|
61 Module function to create the configuration page. |
|
62 |
|
63 @param dlg reference to the configuration dialog |
|
64 """ |
|
65 page = EditorAutocompletionQScintillaPage() |
|
66 return page |