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