Ejemplo n.º 1
0
 def on_visualButton_clicked(self, checked):
     """
     Private slot to select the position visually.
     
     @param checked state of the button (boolean)
     """
     if checked:
         from UI.NotificationWidget import NotificationWidget
         self.__notification = NotificationWidget(parent=self,
                                                  setPosition=True)
         self.__notification.setPixmap(
             UI.PixmapCache.getPixmap("notification48.png"))
         self.__notification.setHeading(self.tr("Visual Selection"))
         self.__notification.setText(
             self.tr("Drag the notification window to"
                     " the desired place and release the button."))
         self.__notification.move(
             QPoint(self.xSpinBox.value(), self.ySpinBox.value()))
         self.__notification.show()
     else:
         # retrieve the position
         point = self.__notification.frameGeometry().topLeft()
         self.xSpinBox.setValue(point.x())
         self.ySpinBox.setValue(point.y())
         self.__notification.close()
         self.__notification = None
Ejemplo n.º 2
0
 def on_visualButton_clicked(self, checked):
     """
     Private slot to select the position visually.
     
     @param checked state of the button (boolean)
     """
     if checked:
         from UI.NotificationWidget import NotificationWidget
         self.__notification = NotificationWidget(
             parent=self, setPosition=True)
         self.__notification.setPixmap(
             UI.PixmapCache.getPixmap("notification48.png"))
         self.__notification.setHeading(self.tr("Visual Selection"))
         self.__notification.setText(
             self.tr("Drag the notification window to"
                     " the desired place and release the button."))
         self.__notification.move(
             QPoint(self.xSpinBox.value(), self.ySpinBox.value()))
         self.__notification.show()
     else:
         # retrieve the position
         point = self.__notification.frameGeometry().topLeft()
         self.xSpinBox.setValue(point.x())
         self.ySpinBox.setValue(point.y())
         self.__notification.close()
         self.__notification = None
Ejemplo n.º 3
0
class NotificationsPage(ConfigurationPageBase, Ui_NotificationsPage):
    """
    Class implementing the Notifications configuration page.
    """
    def __init__(self):
        """
        Constructor
        """
        super(NotificationsPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("NotificationsPage")

        minX, maxX = self.xSpinBox.maximum(), self.xSpinBox.minimum()
        minY, maxY = self.ySpinBox.maximum(), self.ySpinBox.minimum()
        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())
        self.xSpinBox.setMinimum(minX)
        self.xSpinBox.setMaximum(maxX)
        self.ySpinBox.setMinimum(minY)
        self.ySpinBox.setMaximum(maxY)

        self.__notification = None

        # set initial values
        self.enableCheckBox.setChecked(
            Preferences.getUI("NotificationsEnabled"))
        self.timeoutSpinBox.setValue(Preferences.getUI("NotificationTimeout"))
        point = Preferences.getUI("NotificationPosition")
        self.xSpinBox.setValue(point.x())
        self.ySpinBox.setValue(point.y())

    def save(self):
        """
        Public slot to save the Notifications configuration.
        """
        Preferences.setUI("NotificationsEnabled",
                          self.enableCheckBox.isChecked())
        Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value())
        Preferences.setUI("NotificationPosition",
                          QPoint(self.xSpinBox.value(), self.ySpinBox.value()))

    @pyqtSlot(bool)
    def on_visualButton_clicked(self, checked):
        """
        Private slot to select the position visually.
        
        @param checked state of the button (boolean)
        """
        if checked:
            from UI.NotificationWidget import NotificationWidget
            self.__notification = NotificationWidget(parent=self,
                                                     setPosition=True)
            self.__notification.setPixmap(
                UI.PixmapCache.getPixmap("notification48.png"))
            self.__notification.setHeading(self.tr("Visual Selection"))
            self.__notification.setText(
                self.tr("Drag the notification window to"
                        " the desired place and release the button."))
            self.__notification.move(
                QPoint(self.xSpinBox.value(), self.ySpinBox.value()))
            self.__notification.show()
        else:
            # retrieve the position
            point = self.__notification.frameGeometry().topLeft()
            self.xSpinBox.setValue(point.x())
            self.ySpinBox.setValue(point.y())
            self.__notification.close()
            self.__notification = None
Ejemplo n.º 4
0
class NotificationsPage(ConfigurationPageBase, Ui_NotificationsPage):
    """
    Class implementing the Notifications configuration page.
    """

    def __init__(self):
        """
        Constructor
        """
        super(NotificationsPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("NotificationsPage")

        minX, maxX = self.xSpinBox.maximum(), self.xSpinBox.minimum()
        minY, maxY = self.ySpinBox.maximum(), self.ySpinBox.minimum()
        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())
        self.xSpinBox.setMinimum(minX)
        self.xSpinBox.setMaximum(maxX)
        self.ySpinBox.setMinimum(minY)
        self.ySpinBox.setMaximum(maxY)

        self.__notification = None

        # set initial values
        self.enableCheckBox.setChecked(Preferences.getUI("NotificationsEnabled"))
        self.timeoutSpinBox.setValue(Preferences.getUI("NotificationTimeout"))
        point = Preferences.getUI("NotificationPosition")
        self.xSpinBox.setValue(point.x())
        self.ySpinBox.setValue(point.y())

    def save(self):
        """
        Public slot to save the Notifications configuration.
        """
        Preferences.setUI("NotificationsEnabled", self.enableCheckBox.isChecked())
        Preferences.setUI("NotificationTimeout", self.timeoutSpinBox.value())
        Preferences.setUI("NotificationPosition", QPoint(self.xSpinBox.value(), self.ySpinBox.value()))

    @pyqtSlot(bool)
    def on_visualButton_clicked(self, checked):
        """
        Private slot to select the position visually.
        
        @param checked state of the button (boolean)
        """
        if checked:
            from UI.NotificationWidget import NotificationWidget

            self.__notification = NotificationWidget(parent=self, setPosition=True)
            self.__notification.setPixmap(UI.PixmapCache.getPixmap("notification48.png"))
            self.__notification.setHeading(self.tr("Visual Selection"))
            self.__notification.setText(
                self.tr("Drag the notification window to" " the desired place and release the button.")
            )
            self.__notification.move(QPoint(self.xSpinBox.value(), self.ySpinBox.value()))
            self.__notification.show()
        else:
            # retrieve the position
            point = self.__notification.frameGeometry().topLeft()
            self.xSpinBox.setValue(point.x())
            self.ySpinBox.setValue(point.y())
            self.__notification.close()
            self.__notification = None