def __init__(self, exaile, caps): self.__exaile = exaile self.__old_icon = None self.__tray_connection = None notification = Notify.Notification.new("", None, None) if 'sound' in caps: notification.set_hint('suppress-sound', GLib.Variant.new_boolean(True)) self.settings.can_show_markup = 'body-markup' in caps notification.set_urgency(Notify.Urgency.LOW) notification.set_timeout(Notify.EXPIRES_DEFAULT) # default action is invoked on clicking the notification notification.add_action("default", "this should never be displayed", self.__on_default_action) self.notification = notification PlaybackAdapter.__init__(self, xl_player.PLAYER) xl_event.add_callback(self.on_option_set, 'plugin_notify_option_set') xl_event.add_callback(self.on_option_set, 'gui_option_set') # initial setup through options: self.on_option_set(None, xl_settings, notifyprefs.TrayHover.name) self.on_option_set(None, xl_settings, notifyprefs.ShowCovers.name)
def __init__(self, exaile, caps): self.__exaile = exaile self.__old_icon = None self.__tray_connection = None notification = Notify.Notification.new("", None, None) if 'sound' in caps: notification.set_hint('suppress-sound', GLib.Variant.new_boolean(True)) self.settings.can_show_markup = 'body-markup' in caps notification.set_urgency(Notify.Urgency.LOW) notification.set_timeout(Notify.EXPIRES_DEFAULT) # default action is invoked on clicking the notification notification.add_action( "default", "this should never be displayed", self.__on_default_action ) self.notification = notification PlaybackAdapter.__init__(self, xl_player.PLAYER) xl_event.add_callback(self.on_option_set, 'plugin_notify_option_set') xl_event.add_callback(self.on_option_set, 'gui_option_set') # initial setup through options: self.on_option_set(None, xl_settings, notifyprefs.TrayHover.name) self.on_option_set(None, xl_settings, notifyprefs.ShowCovers.name)
def __init__(self): """ Initializes the window """ Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL) # for whatever reason, calling set_opacity seems # to crash on Windows when using PyGTK that comes with # the GStreamer SDK. Since this plugin is enabled by # default, just don't fade in/out on windows # # https://bugs.freedesktop.org/show_bug.cgi?id=54682 self.use_fade = True if sys.platform == 'win32': self.use_fade = False self.fadeout_id = None self.drag_origin = None self.hide_id = None self.set_type_hint(Gdk.WindowTypeHint.NOTIFICATION) self.set_title('Exaile OSD') self.set_decorated(False) self.set_keep_above(True) self.set_skip_pager_hint(True) self.set_skip_taskbar_hint(True) self.set_resizable(True) self.set_app_paintable(True) self.stick() self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.POINTER_MOTION_MASK) # Cached option values self.__options = { 'background': None, 'display_duration': None, 'border_radius': None } self.info_area = info.TrackInfoPane(player.PLAYER) self.info_area.set_default_text('') self.info_area.set_auto_update(True) self.add(self.info_area) event.add_callback(self.on_track_tags_changed, 'track_tags_changed') event.add_callback(self.on_option_set, 'plugin_osd_option_set') # Trigger initial setup trough options for option in ('format', 'background', 'display_duration', 'show_progress', 'position', 'width', 'height', 'border_radius'): self.on_option_set('plugin_osd_option_set', settings, 'plugin/osd/{option}'.format(option=option)) # Trigger color map update self.emit('screen-changed', self.get_screen()) PlaybackAdapter.__init__(self, player.PLAYER)
def destroy(self): PlaybackAdapter.destroy(self) self.__set_tray_hover_state(False) notification = self.notification # must be called on separate thread, since it is a synchronous call and might block self.__close_notification(notification) self.notification.clear_actions() self.notification = None self.__exaile = None
def destroy(self): """ Cleanups """ PlaybackAdapter.destroy(self) ButtonControl.destroy(self)
def __init__(self): ButtonControl.__init__(self) PlaybackAdapter.__init__(self, player.PLAYER) self.update_state()