def _enable(eventname, exaile, nothing): global plugin if plugin is None: plugin = BPMCounterPlugin() event.remove_callback(_enable, 'gui_loaded')
def disable(exaile): global MPRIS2 MPRIS2.unregister_events() MPRIS2.release() event.remove_callback(_clean_tmp, 'quit_application') if _WINDOW_STATE_HANDLER is not None: exaile.gui.main.window.disconnect(_WINDOW_STATE_HANDLER)
def set_auto_update(self, auto_update): """ Sets whether the info pane shall be automatically updated or not :param auto_update: enable or disable automatic updating :type auto_update: bool """ if auto_update != self.__auto_update: self.__auto_update = auto_update p_evts = ['playback_player_end', 'playback_track_start', 'playback_toggle_pause', 'playback_error'] events = ['track_tags_changed', 'cover_set', 'cover_removed'] if auto_update: for e in p_evts: event.add_ui_callback(getattr(self, 'on_%s' % e), e, self.__player) for e in events: event.add_ui_callback(getattr(self, 'on_%s' % e), e) self.set_track(self.__player.current) else: for e in p_evts: event.remove_callback(getattr(self, 'on_%s' % e), e, self.__player) for e in events: event.remove_callback(getattr(self, 'on_%s' % e), e)
def disable(exaile): global ExaileModbar ExaileModbar.changeModToBar() event.remove_callback(ExaileModbar.play_start, 'playback_track_start', player.PLAYER) event.remove_callback(ExaileModbar.play_end, 'playback_player_end', player.PLAYER) ExaileModbar.destroy() ExaileModbar = None
def remove_callbacks(self): event.remove_callback(self.playback_cb, "playback_track_start") event.remove_callback(self.on_track_tags_changed, "track_tags_changed") event.remove_callback(self.end_cb, "playback_player_end") event.remove_callback(self.search_method_added_cb, "lyrics_search_method_added") event.remove_callback(self.on_option_set, "plugin_lyricsviewer_option_set") self.notebook.disconnect(self.style_handler)
def destroy(self): """ Cleanups """ event.remove_callback(self.on_option_set, 'player_option_set') ButtonControl.destroy(self) Gtk.VolumeButton.destroy(self)
def _seek_delayed(self, type, object, value): """ internal code used if seek is called before the stream is ready """ if self._settle_flag == 1 or object != self: return event.remove_callback(self._seek_delayed, type, object) self._seek_event.set()
def remove_callbacks(self): event.remove_callback(self.playback_cb, 'playback_track_start') event.remove_callback(self.on_track_tags_changed, 'track_tags_changed') event.remove_callback(self.end_cb, 'playback_player_end') event.remove_callback(self.search_method_added_cb, 'lyrics_search_method_added') event.remove_callback(self.on_option_set, 'plugin_lyricsviewer_option_set')
def destroy(self): """ Cleanups """ event.remove_callback(self.on_option_set, 'plugin_osd_option_set') event.remove_callback(self.on_track_tags_changed, 'track_tags_changed') gtk.Window.destroy(self)
def destroy(self): """ Cleanups """ event.remove_callback(self.on_option_set, 'plugin_osd_option_set') event.remove_callback(self.on_track_tags_changed, 'track_tags_changed') Gtk.Window.destroy(self)
def disable(exaile): global _PLUGIN for signal in PLAYBACK_START_CALLBACKS: event.remove_callback(_PLUGIN.on_playback_start, signal) for signal in PLAYBACK_STOP_CALLBACKS: event.remove_callback(_PLUGIN.on_playback_stop, signal) _PLUGIN.stop()
def destroy(self): """ Cleanups """ if self.filename is not None and os.path.exists(self.filename): os.remove(self.filename) self.filename = None event.remove_callback(self.on_quit_application, "quit-application")
def destroy(self): """ Cleanups """ if self.filename is not None and os.path.exists(self.filename): os.remove(self.filename) self.filename = None event.remove_callback(self.on_quit_application, 'quit-application')
def disable(exaile): _disable_main_moodbar() event.remove_callback(_enable_preview_moodbar, 'preview_device_enabled') event.remove_callback(_disable_preview_moodbar, 'preview_device_disabling') preview_plugin = _get_preview_plugin_if_active(exaile) if getattr(preview_plugin, 'hooked', False): _disable_preview_moodbar('', preview_plugin, None)
def disable(exaile): global TRAY_CONTROL event.remove_callback(TRAY_CONTROL.onPlay, TRACK_START_CALLBACK) event.remove_callback(TRAY_CONTROL.onPlay, RESUME_CALLBACK) event.remove_callback(TRAY_CONTROL.onEnd, END_CALLBACK) event.remove_callback(TRAY_CONTROL.onPause, PAUSE_CALLBACK) event.remove_callback(TRAY_CONTROL.on_setting_change, OPTIONS_CALLBACK) for icon in TRAY_CONTROL.icons: del icon.icon print "TrayControl plugin disabled"
def run(self): """ Runs the thread """ event.add_callback(self.on_track_transfer_progress, 'track_transfer_progress', self.device.transfer) try: self.device.start_transfer() finally: event.remove_callback(self.on_track_transfer_progress, 'track_transfer_progress', self.device.transfer)
def load(self, page): if self.currentpage != page: event.remove_callback(self.on_field_refresh, 'field_refresh', self.currentpage) event.remove_callback(self.on_page_loaded, 'loading_finished', self.currentpage) event.add_callback(self.on_field_refresh, 'field_refresh', page) event.add_callback(self.on_page_loaded, 'loading_finished', page) self.currentpage = page self.refresh_button.set_sensitive(False) self.refresh_button_image.set_from_animation(self.refresh_animation) self.loaded = False self.load_string(self.currentpage.get_html(), "text/html", "utf-8", "file://%s" % self.theme.path)
def run(self): """ Runs the thread """ event.add_ui_callback(self.on_track_transfer_progress, 'track_transfer_progress', self.device.transfer) try: self.device.start_transfer() finally: event.remove_callback(self.on_track_transfer_progress, 'track_transfer_progress', self.device.transfer)
def on_playlist_tracks_added(self, event_name, playlist, tracks): """ Starts playing the newly added tracks """ if tracks: position, track = tracks[0] playlist.current_position = position player.QUEUE.play(track) event.remove_callback(self.on_playlist_tracks_added, 'playlist_tracks_added')
def remove_callbacks(self): event.remove_callback( self.play_start, 'playback_track_start', self.player ) event.remove_callback( self.play_end, 'playback_player_end', self.player )
def run(self): """ Runs the thread """ event.add_callback(self.on_scan_progress_update, 'scan_progress_update') self.collection.rescan_libraries(startup_only=self.startup_scan) event.remove_callback(self.on_scan_progress_update, 'scan_progress_update')
def run(self): """ Runs the thread """ event.add_callback(self.on_scan_progress_update, 'scan_progress_update') self.collection.rescan_libraries(startup_only=self.startup_scan, force_update=self.force_update) event.remove_callback(self.on_scan_progress_update, 'scan_progress_update')
def teardown(self, _exaile): """ Shuts down the on screen display plugin """ do_assert(self.__window is not None) self.__window.destroy_osd() event.remove_callback(self.__on_option_set, 'plugin_osd_option_set') event.remove_callback(self.__on_playback_track_start, 'playback_track_start') event.remove_callback(self.__on_playback_toggle_pause, 'playback_toggle_pause') event.remove_callback(self.__on_playback_player_end, 'playback_player_end') event.remove_callback(self.__on_playback_error, 'playback_error') self.__window = None
def destroy(self): """ Cleans up """ if self.countdown is not None: GLib.source_remove(self.countdown) event.remove_callback(self.on_playback_player_end, "playback_player_end") for item in providers.get("menubar-tools-menu"): if item.name == "shutdown": providers.unregister("menubar-tools-menu", item) break
def destroy(self): """ Cleans up """ if self.countdown is not None: glib.source_remove(self.countdown) event.remove_callback(self.on_playback_player_end, 'playback_player_end') for item in providers.get('menubar-tools-menu'): if item.name == 'shutdown': providers.unregister('menubar-tools-menu', item) break
def destroy(self): """ Cleans up """ if self.countdown is not None: GLib.source_remove(self.countdown) event.remove_callback(self.on_playback_player_end, 'playback_player_end') for item in providers.get('menubar-tools-menu'): if item.name == 'shutdown': providers.unregister('menubar-tools-menu', item) break
def stop(self): """ Stops submitting """ logger.info("Stopping AudioScrobbler submissions") if self.use_menu: self.remove_menu() if self.connected: event.remove_callback(self.on_play, 'playback_track_start', player.PLAYER) event.remove_callback(self.on_stop, 'playback_track_end', player.PLAYER) self.connected = False self.save_cache() providers.unregister('mainwindow-accelerators',self.accelerator)
def _destroy_gui(self): event.remove_callback(self._on_option_set, 'option_set') for provide in self.preview_provides: providers.unregister(provide, self.preview_menuitem) providers.unregister('menubar-view-menu', self.menu) self.info_area.destroy() self.playpause_button.destroy() self.pane2_box.destroy() self.pane1_box.destroy() self.pane.destroy()
def stop(self): """ Stops submitting """ logger.info("Stopping AudioScrobbler submissions") if self.use_menu: self.remove_menu() if self.connected: event.remove_callback(self.on_play, "playback_track_start", player.PLAYER) event.remove_callback(self.on_stop, "playback_track_end", player.PLAYER) self.connected = False self.save_cache() providers.unregister("mainwindow-accelerators", self.accelerator)
def destroy(self): """ Cleanups """ event.remove_callback(self.on_option_set, 'plugin_lastfmlove_option_set') providers.unregister('tray-icon-context', self.tray_menu_item) providers.unregister('playlist-context-menu', self.menu_item) providers.unregister('playlist-columns-menu', self.column_menu_item) providers.unregister('playlist-columns', LoveColumn) if self.timer is not None and self.timer.is_alive(): self.timer.cancel()
def disable(exaile): event.remove_callback(on_stop_action, 'quit_application') event.remove_callback(on_stop_action, 'playback_player_end', player.PLAYER) event.remove_callback(on_begin_action, 'playback_track_start', player.PLAYER) event.remove_callback(on_pause_action, 'playback_toggle_pause', player.PLAYER)
def disable(exaile): ''' Plugin Disabled. ''' # disconnect from active shares if MANAGER is not None: # MANAGER.clear() MANAGER.close(True) for item in providers.get('menubar-tools-menu'): if item.name == 'daap': providers.unregister('menubar-tools-menu', item) break event.remove_callback(__enb, 'gui_loaded')
def disconnect_events(self): """ Disconnects various callbacks from events """ event.remove_callback(self.on_playback_change_state, 'playback_player_end', player.PLAYER) event.remove_callback(self.on_playback_change_state, 'playback_track_start', player.PLAYER) event.remove_callback(self.on_playback_change_state, 'playback_toggle_pause', player.PLAYER) event.remove_callback(self.on_playback_change_state, 'playback_error', player.PLAYER)
def disable(exaile): global TUNE_TO_PSI event.remove_callback(TUNE_TO_PSI.tune, "playback_track_start") event.remove_callback(TUNE_TO_PSI.GoFree, "playback_player_end") event.remove_callback(TUNE_TO_PSI.onPause, "playback_player_pause") event.remove_callback(TUNE_TO_PSI.GoFree, "quit_application") TUNE_TO_PSI.GoFree(None, None, None) print "TuneToPsi plugin disabled"
def disable(exaile): global TUNE_TO_PSI event.remove_callback(TUNE_TO_PSI.tune, 'playback_track_start') event.remove_callback(TUNE_TO_PSI.GoFree,'playback_player_end') event.remove_callback(TUNE_TO_PSI.onPause,'playback_player_pause') event.remove_callback(TUNE_TO_PSI.GoFree, 'quit_application') TUNE_TO_PSI.GoFree(None, None, None) print "TuneToPsi plugin disabled"
def disable_shutdown(self): self.do_shutdown = False event.remove_callback(self.on_playback_player_end, 'playback_player_end') # Stop possible countdown if self.countdown is not None: GLib.source_remove(self.countdown) self.countdown = None # Prepare for a new run self.counter = 10 # Reset message button layout self.message.hide() self.message.clear_buttons() self.message.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
def disable_shutdown(self): self.do_shutdown = False event.remove_callback(self.on_playback_player_end, "playback_player_end") # Stop possible countdown if self.countdown is not None: GLib.source_remove(self.countdown) self.countdown = None # Prepare for a new run self.counter = 10 # Reset message button layout self.message.hide() self.message.clear_buttons() self.message.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE)
def rescan_libraries(self, startup_only=False, force_update=False): """ Rescans all libraries associated with this Collection """ if self._scanning: raise Exception("Collection is already being scanned") if len(self.libraries) == 0: event.log_event('scan_progress_update', self, 100) return # no libraries, no need to scan :) self._scanning = True self._scan_stopped = False self.file_count = -1 # negative means we dont know it yet self.__count_files() scan_interval = 20 for library in self.libraries.values(): if (not force_update and startup_only and not (library.monitored and library.startup_scan)): continue event.add_callback(self._progress_update, 'tracks_scanned', library) library.rescan(notify_interval=scan_interval, force_update=force_update) event.remove_callback(self._progress_update, 'tracks_scanned', library) self._running_total_count += self._running_count if self._scan_stopped: break else: # didnt break try: if self.location is not None: self.save_to_location() except AttributeError: logger.exception("Exception occurred while saving") event.log_event('scan_progress_update', self, 100) self._running_total_count = 0 self._running_count = 0 self._scanning = False self.file_count = -1
def rescan_libraries(self, startup_only=False, force_update=False): """ Rescans all libraries associated with this Collection """ if self._scanning: raise Exception("Collection is already being scanned") if len(self.libraries) == 0: event.log_event('scan_progress_update', self, 100) return # no libraries, no need to scan :) self._scanning = True self._scan_stopped = False self.file_count = -1 # negative means we dont know it yet self.__count_files() scan_interval = 20 for library in self.libraries.itervalues(): if not force_update and startup_only and not (library.monitored and library.startup_scan): continue event.add_callback(self._progress_update, 'tracks_scanned', library) library.rescan(notify_interval=scan_interval, force_update=force_update) event.remove_callback(self._progress_update, 'tracks_scanned', library) self._running_total_count += self._running_count if self._scan_stopped: break else: # didnt break try: if self.location is not None: self.save_to_location() except AttributeError: logger.exception("Exception occurred while saving") event.log_event('scan_progress_update', self, 100) self._running_total_count = 0 self._running_count = 0 self._scanning = False self.file_count = -1
def destroy(self): """ Cleanups """ event.remove_callback(self.on_queue_current_playlist_changed, 'queue_current_playlist_changed', self.__queue) event.remove_callback(self.__on_playlist_current_position_changed, 'playlist_current_position_changed') event.remove_callback(self.__on_playlist_tracks_added, 'playlist_tracks_added') event.remove_callback(self.__on_playlist_tracks_removed, 'playlist_tracks_removed')
def disable(self, exaile): '''Called when the plugin is disabled''' if self.tools_menuitem: providers.unregister('menubar-tools-menu', self.tools_menuitem) for item in self.provider_items: providers.unregister('playlist-context-menu', item) providers.unregister('track-panel-menu', item) self.tools_menuitem = None self.provider_items = [] if self.tag_dialog: self.tag_dialog.destroy() self.tag_dialog = None # de-register the exaile events event.remove_callback(self.on_playback_track_start, 'playback_track_start') event.remove_callback( self.on_playlist_cursor_changed, 'playlist_cursor_changed' ) event.remove_callback( self.on_plugin_options_set, 'plugin_grouptagger_option_set' ) providers.unregister('main-panel', self.panel)
def __unregister_events(self): event.remove_callback(self.check_to_load_more, 'playback_track_start') event.remove_callback(self.close_playlist, 'quit_application') event.remove_callback(self.play_feedback, 'playback_track_end') if self.dbus_controller: self.dbus_controller.unregister_events()
def destroy(self): """ Cleanups """ if self._player is not None: event.remove_callback( self.on_rating_update, 'playback_track_start', self._player ) event.remove_callback( self.on_rating_update, 'playback_track_end', self._player ) event.remove_callback( self.on_rating_update, 'rating_changed')
def destroy(self): """ Cleanups """ for e in self._events: if 'playback' in e: event.remove_callback(getattr(self, 'on_%s' % e), e, player.PLAYER) else: event.remove_callback(getattr(self, 'on_%s' % e), e) event.remove_callback(self.on_option_set, 'plugin_desktopcover_option_set') Gtk.Window.destroy(self)