src/eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py

branch
eric7
changeset 10428
a071d4065202
parent 10069
435cc5875135
child 10439
21c28b0f9e41
equal deleted inserted replaced
10427:3733e2b23cf7 10428:a071d4065202
44 def setState(self, state): 44 def setState(self, state):
45 """ 45 """
46 Public method to set the state of the widget. 46 Public method to set the state of the widget.
47 47
48 @param state state data generated by saveState 48 @param state state data generated by saveState
49 @type list
49 """ 50 """
50 pass 51 pass
51 52
52 def initColour(self, colourKey, button, prefMethod, byName=False, hasAlpha=False): 53 def initColour(self, colourKey, button, prefMethod, byName=False, hasAlpha=False):
53 """ 54 """
54 Public method to initialize a colour selection button. 55 Public method to initialize a colour selection button.
55 56
56 @param colourKey key of the colour resource (string) 57 @param colourKey key of the colour resource
57 @param button reference to a button to show the colour on (QPushButton) 58 @type string
59 @param button reference to a button to show the colour on
60 @type QPushButton
58 @param prefMethod preferences method to get the colour 61 @param prefMethod preferences method to get the colour
62 @type function
59 @param byName flag indicating to retrieve/save by colour name 63 @param byName flag indicating to retrieve/save by colour name
60 (boolean) 64 @type bool
61 @param hasAlpha flag indicating to allow alpha channel (boolean) 65 @param hasAlpha flag indicating to allow alpha channel
66 @type bool
62 """ 67 """
63 colour = QColor(prefMethod(colourKey)) 68 colour = QColor(prefMethod(colourKey))
64 size = button.size() 69 size = button.size()
65 pm = QPixmap(size.width() // 2, size.height() // 2) 70 pm = QPixmap(size.width() // 2, size.height() // 2)
66 pm.fill(colour) 71 pm.fill(colour)
107 def saveColours(self, prefMethod): 112 def saveColours(self, prefMethod):
108 """ 113 """
109 Public method to save the colour selections. 114 Public method to save the colour selections.
110 115
111 @param prefMethod preferences method to set the colour 116 @param prefMethod preferences method to set the colour
117 @type function
112 """ 118 """
113 for key in self.__coloursDict: 119 for key in self.__coloursDict:
114 if self.__coloursDict[key][1]: 120 if self.__coloursDict[key][1]:
115 prefMethod(key, self.__coloursDict[key][0].name()) 121 prefMethod(key, self.__coloursDict[key][0].name())
116 else: 122 else:
118 124
119 def selectFont(self, fontSample, fontVar, showFontInfo=False, options=None): 125 def selectFont(self, fontSample, fontVar, showFontInfo=False, options=None):
120 """ 126 """
121 Public method used by the font selection buttons. 127 Public method used by the font selection buttons.
122 128
123 @param fontSample reference to the font sample widget (QLineEdit) 129 @param fontSample reference to the font sample widget
124 @param fontVar reference to the variable containing the font (QFont) 130 @type QLineEdit
131 @param fontVar reference to the variable containing the font
132 @type QFont
125 @param showFontInfo flag indicating to show some font info 133 @param showFontInfo flag indicating to show some font info
126 as the sample (boolean) 134 as the sample
135 @type bool
127 @param options options for the font dialog 136 @param options options for the font dialog
128 (QFontDialog.FontDialogOption) 137 @type QFontDialog.FontDialogOption
129 @return selected font (QFont) 138 @return selected font
139 @rtype QFont
130 """ 140 """
131 if options is None: 141 if options is None:
132 options = QFontDialog.FontDialogOption(0) 142 options = QFontDialog.FontDialogOption(0)
133 font, ok = QFontDialog.getFont(fontVar, self, "", options) 143 font, ok = QFontDialog.getFont(fontVar, self, "", options)
134 if ok: 144 if ok:

eric ide

mercurial