8 """ |
8 """ |
9 |
9 |
10 from PyQt6.Qsci import QsciScintilla |
10 from PyQt6.Qsci import QsciScintilla |
11 |
11 |
12 from .ConfigurationPageBase import ConfigurationPageBase |
12 from .ConfigurationPageBase import ConfigurationPageBase |
13 from .Ui_EditorAutocompletionQScintillaPage import ( |
13 from .Ui_EditorAutocompletionQScintillaPage import Ui_EditorAutocompletionQScintillaPage |
14 Ui_EditorAutocompletionQScintillaPage |
|
15 ) |
|
16 |
14 |
17 import Preferences |
15 import Preferences |
18 |
16 |
19 |
17 |
20 class EditorAutocompletionQScintillaPage( |
18 class EditorAutocompletionQScintillaPage( |
21 ConfigurationPageBase, Ui_EditorAutocompletionQScintillaPage): |
19 ConfigurationPageBase, Ui_EditorAutocompletionQScintillaPage |
|
20 ): |
22 """ |
21 """ |
23 Class implementing the QScintilla Autocompletion configuration page. |
22 Class implementing the QScintilla Autocompletion configuration page. |
24 """ |
23 """ |
|
24 |
25 def __init__(self): |
25 def __init__(self): |
26 """ |
26 """ |
27 Constructor |
27 Constructor |
28 """ |
28 """ |
29 super().__init__() |
29 super().__init__() |
30 self.setupUi(self) |
30 self.setupUi(self) |
31 self.setObjectName("EditorAutocompletionQScintillaPage") |
31 self.setObjectName("EditorAutocompletionQScintillaPage") |
32 |
32 |
33 # set initial values |
33 # set initial values |
34 self.acShowSingleCheckBox.setChecked( |
34 self.acShowSingleCheckBox.setChecked( |
35 Preferences.getEditor("AutoCompletionShowSingle")) |
35 Preferences.getEditor("AutoCompletionShowSingle") |
|
36 ) |
36 self.acFillupsCheckBox.setChecked( |
37 self.acFillupsCheckBox.setChecked( |
37 Preferences.getEditor("AutoCompletionFillups")) |
38 Preferences.getEditor("AutoCompletionFillups") |
38 |
39 ) |
|
40 |
39 acSource = Preferences.getEditor("AutoCompletionSource") |
41 acSource = Preferences.getEditor("AutoCompletionSource") |
40 if acSource == QsciScintilla.AutoCompletionSource.AcsDocument: |
42 if acSource == QsciScintilla.AutoCompletionSource.AcsDocument: |
41 self.acSourceDocumentRadioButton.setChecked(True) |
43 self.acSourceDocumentRadioButton.setChecked(True) |
42 elif acSource == QsciScintilla.AutoCompletionSource.AcsAPIs: |
44 elif acSource == QsciScintilla.AutoCompletionSource.AcsAPIs: |
43 self.acSourceAPIsRadioButton.setChecked(True) |
45 self.acSourceAPIsRadioButton.setChecked(True) |
44 elif acSource == QsciScintilla.AutoCompletionSource.AcsAll: |
46 elif acSource == QsciScintilla.AutoCompletionSource.AcsAll: |
45 self.acSourceAllRadioButton.setChecked(True) |
47 self.acSourceAllRadioButton.setChecked(True) |
46 |
48 |
47 def save(self): |
49 def save(self): |
48 """ |
50 """ |
49 Public slot to save the Editor Autocompletion configuration. |
51 Public slot to save the Editor Autocompletion configuration. |
50 """ |
52 """ |
51 Preferences.setEditor( |
53 Preferences.setEditor( |
52 "AutoCompletionShowSingle", |
54 "AutoCompletionShowSingle", self.acShowSingleCheckBox.isChecked() |
53 self.acShowSingleCheckBox.isChecked()) |
55 ) |
54 Preferences.setEditor( |
56 Preferences.setEditor( |
55 "AutoCompletionFillups", |
57 "AutoCompletionFillups", self.acFillupsCheckBox.isChecked() |
56 self.acFillupsCheckBox.isChecked()) |
58 ) |
57 if self.acSourceDocumentRadioButton.isChecked(): |
59 if self.acSourceDocumentRadioButton.isChecked(): |
58 Preferences.setEditor( |
60 Preferences.setEditor( |
59 "AutoCompletionSource", |
61 "AutoCompletionSource", QsciScintilla.AutoCompletionSource.AcsDocument |
60 QsciScintilla.AutoCompletionSource.AcsDocument) |
62 ) |
61 elif self.acSourceAPIsRadioButton.isChecked(): |
63 elif self.acSourceAPIsRadioButton.isChecked(): |
62 Preferences.setEditor( |
64 Preferences.setEditor( |
63 "AutoCompletionSource", |
65 "AutoCompletionSource", QsciScintilla.AutoCompletionSource.AcsAPIs |
64 QsciScintilla.AutoCompletionSource.AcsAPIs) |
66 ) |
65 elif self.acSourceAllRadioButton.isChecked(): |
67 elif self.acSourceAllRadioButton.isChecked(): |
66 Preferences.setEditor( |
68 Preferences.setEditor( |
67 "AutoCompletionSource", |
69 "AutoCompletionSource", QsciScintilla.AutoCompletionSource.AcsAll |
68 QsciScintilla.AutoCompletionSource.AcsAll) |
70 ) |
69 |
71 |
70 |
72 |
71 def create(dlg): |
73 def create(dlg): |
72 """ |
74 """ |
73 Module function to create the configuration page. |
75 Module function to create the configuration page. |
74 |
76 |
75 @param dlg reference to the configuration dialog |
77 @param dlg reference to the configuration dialog |
76 @return reference to the instantiated page (ConfigurationPageBase) |
78 @return reference to the instantiated page (ConfigurationPageBase) |
77 """ |
79 """ |
78 page = EditorAutocompletionQScintillaPage() |
80 page = EditorAutocompletionQScintillaPage() |
79 return page |
81 return page |