eric6/Preferences/ConfigurationPages/NotificationsPage.py

changeset 7945
76daafe10009
parent 7923
91e843545d9a
child 7952
1849f61cf2b6
--- a/eric6/Preferences/ConfigurationPages/NotificationsPage.py	Sat Jan 02 17:28:57 2021 +0100
+++ b/eric6/Preferences/ConfigurationPages/NotificationsPage.py	Sun Jan 03 15:33:39 2021 +0100
@@ -16,8 +16,6 @@
 import Preferences
 import UI.PixmapCache
 
-from Globals import qVersionTuple
-
 
 class NotificationsPage(ConfigurationPageBase, Ui_NotificationsPage):
     """
@@ -33,27 +31,19 @@
         
         minX, maxX = self.xSpinBox.maximum(), self.xSpinBox.minimum()
         minY, maxY = self.ySpinBox.maximum(), self.ySpinBox.minimum()
-        if qVersionTuple() >= (5, 10, 0):
-            for screen in QApplication.screens():
-                geom = screen.availableGeometry()
-                minX = min(minX, geom.x())
-                maxX = max(maxX, geom.x() + geom.width())
-                minY = min(minY, geom.y())
-                maxY = max(maxY, geom.y() + geom.height())
-        else:
-            desk = QApplication.desktop()
-            for screen in range(desk.screenCount()):
-                geom = desk.availableGeometry(screen)
-                minX = min(minX, geom.x())
-                maxX = max(maxX, geom.x() + geom.width())
-                minY = min(minY, geom.y())
-                maxY = max(maxY, geom.y() + geom.height())
+        for screen in QApplication.screens():
+            geom = screen.availableGeometry()
+            minX = min(minX, geom.x())
+            maxX = max(maxX, geom.x() + geom.width())
+            minY = min(minY, geom.y())
+            maxY = max(maxY, geom.y() + geom.height())
         self.xSpinBox.setMinimum(minX)
         self.xSpinBox.setMaximum(maxX)
         self.ySpinBox.setMinimum(minY)
         self.ySpinBox.setMaximum(maxY)
         
         self.__notification = None
+        self.__firstTime = True
         
         # set initial values
         self.enableCheckBox.setChecked(
@@ -93,6 +83,13 @@
             self.__notification.move(
                 QPoint(self.xSpinBox.value(), self.ySpinBox.value()))
             self.__notification.show()
+            if self.__firstTime:
+                # adjust the maximum values to the width of the notification
+                self.xSpinBox.setMaximum(
+                    self.xSpinBox.maximum() - self.__notification.width())
+                self.ySpinBox.setMaximum(
+                    self.ySpinBox.maximum() - self.__notification.height())
+                self.__firstTime = False
         else:
             # retrieve the position
             point = self.__notification.frameGeometry().topLeft()

eric ide

mercurial