def on_playback_toggle_pause(self, event_type, player, track): """ Starts or stops update timer """ if player.is_playing(): self.__enable_timer() elif player.is_paused(): self.__disable_timer()
def __init__(self, player): Playlist.__init__( self, _('History') ) # catch the history event.add_ui_callback( self.__on_playback_track_start, 'playback_track_start', player ) if player.is_paused() or player.is_playing(): self.__on_playback_track_start( 'playback_track_start', player, player.current )
def factory(name, after, player): if player.is_playing(): icon_name = 'media-playback-pause' label = _("_Pause") else: icon_name = 'media-playback-start' label = _("P_lay") return menu.simple_menu_item(name, after, label, icon_name, callback=lambda *args: playpause(player) )
def factory(name, after, player): if player.is_playing(): icon_name = 'media-playback-pause' label = _("_Pause") else: icon_name = 'media-playback-start' label = _("P_lay") return menu.simple_menu_item( name, after, label, icon_name, callback=lambda *args: playpause(player) )
def factory(menu, parent, context): if player.is_playing(): stock_id = gtk.STOCK_MEDIA_PAUSE else: stock_id = gtk.STOCK_MEDIA_PLAY item = gtk.ImageMenuItem(stock_id) item.connect('activate', lambda *args: playpause( player ), name, parent, context) return item
def on_playback_toggle_pause(self, e, player, track): """ Shows the OSD after resuming playback """ if not player.is_playing(): return glib.idle_add(self.show) try: glib.source_remove(self.get_data('hide-id')) except: pass if self.props.autohide: self.set_data('hide-id', glib.timeout_add_seconds( self.__options['display_duration'], self.hide))
def on_playback_toggle_pause(self, e, player, track): """ Shows the OSD after resuming playback """ if not player.is_playing(): return GLib.idle_add(self.show) try: GLib.source_remove(self.hide_id) except Exception: pass finally: self.hide_id = None if self.props.autohide: self.hide_id = GLib.timeout_add_seconds( self.__options['display_duration'], self.hide)
def on_pause_action(type, player, track): if player.is_playing(): on_begin_action(type, player, track) else: on_stop_action(type, player, track)