GitHub PullRequestReviewCommentEvent at 2014-04-15 01:36:04
Repository: vispy
Actor: Eric89GXL
Payload: {"comment":{"url":"https://api.github.com/repos/vispy/vispy/pulls/comments/11616997","id":11616997,"diff_hunk":"@@ -223,22 +241,56 @@ def source(self, s):\n         else:\n             self._source = weakref.ref(s)\n \n-    def connect(self, callback):\n+    def connect(self, callback, before=None, after=None):\n         \"\"\"Connect this emitter to a new callback.\n \n-        *callback* may be either a callable object or a tuple\n-        (object, attr_name) where object.attr_name will point to a callable\n-        object.\n-\n-        If the callback is already connected, then the request is ignored.\n-\n-        The new callback will be added to the beginning of the callback list;\n-        thus the callback that is connected _last_ will be the _first_ to\n-        receive events from the emitter.\n+        Parameters\n+        ----------\n+        callback : function | tuple\n+            *callback* may be either a callable object or a tuple\n+            (object, attr_name) where object.attr_name will point to a\n+            callable object.\n+        before : callback | list of callback | None\n+            List of callbacks that the current callback should precede.\n+            Can be True to put at the start of the list. Can be None\n+            if no before-criteria should be used.\n+        after : callback | list of callback | True | None\n+            List of callbacks that the current callback should follow.\n+            Can be True to put at the end of the list. Can be None if\n+            no after-criteria should be used.\n+\n+        Notes\n+        -----\n+        If the specified callback is already connected, then the request is\n+        ignored.\n+\n+        If before is None and after is None (default), the new callback will\n+        be added to the beginning of the callback list. (This is why there\n+        is no \"before=True\" option -- it is the default behavior). Thus the\n+        callback that is connected _last_ will be the _first_ to receive\n+        events from the emitter. Similarly, when using \"before\" and \"after\"\n+        arguments simultaneously, the earliest slot in the list that\n+        satisfies both conditions will be used.\n         \"\"\"\n         if callback in self.callbacks:\n             return\n-        self.callbacks.insert(0, callback)\n+        if (before is None and after is None) or before is True:  # at start","path":"vispy/util/event.py","position":65,"original_position":73,"commit_id":"89e933a4a87d6628c3f1a905cfff4a441615a9a5","original_commit_id":"6624917c7bdd2fbaf6f56d836a32f2be090cf69a","user":{"login":"Eric89GXL","id":2365790,"avatar_url":"https://avatars.githubusercontent.com/u/2365790?","gravatar_id":"bfd1a4884c9621f28ee42e38f652db99","url":"https://api.github.com/users/Eric89GXL","html_url":"https://github.com/Eric89GXL","followers_url":"https://api.github.com/users/Eric89GXL/followers","following_url":"https://api.github.com/users/Eric89GXL/following{/other_user}","gists_url":"https://api.github.com/users/Eric89GXL/gists{/gist_id}","starred_url":"https://api.github.com/users/Eric89GXL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eric89GXL/subscriptions","organizations_url":"https://api.github.com/users/Eric89GXL/orgs","repos_url":"https://api.github.com/users/Eric89GXL/repos","events_url":"https://api.github.com/users/Eric89GXL/events{/privacy}","received_events_url":"https://api.github.com/users/Eric89GXL/received_events","type":"User","site_admin":false},"body":"(If you don't feel it's worth the effort, I can easily just copy-paste.)","created_at":"2014-04-15T01:36:04Z","updated_at":"2014-04-15T01:36:04Z","html_url":"https://github.com/vispy/vispy/pull/225#discussion_r11616997","pull_request_url":"https://api.github.com/repos/vispy/vispy/pulls/225","_links":{"self":{"href":"https://api.github.com/repos/vispy/vispy/pulls/comments/11616997"},"html":{"href":"https://github.com/vispy/vispy/pull/225#discussion_r11616997"},"pull_request":{"href":"https://api.github.com/repos/vispy/vispy/pulls/225"}}}}