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