Ported a few Python 3.10 related changes from eric7. eric6

Wed, 03 Nov 2021 19:17:00 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 03 Nov 2021 19:17:00 +0100
branch
eric6
changeset 8758
c3f57225c305
parent 8742
f27e0226becd

Ported a few Python 3.10 related changes from eric7.

eric6/E5Gui/E5MapWidget.py file | annotate | diff | comparison | revisions
eric6/E5Gui/E5ToolButton.py file | annotate | diff | comparison | revisions
eric6/Network/IRC/IrcChannelWidget.py file | annotate | diff | comparison | revisions
eric6/Network/IRC/IrcWidget.py file | annotate | diff | comparison | revisions
eric6/Preferences/ConfigurationPages/ConfigurationPageBase.py file | annotate | diff | comparison | revisions
--- a/eric6/E5Gui/E5MapWidget.py	Mon Nov 01 09:29:46 2021 +0100
+++ b/eric6/E5Gui/E5MapWidget.py	Wed Nov 03 19:17:00 2021 +0100
@@ -228,7 +228,7 @@
         if event.button() == Qt.MouseButton.LeftButton and self._master:
             vsb = self._master.verticalScrollBar()
             value = self.position2Value(event.pos().y() - 1)
-            vsb.setValue(value - 0.5 * vsb.pageStep())  # center on page
+            vsb.setValue(int(value - 0.5 * vsb.pageStep()))  # center on page
         self.__mousePressPos = None
     
     def mouseMoveEvent(self, event):
@@ -240,7 +240,7 @@
         if event.buttons() & Qt.MouseButton.LeftButton and self._master:
             vsb = self._master.verticalScrollBar()
             value = self.position2Value(event.pos().y() - 1)
-            vsb.setValue(value - 0.5 * vsb.pageStep())  # center on page
+            vsb.setValue(int(value - 0.5 * vsb.pageStep()))  # center on page
     
     def wheelEvent(self, event):
         """
@@ -308,7 +308,8 @@
         if self._master:
             offset = 0 if slider else 1
             vsb = self._master.verticalScrollBar()
-            return (value - vsb.minimum()) * self.scaleFactor(slider) + offset
+            return int((value - vsb.minimum()) * self.scaleFactor(slider) +
+                       offset)
         else:
             return value
     
--- a/eric6/E5Gui/E5ToolButton.py	Mon Nov 01 09:29:46 2021 +0100
+++ b/eric6/E5Gui/E5ToolButton.py	Wed Nov 03 19:17:00 2021 +0100
@@ -59,7 +59,7 @@
         
         self.__badgeLabel = QLabel(self)
         font = self.__badgeLabel.font()
-        font.setPixelSize(self.__badgeLabel.height() / 2.5)
+        font.setPixelSize(int(self.__badgeLabel.height() / 2.5))
         self.__badgeLabel.setFont(font)
         self.__badgeLabel.hide()
         
--- a/eric6/Network/IRC/IrcChannelWidget.py	Mon Nov 01 09:29:46 2021 +0100
+++ b/eric6/Network/IRC/IrcChannelWidget.py	Wed Nov 03 19:17:00 2021 +0100
@@ -261,7 +261,7 @@
         self.editTopicButton.hide()
         
         height = self.usersList.height() + self.messages.height()
-        self.splitter.setSizes([height * 0.3, height * 0.7])
+        self.splitter.setSizes([int(height * 0.3), int(height * 0.7)])
         
         self.__initMessagesMenu()
         self.__initUsersMenu()
--- a/eric6/Network/IRC/IrcWidget.py	Mon Nov 01 09:29:46 2021 +0100
+++ b/eric6/Network/IRC/IrcWidget.py	Wed Nov 03 19:17:00 2021 +0100
@@ -72,7 +72,7 @@
             self.channelsWidget.setTabPosition(QTabWidget.TabPosition.South)
         
         height = self.height()
-        self.splitter.setSizes([height * 0.6, height * 0.4])
+        self.splitter.setSizes([int(height * 0.6), int(height * 0.4)])
         
         self.__channelList = []
         self.__channelTypePrefixes = ""
--- a/eric6/Preferences/ConfigurationPages/ConfigurationPageBase.py	Mon Nov 01 09:29:46 2021 +0100
+++ b/eric6/Preferences/ConfigurationPages/ConfigurationPageBase.py	Wed Nov 03 19:17:00 2021 +0100
@@ -62,7 +62,7 @@
         """
         colour = QColor(prefMethod(colourKey))
         size = button.size()
-        pm = QPixmap(size.width() / 2, size.height() / 2)
+        pm = QPixmap(size.width() // 2, size.height() // 2)
         pm.fill(colour)
         button.setIconSize(pm.size())
         button.setIcon(QIcon(pm))

eric ide

mercurial