Sat, 04 Dec 2021 15:34:40 +0100
Fixed an issue with respect to type conversion from float to int in the Graphics package.
--- a/eric7/Graphics/ClassItem.py Sat Dec 04 11:49:27 2021 +0100 +++ b/eric7/Graphics/ClassItem.py Sat Dec 04 15:34:40 2021 +0100 @@ -161,14 +161,14 @@ attrs = self.model.getInstanceAttributes() meths = self.model.getMethods() - x = self.margin + self.rect().x() - y = self.margin + self.rect().y() + x = self.margin + int(self.rect().x()) + y = self.margin + int(self.rect().y()) self.header = QGraphicsSimpleTextItem(self) self.header.setBrush(self._colors[0]) self.header.setFont(boldFont) self.header.setText(self.model.getName()) self.header.setPos(x, y) - y += self.header.boundingRect().height() + self.margin + y += int(self.header.boundingRect().height()) + self.margin if self.external: self.classAttributes = None @@ -185,7 +185,8 @@ self.classAttributes.setFont(self.font) self.classAttributes.setText(txt) self.classAttributes.setPos(x, y) - y += self.classAttributes.boundingRect().height() + self.margin + y += (int(self.classAttributes.boundingRect().height()) + + self.margin) if not self.noAttrs and not self.external: txt = QCoreApplication.translate( @@ -200,7 +201,7 @@ self.attrs.setFont(self.font) self.attrs.setText(txt) self.attrs.setPos(x, y) - y += self.attrs.boundingRect().height() + self.margin + y += int(self.attrs.boundingRect().height()) + self.margin else: self.attrs = None @@ -226,19 +227,24 @@ if self.model is None: return - width = self.header.boundingRect().width() - height = self.header.boundingRect().height() + width = int(self.header.boundingRect().width()) + height = int(self.header.boundingRect().height()) if self.classAttributes: - width = max(width, self.classAttributes.boundingRect().width()) + width = max(width, + int(self.classAttributes.boundingRect().width())) height += ( - self.classAttributes.boundingRect().height() + self.margin + int(self.classAttributes.boundingRect().height()) + self.margin ) if self.attrs: - width = max(width, self.attrs.boundingRect().width()) - height = height + self.attrs.boundingRect().height() + self.margin + width = max(width, + int(self.attrs.boundingRect().width())) + height = ( + height + int(self.attrs.boundingRect().height()) + self.margin + ) if self.meths: - width = max(width, self.meths.boundingRect().width()) - height += self.meths.boundingRect().height() + width = max(width, + int(self.meths.boundingRect().width())) + height += int(self.meths.boundingRect().height()) self.setSize(width + 2 * self.margin, height + 2 * self.margin) @@ -288,20 +294,23 @@ painter.setBrush(self.brush()) painter.setFont(self.font) - offsetX = self.rect().x() - offsetY = self.rect().y() - w = self.rect().width() - h = self.rect().height() + offsetX = int(self.rect().x()) + offsetY = int(self.rect().y()) + w = int(self.rect().width()) + h = int(self.rect().height()) painter.drawRect(offsetX, offsetY, w, h) - y = self.margin + self.header.boundingRect().height() + y = self.margin + int(self.header.boundingRect().height()) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) if self.classAttributes: - y += self.margin + self.classAttributes.boundingRect().height() + y += ( + self.margin + + int(self.classAttributes.boundingRect().height()) + ) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) if self.attrs: - y += self.margin + self.attrs.boundingRect().height() + y += self.margin + int(self.attrs.boundingRect().height()) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y)
--- a/eric7/Graphics/ModuleItem.py Sat Dec 04 11:49:27 2021 +0100 +++ b/eric7/Graphics/ModuleItem.py Sat Dec 04 15:34:40 2021 +0100 @@ -96,14 +96,14 @@ classes = self.model.getClasses() - x = self.margin + self.rect().x() - y = self.margin + self.rect().y() + x = self.margin + int(self.rect().x()) + y = self.margin + int(self.rect().y()) self.header = QGraphicsSimpleTextItem(self) self.header.setBrush(self._colors[0]) self.header.setFont(boldFont) self.header.setText(self.model.getName()) self.header.setPos(x, y) - y += self.header.boundingRect().height() + self.margin + y += int(self.header.boundingRect().height()) + self.margin txt = "\n".join(classes) if classes else " " self.classes = QGraphicsSimpleTextItem(self) self.classes.setBrush(self._colors[0]) @@ -118,11 +118,11 @@ if self.model is None: return - width = self.header.boundingRect().width() - height = self.header.boundingRect().height() + width = int(self.header.boundingRect().width()) + height = int(self.header.boundingRect().height()) if self.classes: - width = max(width, self.classes.boundingRect().width()) - height += self.classes.boundingRect().height() + width = max(width, int(self.classes.boundingRect().width())) + height += int(self.classes.boundingRect().height()) self.setSize(width + 2 * self.margin, height + 2 * self.margin) def setModel(self, model): @@ -165,13 +165,13 @@ painter.setBrush(self.brush()) painter.setFont(self.font) - offsetX = self.rect().x() - offsetY = self.rect().y() - w = self.rect().width() - h = self.rect().height() + offsetX = int(self.rect().x()) + offsetY = int(self.rect().y()) + w = int(self.rect().width()) + h = int(self.rect().height()) painter.drawRect(offsetX, offsetY, w, h) - y = self.margin + self.header.boundingRect().height() + y = self.margin + int(self.header.boundingRect().height()) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) self.adjustAssociations()
--- a/eric7/Graphics/PackageItem.py Sat Dec 04 11:49:27 2021 +0100 +++ b/eric7/Graphics/PackageItem.py Sat Dec 04 15:34:40 2021 +0100 @@ -102,14 +102,14 @@ modules = self.model.getModules() - x = self.margin + self.rect().x() - y = self.margin + self.rect().y() + x = self.margin + int(self.rect().x()) + y = self.margin + int(self.rect().y()) self.header = QGraphicsSimpleTextItem(self) self.header.setBrush(self._colors[0]) self.header.setFont(boldFont) self.header.setText(self.model.getName()) self.header.setPos(x, y) - y += self.header.boundingRect().height() + self.margin + y += int(self.header.boundingRect().height()) + self.margin if not self.noModules: if modules: @@ -131,20 +131,21 @@ if self.model is None: return - width = self.header.boundingRect().width() - height = self.header.boundingRect().height() + width = int(self.header.boundingRect().width()) + height = int(self.header.boundingRect().height()) if self.modules: - width = max(width, self.modules.boundingRect().width()) - height += self.modules.boundingRect().height() + width = max(width, + int(self.modules.boundingRect().width())) + height += int(self.modules.boundingRect().height()) latchW = width / 3.0 latchH = min(15.0, latchW) self.setSize(width + 2 * self.margin, height + latchH + 2 * self.margin) - x = self.margin + self.rect().x() - y = self.margin + self.rect().y() + latchH + x = self.margin + int(self.rect().x()) + y = self.margin + int(self.rect().y()) + latchH self.header.setPos(x, y) - y += self.header.boundingRect().height() + self.margin + y += int(self.header.boundingRect().height()) + self.margin if self.modules: self.modules.setPos(x, y) @@ -184,20 +185,20 @@ else: pen.setWidth(1) - offsetX = self.rect().x() - offsetY = self.rect().y() - w = self.rect().width() + offsetX = int(self.rect().x()) + offsetY = int(self.rect().y()) + w = int(self.rect().width()) latchW = w / 3.0 latchH = min(15.0, latchW) - h = self.rect().height() - latchH + 1 + h = int(self.rect().height() - latchH + 1) painter.setPen(pen) painter.setBrush(self.brush()) painter.setFont(self.font) - painter.drawRect(offsetX, offsetY, latchW, latchH) - painter.drawRect(offsetX, offsetY + latchH, w, h) - y = self.margin + self.header.boundingRect().height() + latchH + painter.drawRect(offsetX, offsetY, int(latchW), int(latchH)) + painter.drawRect(offsetX, offsetY + int(latchH), w, h) + y = int(self.margin + self.header.boundingRect().height() + latchH) painter.drawLine(offsetX, offsetY + y, offsetX + w - 1, offsetY + y) self.adjustAssociations()