|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Editor Calltips configuration page. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import pyqtSlot |
|
11 |
|
12 from ConfigurationPageBase import ConfigurationPageBase |
|
13 from Ui_EditorCalltipsPage import Ui_EditorCalltipsPage |
|
14 |
|
15 import Preferences |
|
16 |
|
17 class EditorCalltipsPage(ConfigurationPageBase, Ui_EditorCalltipsPage): |
|
18 """ |
|
19 Class implementing the Editor Calltips configuration page. |
|
20 """ |
|
21 def __init__(self): |
|
22 """ |
|
23 Constructor |
|
24 """ |
|
25 ConfigurationPageBase.__init__(self) |
|
26 self.setupUi(self) |
|
27 self.setObjectName("EditorCalltipsPage") |
|
28 |
|
29 # set initial values |
|
30 self.ctEnabledCheckBox.setChecked(\ |
|
31 Preferences.getEditor("CallTipsEnabled")) |
|
32 |
|
33 self.ctVisibleSlider.setValue(\ |
|
34 Preferences.getEditor("CallTipsVisible")) |
|
35 self.callTipsBackgroundColour = \ |
|
36 self.initColour("CallTipsBackground", self.calltipsBackgroundButton, |
|
37 Preferences.getEditorColour) |
|
38 |
|
39 self.ctScintillaCheckBox.setChecked( |
|
40 Preferences.getEditor("CallTipsScintillaOnFail")) |
|
41 |
|
42 def save(self): |
|
43 """ |
|
44 Public slot to save the EditorCalltips configuration. |
|
45 """ |
|
46 Preferences.setEditor("CallTipsEnabled", |
|
47 int(self.ctEnabledCheckBox.isChecked())) |
|
48 |
|
49 Preferences.setEditor("CallTipsVisible", |
|
50 self.ctVisibleSlider.value()) |
|
51 Preferences.setEditorColour("CallTipsBackground", self.callTipsBackgroundColour) |
|
52 |
|
53 Preferences.setEditor("CallTipsScintillaOnFail", |
|
54 int(self.ctScintillaCheckBox.isChecked())) |
|
55 |
|
56 @pyqtSlot() |
|
57 def on_calltipsBackgroundButton_clicked(self): |
|
58 """ |
|
59 Private slot to set the background colour for calltips. |
|
60 """ |
|
61 self.callTipsBackgroundColour = \ |
|
62 self.selectColour(self.calltipsBackgroundButton, |
|
63 self.callTipsBackgroundColour) |
|
64 |
|
65 def create(dlg): |
|
66 """ |
|
67 Module function to create the configuration page. |
|
68 |
|
69 @param dlg reference to the configuration dialog |
|
70 """ |
|
71 page = EditorCalltipsPage() |
|
72 return page |