eric6/Preferences/ConfigurationPages/EditorCalltipsPage.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7202
d2f2a1fe0129
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2006 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing the Editor Calltips configuration page.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.Qsci import QsciScintilla
13
14 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
15
16 from .ConfigurationPageBase import ConfigurationPageBase
17 from .Ui_EditorCalltipsPage import Ui_EditorCalltipsPage
18
19 import Preferences
20
21
22 class EditorCalltipsPage(ConfigurationPageBase, Ui_EditorCalltipsPage):
23 """
24 Class implementing the Editor Calltips configuration page.
25 """
26 def __init__(self):
27 """
28 Constructor
29 """
30 super(EditorCalltipsPage, self).__init__()
31 self.setupUi(self)
32 self.setObjectName("EditorCalltipsPage")
33
34 if QSCINTILLA_VERSION() >= 0x020700:
35 self.positionComboBox.addItem(
36 self.tr("Below Text"),
37 QsciScintilla.CallTipsBelowText)
38 self.positionComboBox.addItem(
39 self.tr("Above Text"),
40 QsciScintilla.CallTipsAboveText)
41 else:
42 self.calltipsPositionBox.hide()
43
44 # set initial values
45 self.ctEnabledCheckBox.setChecked(
46 Preferences.getEditor("CallTipsEnabled"))
47
48 self.ctVisibleSlider.setValue(
49 Preferences.getEditor("CallTipsVisible"))
50 self.initColour("CallTipsBackground", self.calltipsBackgroundButton,
51 Preferences.getEditorColour)
52
53 self.ctScintillaCheckBox.setChecked(
54 Preferences.getEditor("CallTipsScintillaOnFail"))
55
56 if QSCINTILLA_VERSION() >= 0x020700:
57 self.positionComboBox.setCurrentIndex(
58 self.positionComboBox.findData(
59 Preferences.getEditor("CallTipsPosition")))
60
61 def save(self):
62 """
63 Public slot to save the EditorCalltips configuration.
64 """
65 Preferences.setEditor(
66 "CallTipsEnabled",
67 self.ctEnabledCheckBox.isChecked())
68
69 Preferences.setEditor(
70 "CallTipsVisible",
71 self.ctVisibleSlider.value())
72 self.saveColours(Preferences.setEditorColour)
73
74 Preferences.setEditor(
75 "CallTipsScintillaOnFail",
76 self.ctScintillaCheckBox.isChecked())
77
78 if QSCINTILLA_VERSION() >= 0x020700:
79 Preferences.setEditor(
80 "CallTipsPosition",
81 self.positionComboBox.itemData(
82 self.positionComboBox.currentIndex()))
83
84
85 def create(dlg):
86 """
87 Module function to create the configuration page.
88
89 @param dlg reference to the configuration dialog
90 @return reference to the instantiated page (ConfigurationPageBase)
91 """
92 page = EditorCalltipsPage()
93 return page

eric ide

mercurial