Preferences/ConfigurationPages/EditorCalltipsPage.py

changeset 2262
2371836c3c45
parent 2230
2b1b9265156c
child 2302
f29e9405c851
equal deleted inserted replaced
2261:f4bb5648fc29 2262:2371836c3c45
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the Editor Calltips configuration page. 7 Module implementing the Editor Calltips configuration page.
8 """ 8 """
9
10 from PyQt4.Qsci import QsciScintilla
11
12 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
9 13
10 from .ConfigurationPageBase import ConfigurationPageBase 14 from .ConfigurationPageBase import ConfigurationPageBase
11 from .Ui_EditorCalltipsPage import Ui_EditorCalltipsPage 15 from .Ui_EditorCalltipsPage import Ui_EditorCalltipsPage
12 16
13 import Preferences 17 import Preferences
23 """ 27 """
24 super().__init__() 28 super().__init__()
25 self.setupUi(self) 29 self.setupUi(self)
26 self.setObjectName("EditorCalltipsPage") 30 self.setObjectName("EditorCalltipsPage")
27 31
32 if QSCINTILLA_VERSION() >= 0x020700:
33 self.positionComboBox.addItem(self.trUtf8("Below Text"),
34 QsciScintilla.CallTipsBelowText)
35 self.positionComboBox.addItem(self.trUtf8("Above Text"),
36 QsciScintilla.CallTipsAboveText)
37 else:
38 self.calltipsPositionBox.hide()
39
28 # set initial values 40 # set initial values
29 self.ctEnabledCheckBox.setChecked( 41 self.ctEnabledCheckBox.setChecked(
30 Preferences.getEditor("CallTipsEnabled")) 42 Preferences.getEditor("CallTipsEnabled"))
31 43
32 self.ctVisibleSlider.setValue( 44 self.ctVisibleSlider.setValue(
34 self.initColour("CallTipsBackground", self.calltipsBackgroundButton, 46 self.initColour("CallTipsBackground", self.calltipsBackgroundButton,
35 Preferences.getEditorColour) 47 Preferences.getEditorColour)
36 48
37 self.ctScintillaCheckBox.setChecked( 49 self.ctScintillaCheckBox.setChecked(
38 Preferences.getEditor("CallTipsScintillaOnFail")) 50 Preferences.getEditor("CallTipsScintillaOnFail"))
51
52 if QSCINTILLA_VERSION() >= 0x020700:
53 self.positionComboBox.setCurrentIndex(self.positionComboBox.findData(
54 Preferences.getEditor("CallTipsPosition")))
39 55
40 def save(self): 56 def save(self):
41 """ 57 """
42 Public slot to save the EditorCalltips configuration. 58 Public slot to save the EditorCalltips configuration.
43 """ 59 """
48 self.ctVisibleSlider.value()) 64 self.ctVisibleSlider.value())
49 self.saveColours(Preferences.setEditorColour) 65 self.saveColours(Preferences.setEditorColour)
50 66
51 Preferences.setEditor("CallTipsScintillaOnFail", 67 Preferences.setEditor("CallTipsScintillaOnFail",
52 self.ctScintillaCheckBox.isChecked()) 68 self.ctScintillaCheckBox.isChecked())
69
70 if QSCINTILLA_VERSION() >= 0x020700:
71 Preferences.setEditor("CallTipsPosition",
72 self.positionComboBox.itemData(self.positionComboBox.currentIndex()))
53 73
54 74
55 def create(dlg): 75 def create(dlg):
56 """ 76 """
57 Module function to create the configuration page. 77 Module function to create the configuration page.

eric ide

mercurial