17 |
17 |
18 class EditorCalltipsPage(ConfigurationPageBase, Ui_EditorCalltipsPage): |
18 class EditorCalltipsPage(ConfigurationPageBase, Ui_EditorCalltipsPage): |
19 """ |
19 """ |
20 Class implementing the Editor Calltips configuration page. |
20 Class implementing the Editor Calltips configuration page. |
21 """ |
21 """ |
|
22 |
22 def __init__(self): |
23 def __init__(self): |
23 """ |
24 """ |
24 Constructor |
25 Constructor |
25 """ |
26 """ |
26 super().__init__() |
27 super().__init__() |
27 self.setupUi(self) |
28 self.setupUi(self) |
28 self.setObjectName("EditorCalltipsPage") |
29 self.setObjectName("EditorCalltipsPage") |
29 |
30 |
30 self.positionComboBox.addItem( |
31 self.positionComboBox.addItem( |
31 self.tr("Below Text"), |
32 self.tr("Below Text"), QsciScintilla.CallTipsPosition.CallTipsBelowText |
32 QsciScintilla.CallTipsPosition.CallTipsBelowText) |
33 ) |
33 self.positionComboBox.addItem( |
34 self.positionComboBox.addItem( |
34 self.tr("Above Text"), |
35 self.tr("Above Text"), QsciScintilla.CallTipsPosition.CallTipsAboveText |
35 QsciScintilla.CallTipsPosition.CallTipsAboveText) |
36 ) |
36 |
37 |
37 # set initial values |
38 # set initial values |
38 self.ctEnabledCheckBox.setChecked( |
39 self.ctEnabledCheckBox.setChecked(Preferences.getEditor("CallTipsEnabled")) |
39 Preferences.getEditor("CallTipsEnabled")) |
40 |
40 |
41 self.ctVisibleSlider.setValue(Preferences.getEditor("CallTipsVisible")) |
41 self.ctVisibleSlider.setValue( |
42 |
42 Preferences.getEditor("CallTipsVisible")) |
43 self.initColour( |
43 |
44 "CallTipsBackground", |
44 self.initColour("CallTipsBackground", self.calltipsBackgroundButton, |
45 self.calltipsBackgroundButton, |
45 Preferences.getEditorColour) |
46 Preferences.getEditorColour, |
46 self.initColour("CallTipsForeground", self.calltipsForegroundButton, |
47 ) |
47 Preferences.getEditorColour) |
48 self.initColour( |
48 self.initColour("CallTipsHighlight", self.calltipsHighlightButton, |
49 "CallTipsForeground", |
49 Preferences.getEditorColour) |
50 self.calltipsForegroundButton, |
50 |
51 Preferences.getEditorColour, |
|
52 ) |
|
53 self.initColour( |
|
54 "CallTipsHighlight", |
|
55 self.calltipsHighlightButton, |
|
56 Preferences.getEditorColour, |
|
57 ) |
|
58 |
51 self.ctScintillaCheckBox.setChecked( |
59 self.ctScintillaCheckBox.setChecked( |
52 Preferences.getEditor("CallTipsScintillaOnFail")) |
60 Preferences.getEditor("CallTipsScintillaOnFail") |
53 |
61 ) |
|
62 |
54 self.positionComboBox.setCurrentIndex( |
63 self.positionComboBox.setCurrentIndex( |
55 self.positionComboBox.findData( |
64 self.positionComboBox.findData(Preferences.getEditor("CallTipsPosition")) |
56 Preferences.getEditor("CallTipsPosition"))) |
65 ) |
57 |
66 |
58 def save(self): |
67 def save(self): |
59 """ |
68 """ |
60 Public slot to save the EditorCalltips configuration. |
69 Public slot to save the EditorCalltips configuration. |
61 """ |
70 """ |
|
71 Preferences.setEditor("CallTipsEnabled", self.ctEnabledCheckBox.isChecked()) |
|
72 |
|
73 Preferences.setEditor("CallTipsVisible", self.ctVisibleSlider.value()) |
|
74 |
|
75 self.saveColours(Preferences.setEditorColour) |
|
76 |
62 Preferences.setEditor( |
77 Preferences.setEditor( |
63 "CallTipsEnabled", |
78 "CallTipsScintillaOnFail", self.ctScintillaCheckBox.isChecked() |
64 self.ctEnabledCheckBox.isChecked()) |
79 ) |
65 |
80 |
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( |
81 Preferences.setEditor( |
77 "CallTipsPosition", |
82 "CallTipsPosition", |
78 self.positionComboBox.itemData( |
83 self.positionComboBox.itemData(self.positionComboBox.currentIndex()), |
79 self.positionComboBox.currentIndex())) |
84 ) |
80 |
85 |
81 |
86 |
82 def create(dlg): |
87 def create(dlg): |
83 """ |
88 """ |
84 Module function to create the configuration page. |
89 Module function to create the configuration page. |
85 |
90 |
86 @param dlg reference to the configuration dialog |
91 @param dlg reference to the configuration dialog |
87 @return reference to the instantiated page (ConfigurationPageBase) |
92 @return reference to the instantiated page (ConfigurationPageBase) |
88 """ |
93 """ |
89 page = EditorCalltipsPage() |
94 page = EditorCalltipsPage() |
90 return page |
95 return page |