eric6/QScintilla/MarkupProviders/ImageMarkupDialog.py

changeset 7267
aedc309827c7
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7266:d001bc703c29 7267:aedc309827c7
128 self.__aspectRatio = 1 128 self.__aspectRatio = 1
129 else: 129 else:
130 self.widthSpinBox.setValue(image.width()) 130 self.widthSpinBox.setValue(image.width())
131 self.heightSpinBox.setValue(image.height()) 131 self.heightSpinBox.setValue(image.height())
132 self.__originalImageSize = image.size() 132 self.__originalImageSize = image.size()
133 self.__aspectRatio = \ 133 self.__aspectRatio = (
134 float(self.__originalImageSize.height()) / \ 134 float(self.__originalImageSize.height()) /
135 self.__originalImageSize.width() 135 self.__originalImageSize.width()
136 )
136 else: 137 else:
137 self.widthSpinBox.setValue(0) 138 self.widthSpinBox.setValue(0)
138 self.heightSpinBox.setValue(0) 139 self.heightSpinBox.setValue(0)
139 self.__originalImageSize = QSize() 140 self.__originalImageSize = QSize()
140 self.__aspectRatio = 1 141 self.__aspectRatio = 1
181 Private slot to adjust the height spin box. 182 Private slot to adjust the height spin box.
182 183
183 @param width width for the image 184 @param width width for the image
184 @type int 185 @type int
185 """ 186 """
186 if self.aspectRatioCheckBox.isChecked() and \ 187 if (
187 self.widthSpinBox.hasFocus(): 188 self.aspectRatioCheckBox.isChecked() and
189 self.widthSpinBox.hasFocus()
190 ):
188 height = width * self.__aspectRatio 191 height = width * self.__aspectRatio
189 self.heightSpinBox.setValue(height) 192 self.heightSpinBox.setValue(height)
190 193
191 @pyqtSlot(int) 194 @pyqtSlot(int)
192 def on_heightSpinBox_valueChanged(self, height): 195 def on_heightSpinBox_valueChanged(self, height):
194 Private slot to adjust the width spin box. 197 Private slot to adjust the width spin box.
195 198
196 @param height height for the image 199 @param height height for the image
197 @type int 200 @type int
198 """ 201 """
199 if self.aspectRatioCheckBox.isChecked() and \ 202 if (
200 self.heightSpinBox.hasFocus(): 203 self.aspectRatioCheckBox.isChecked() and
204 self.heightSpinBox.hasFocus()
205 ):
201 width = height / self.__aspectRatio 206 width = height / self.__aspectRatio
202 self.widthSpinBox.setValue(width) 207 self.widthSpinBox.setValue(width)
203 208
204 def getData(self): 209 def getData(self):
205 """ 210 """

eric ide

mercurial