src/eric7/Preferences/ConfigurationPages/EditorCalltipsPage.py

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

eric ide

mercurial