Aren Olson avatar Aren Olson committed e2c24b6

back to synchronous events we go...

Comments (0)

Files changed (9)

plugins/contextinfo/__init__.py

     def async_update_field(self, field):
         field = field.split(':')
         self.update_field(field[0], *field[1:])
-        event.log_event('loading_finished', self, None, async=True)
+        event.log_event('loading_finished', self, None)
 
     def update_field(self, name, *params):
         try:
         except:
             self[name] = ''
         if name in [f[0] for f in self.get_template_fields()]:
-            event.log_event('field_refresh', self, (name, self[name]), async=True)
+            event.log_event('field_refresh', self, (name, self[name]))
 
     def fill_fields(self):
         for field in self.get_template_fields():
         for field in self.get_template_fields():
             if field[0] in self.async and field[0] not in self.data.keys():
                 self.update_field(*field)
-        event.log_event('loading_finished', self, None, async=True)
+        event.log_event('loading_finished', self, None)
 
     def format_template(self):
         temp = self.data.copy()
             self.refresh_rating()
             for field in ['rating', 'track-info']:
                 if field in self.get_template_fields():
-                    event.log_event('field_refresh', self, (field, str(self[field])), async=False)
+                    event.log_event('field_refresh', self, (field, str(self[field])))
             return True
 
     def _title(self):

plugins/equalizer/__init__.py

 import os, string
 
 def enable(exaile):
-    providers.register("stream_element", GSTEqualizer)
+    providers.register("postprocessing_element", GSTEqualizer)
     if exaile.loading:
         event.add_callback(_enable, 'gui_loaded')
     else:
     EQ_MAIN = EqualizerPlugin(exaile)
 
 def disable(exaile):
-    providers.unregister("stream_element", GSTEqualizer)
+    providers.unregister("postprocessing_element", GSTEqualizer)
     global EQ_MAIN
     EQ_MAIN.disable()
     EQ_MAIN = None
 
         self.collection.rescan_libraries()
 
-        # idle_add is a hack to ensure it only gets removed AFTER all
-        # events have been sent. remove when we get a better solution.
-        glib.idle_add(event.remove_callback, self.on_scan_progress_update,
+        event.remove_callback(self.on_scan_progress_update,
             'scan_progress_update')
 
 class Collection(trax.TrackDB):
 
             # progress update
             if notify_interval is not None and count % notify_interval == 0:
-                event.log_event_sync('tracks_scanned', self, count)
+                event.log_event('tracks_scanned', self, count)
 
         # final progress update
         if notify_interval is not None:
-            event.log_event_sync('tracks_scanned', self, count)
+            event.log_event('tracks_scanned', self, count)
 
 
 
 Events are kind of like signals, except they may be listened for on a
 global scale, rather than connected on a per-object basis like signals
 are. This means that ANY object can emit ANY event, and these events may
-be listened for by ANY object. Events may be emitted either syncronously
-or asyncronously, the default is asyncronous.
-
-The events module also provides an idle_add() function similar to that of
-glib. However this should not be used for long-running tasks as they
-may block other events queued via idle_add().
+be listened for by ANY object.
 
 Events should be emitted AFTER the given event has taken place. Often the
 most appropriate spot is immediately before a return statement.
 
 _NONE = Nothing() # used by event for a safe None replacement
 
-def log_event(type, obj, data, async=True):
+def log_event(type, obj, data):
     """
         Sends an event.
 
         type: the 'type' or 'name' of the event. [string]
         obj: the object sending the event. [object]
         data: some data about the event, None if not required [object]
-        async: whether or not to emit asyncronously. [bool]
     """
     global EVENT_MANAGER
     e = Event(type, obj, data, time.time())
-    if async:
-        EVENT_MANAGER.emit_async(e)
-    else:
-        EVENT_MANAGER.emit(e)
-
-def log_event_sync(type, obj, data, async=False):
-    # same as log_event, but defaults to synchronous
-    log_event(type, obj, data, async)
+    EVENT_MANAGER.emit(e)
 
 def add_callback(function, type=None, obj=None, *args, **kwargs):
     """
         # to be saved in any particular order. modules that might be
         # touched by events triggered here should be added statically
         # below.
-        event.log_event("quit_application", self, None, async=False)
+        event.log_event("quit_application", self, None)
 
         logger.info("Saving state...")
         self.plugins.save_enabled()

xl/player/_base.py

         """
             Called when there is an error during playback
         """
-        event.log_event('playback_error', self, message, async=False)
+        event.log_event('playback_error', self, message)
         self.stop()
 
     def tag_func(self, *args):

xl/player/engine_normal.py

 
         playing = self.is_playing()
 
+        if not playing:
+            event.log_event('playback_reconfigure_bins', self, None)
+
         self._current = track
 
         uri = track.get_loc_for_io()

xl/player/engine_unified.py

             else:
                 self.unlink_stream(self.streams[self._current_stream])
 
+        if not playing:
+            event.log_event('playback_reconfigure_bins', self, None)
+
         self.streams[next] = AudioStream("Stream%s"%(next), caps=self.caps)
         self.streams[next].dec.connect("drained", self._on_drained,
                 self.streams[next])

xl/player/pipe.py

         self.src = None
         self.sink = None
 
+        event.add_callback(self.on_reconfigure_bins, 'playback_reconfigure_bins')
+
+    def on_reconfigure_bins(self, *args):
+        self.setup_elements()
+
     def setup_elements(self):
         state = self.get_state()[1]
 
-        if self.srcpad is not None:
+        if False: #self.srcpad is not None:
             self.srcpad.set_blocked_async(True, self._setup_finish, state)
         else:
             self._setup_finish(None, True, state)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.