8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals # __IGNORE_WARNING__ |
10 from __future__ import unicode_literals # __IGNORE_WARNING__ |
11 |
11 |
12 from PyQt4.QtCore import pyqtSlot |
12 from PyQt4.QtCore import pyqtSlot |
13 from PyQt4.QtGui import QWidget, QIcon, QPixmap, QColor, QColorDialog, QFontDialog |
13 from PyQt4.QtGui import QWidget, QIcon, QPixmap, QColor, QColorDialog, \ |
|
14 QFontDialog |
14 |
15 |
15 |
16 |
16 class ConfigurationPageBase(QWidget): |
17 class ConfigurationPageBase(QWidget): |
17 """ |
18 """ |
18 Class implementing the base class for all configuration pages. |
19 Class implementing the base class for all configuration pages. |
33 |
34 |
34 def saveState(self): |
35 def saveState(self): |
35 """ |
36 """ |
36 Public method to save the current state of the widget. |
37 Public method to save the current state of the widget. |
37 """ |
38 """ |
38 return None |
39 return |
39 |
40 |
40 def setState(self, state): |
41 def setState(self, state): |
41 """ |
42 """ |
42 Public method to set the state of the widget. |
43 Public method to set the state of the widget. |
43 |
44 |
44 @param state state data generated by saveState |
45 @param state state data generated by saveState |
45 """ |
46 """ |
46 return |
47 return |
47 |
48 |
48 def initColour(self, colourKey, button, prefMethod, byName=False, hasAlpha=False): |
49 def initColour(self, colourKey, button, prefMethod, byName=False, |
|
50 hasAlpha=False): |
49 """ |
51 """ |
50 Public method to initialize a colour selection button. |
52 Public method to initialize a colour selection button. |
51 |
53 |
52 @param colourKey key of the colour resource (string) |
54 @param colourKey key of the colour resource (string) |
53 @param button reference to a button to show the colour on (QPushButton) |
55 @param button reference to a button to show the colour on (QPushButton) |
54 @param prefMethod preferences method to get the colour |
56 @param prefMethod preferences method to get the colour |
55 @keyparam byName flag indicating to retrieve/save by colour name (boolean) |
57 @keyparam byName flag indicating to retrieve/save by colour name |
|
58 (boolean) |
56 @keyparam hasAlpha flag indicating to allow alpha channel (boolean) |
59 @keyparam hasAlpha flag indicating to allow alpha channel (boolean) |
57 """ |
60 """ |
58 colour = QColor(prefMethod(colourKey)) |
61 colour = QColor(prefMethod(colourKey)) |
59 size = button.size() |
62 size = button.size() |
60 pm = QPixmap(size.width() / 2, size.height() / 2) |
63 pm = QPixmap(size.width() / 2, size.height() / 2) |
74 button = self.sender() |
77 button = self.sender() |
75 colorKey = button.property("colorKey") |
78 colorKey = button.property("colorKey") |
76 hasAlpha = button.property("hasAlpha") |
79 hasAlpha = button.property("hasAlpha") |
77 |
80 |
78 if hasAlpha: |
81 if hasAlpha: |
79 colour = QColorDialog.getColor(self.__coloursDict[colorKey][0], None, "", |
82 colour = QColorDialog.getColor( |
|
83 self.__coloursDict[colorKey][0], None, "", |
80 QColorDialog.ShowAlphaChannel) |
84 QColorDialog.ShowAlphaChannel) |
81 else: |
85 else: |
82 colour = QColorDialog.getColor(self.__coloursDict[colorKey][0]) |
86 colour = QColorDialog.getColor(self.__coloursDict[colorKey][0]) |
83 if colour.isValid(): |
87 if colour.isValid(): |
84 size = button.iconSize() |
88 size = button.iconSize() |