eric6/IconEditor/IconEditorPalette.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
32 32
33 @param parent reference to the parent widget (QWidget) 33 @param parent reference to the parent widget (QWidget)
34 """ 34 """
35 super(IconEditorPalette, self).__init__(parent) 35 super(IconEditorPalette, self).__init__(parent)
36 36
37 if self.layoutDirection == Qt.Horizontal: 37 if self.layoutDirection == Qt.Orientation.Horizontal:
38 direction = QBoxLayout.LeftToRight 38 direction = QBoxLayout.Direction.LeftToRight
39 else: 39 else:
40 direction = QBoxLayout.TopToBottom 40 direction = QBoxLayout.Direction.TopToBottom
41 self.__layout = QBoxLayout(direction, self) 41 self.__layout = QBoxLayout(direction, self)
42 self.setLayout(self.__layout) 42 self.setLayout(self.__layout)
43 43
44 self.__preview = QLabel(self) 44 self.__preview = QLabel(self)
45 self.__preview.setFrameStyle(QFrame.Panel | QFrame.Sunken) 45 self.__preview.setFrameStyle(QFrame.Shape.Panel | QFrame.Shadow.Sunken)
46 self.__preview.setFixedHeight(64) 46 self.__preview.setFixedHeight(64)
47 self.__preview.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) 47 self.__preview.setAlignment(
48 Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter)
48 self.__preview.setWhatsThis(self.tr( 49 self.__preview.setWhatsThis(self.tr(
49 """<b>Preview</b>""" 50 """<b>Preview</b>"""
50 """<p>This is a 1:1 preview of the current icon.</p>""" 51 """<p>This is a 1:1 preview of the current icon.</p>"""
51 )) 52 ))
52 self.__layout.addWidget(self.__preview) 53 self.__layout.addWidget(self.__preview)
53 54
54 self.__color = QLabel(self) 55 self.__color = QLabel(self)
55 self.__color.setFrameStyle(QFrame.Panel | QFrame.Sunken) 56 self.__color.setFrameStyle(QFrame.Shape.Panel | QFrame.Shadow.Sunken)
56 self.__color.setFixedHeight(24) 57 self.__color.setFixedHeight(24)
57 self.__color.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) 58 self.__color.setAlignment(
59 Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter)
58 self.__color.setWhatsThis(self.tr( 60 self.__color.setWhatsThis(self.tr(
59 """<b>Current Color</b>""" 61 """<b>Current Color</b>"""
60 """<p>This is the currently selected color used for drawing.</p>""" 62 """<p>This is the currently selected color used for drawing.</p>"""
61 )) 63 ))
62 self.__layout.addWidget(self.__color) 64 self.__layout.addWidget(self.__color)
63 65
64 self.__colorTxt = QLabel(self) 66 self.__colorTxt = QLabel(self)
65 self.__colorTxt.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) 67 self.__colorTxt.setAlignment(
68 Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter)
66 self.__colorTxt.setWhatsThis(self.tr( 69 self.__colorTxt.setWhatsThis(self.tr(
67 """<b>Current Color Value</b>""" 70 """<b>Current Color Value</b>"""
68 """<p>This is the currently selected color value used for""" 71 """<p>This is the currently selected color value used for"""
69 """ drawing.</p>""" 72 """ drawing.</p>"""
70 )) 73 ))
111 self.__compositingChanged) 114 self.__compositingChanged)
112 self.__compositingGroupLayout.addWidget(self.__sourceOverButton) 115 self.__compositingGroupLayout.addWidget(self.__sourceOverButton)
113 self.__layout.addWidget(self.__compositingGroup) 116 self.__layout.addWidget(self.__compositingGroup)
114 117
115 spacer = QSpacerItem( 118 spacer = QSpacerItem(
116 10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) 119 10, 10, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
117 self.__layout.addItem(spacer) 120 self.__layout.addItem(spacer)
118 121
119 def previewChanged(self, pixmap): 122 def previewChanged(self, pixmap):
120 """ 123 """
121 Public slot to update the preview. 124 Public slot to update the preview.
168 """ 171 """
169 Public method to set the compositing mode. 172 Public method to set the compositing mode.
170 173
171 @param mode compositing mode to set (QPainter.CompositionMode) 174 @param mode compositing mode to set (QPainter.CompositionMode)
172 """ 175 """
173 if mode == QPainter.CompositionMode_Source: 176 if mode == QPainter.CompositionMode.CompositionMode_Source:
174 self.__sourceButton.setChecked(True) 177 self.__sourceButton.setChecked(True)
175 elif mode == QPainter.CompositionMode_SourceOver: 178 elif mode == QPainter.CompositionMode.CompositionMode_SourceOver:
176 self.__sourceOverButton.setChecked(True) 179 self.__sourceOverButton.setChecked(True)
177 180
178 def __compositingChanged(self, on): 181 def __compositingChanged(self, on):
179 """ 182 """
180 Private slot to handle a change of the compositing mode. 183 Private slot to handle a change of the compositing mode.
183 (boolean) 186 (boolean)
184 """ 187 """
185 if on: 188 if on:
186 if self.__sourceButton.isChecked(): 189 if self.__sourceButton.isChecked():
187 self.compositingChanged.emit( 190 self.compositingChanged.emit(
188 QPainter.CompositionMode_Source) 191 QPainter.CompositionMode.CompositionMode_Source)
189 elif self.__sourceOverButton.isChecked(): 192 elif self.__sourceOverButton.isChecked():
190 self.compositingChanged.emit( 193 self.compositingChanged.emit(
191 QPainter.CompositionMode_SourceOver) 194 QPainter.CompositionMode.CompositionMode_SourceOver)

eric ide

mercurial