Example #1
0
 def __init__(self, *args):
     NotifierBase.__init__(self, *args)
     self.app_name_format = NOTIFICATION_APP_NAME
     self.last_notification = None
     self.actual_notification_id = {}
     self.setup_dbusnotify()
     self.handles_actions = True
Example #2
0
    def __init__(self,
                 closed_cb=None,
                 action_cb=None,
                 size_x=DEFAULT_WIDTH,
                 size_y=DEFAULT_HEIGHT,
                 timeout=5):
        NotifierBase.__init__(self, closed_cb, action_cb)
        self.handles_actions = True
        """
        Create a new notification stack.  The recommended way to create Popup instances.
          Parameters:
            `size_x` : The desired width of the notifications.
            `size_y` : The desired minimum height of the notifications. If the text is
            longer it will be expanded to fit.
            `timeout` : Popup instance will disappear after this timeout if there
            is no human intervention. This can be overridden temporarily by passing
            a new timout to the new_popup method.
        """
        self.size_x = size_x
        self.size_y = size_y
        self.timeout = timeout
        """
        Other parameters:
        These will take effect for every popup created after the change.
            `max_popups` : The maximum number of popups to be shown on the screen
            at one time.
            `bg_color` : if None default is used (usually grey). set with a gdk.Color.
            `fg_color` : if None default is used (usually black). set with a gdk.Color.
            `show_timeout : if True, a countdown till destruction will be displayed.

        """
        self.max_popups = 5
        self.fg_color = DEFAULT_FG_COLOUR
        self.bg_color = DEFAULT_BG_COLOUR
        self.show_timeout = False

        self._notify_stack = []
        self._offset = 0

        display = display_get_default()
        screen = display.get_default_screen()
        n = screen.get_n_monitors()
        log("screen=%s, monitors=%s", screen, n)
        if n < 2:
            self.max_width = screen.get_width()
            self.max_height = screen.get_height()
            log("screen dimensions: %dx%d", self.max_width, self.max_height)
        else:
            rect = screen.get_monitor_geometry(0)
            self.max_width = rect.width
            self.max_height = rect.height
            log("first monitor dimensions: %dx%d", self.max_width,
                self.max_height)
        self.x = self.max_width - 20  #keep away from the edge
        self.y = self.max_height - 64  #space for a panel
        log("our reduced dimensions: %dx%d", self.x, self.y)
Example #3
0
 def __init__(self, closed_cb=None, action_cb=None):
     NotifierBase.__init__(self, closed_cb, action_cb)
     self.notifications = {}
     self.notification_center = NSUserNotificationCenter.defaultUserNotificationCenter(
     )
     assert self.notification_center
Example #4
0
 def __init__(self, *args):
     NotifierBase.__init__(self, *args)
     self.handles_actions = GTK_Notifier is not None
     self.gtk_notifier = None
     self.gtk_notifications = set()
     self.notification_handles = {}