8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.Qsci import QsciScintilla |
12 from PyQt5.Qsci import QsciScintilla |
13 |
|
14 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION |
|
15 |
13 |
16 from .ConfigurationPageBase import ConfigurationPageBase |
14 from .ConfigurationPageBase import ConfigurationPageBase |
17 from .Ui_EditorCalltipsPage import Ui_EditorCalltipsPage |
15 from .Ui_EditorCalltipsPage import Ui_EditorCalltipsPage |
18 |
16 |
19 import Preferences |
17 import Preferences |
29 """ |
27 """ |
30 super(EditorCalltipsPage, self).__init__() |
28 super(EditorCalltipsPage, self).__init__() |
31 self.setupUi(self) |
29 self.setupUi(self) |
32 self.setObjectName("EditorCalltipsPage") |
30 self.setObjectName("EditorCalltipsPage") |
33 |
31 |
34 if QSCINTILLA_VERSION() >= 0x020700: |
32 self.positionComboBox.addItem( |
35 self.positionComboBox.addItem( |
33 self.tr("Below Text"), |
36 self.tr("Below Text"), |
34 QsciScintilla.CallTipsBelowText) |
37 QsciScintilla.CallTipsBelowText) |
35 self.positionComboBox.addItem( |
38 self.positionComboBox.addItem( |
36 self.tr("Above Text"), |
39 self.tr("Above Text"), |
37 QsciScintilla.CallTipsAboveText) |
40 QsciScintilla.CallTipsAboveText) |
|
41 else: |
|
42 self.calltipsPositionBox.hide() |
|
43 |
38 |
44 # set initial values |
39 # set initial values |
45 self.ctEnabledCheckBox.setChecked( |
40 self.ctEnabledCheckBox.setChecked( |
46 Preferences.getEditor("CallTipsEnabled")) |
41 Preferences.getEditor("CallTipsEnabled")) |
47 |
42 |
51 Preferences.getEditorColour) |
46 Preferences.getEditorColour) |
52 |
47 |
53 self.ctScintillaCheckBox.setChecked( |
48 self.ctScintillaCheckBox.setChecked( |
54 Preferences.getEditor("CallTipsScintillaOnFail")) |
49 Preferences.getEditor("CallTipsScintillaOnFail")) |
55 |
50 |
56 if QSCINTILLA_VERSION() >= 0x020700: |
51 self.positionComboBox.setCurrentIndex( |
57 self.positionComboBox.setCurrentIndex( |
52 self.positionComboBox.findData( |
58 self.positionComboBox.findData( |
53 Preferences.getEditor("CallTipsPosition"))) |
59 Preferences.getEditor("CallTipsPosition"))) |
|
60 |
54 |
61 def save(self): |
55 def save(self): |
62 """ |
56 """ |
63 Public slot to save the EditorCalltips configuration. |
57 Public slot to save the EditorCalltips configuration. |
64 """ |
58 """ |
73 |
67 |
74 Preferences.setEditor( |
68 Preferences.setEditor( |
75 "CallTipsScintillaOnFail", |
69 "CallTipsScintillaOnFail", |
76 self.ctScintillaCheckBox.isChecked()) |
70 self.ctScintillaCheckBox.isChecked()) |
77 |
71 |
78 if QSCINTILLA_VERSION() >= 0x020700: |
72 Preferences.setEditor( |
79 Preferences.setEditor( |
73 "CallTipsPosition", |
80 "CallTipsPosition", |
74 self.positionComboBox.itemData( |
81 self.positionComboBox.itemData( |
75 self.positionComboBox.currentIndex())) |
82 self.positionComboBox.currentIndex())) |
|
83 |
76 |
84 |
77 |
85 def create(dlg): |
78 def create(dlg): |
86 """ |
79 """ |
87 Module function to create the configuration page. |
80 Module function to create the configuration page. |