curds: Rename Notify.notify_cancel() -> Notify.cancel()
It's a little less wordy and redundant this way Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
92817e1e7a
commit
93206b95b2
|
@ -14,7 +14,7 @@ class Notify:
|
|||
else:
|
||||
func(*args)
|
||||
|
||||
def notify_cancel(name, func, queue=False):
|
||||
def cancel(name, func, queue=False):
|
||||
cb = Notify.notifications.get(name, [])
|
||||
if (func, queue) in cb:
|
||||
cb.remove((func, queue))
|
||||
|
|
|
@ -26,4 +26,4 @@ class TestCollectionPlaylist(unittest.TestCase):
|
|||
self.assertTrue(plist.set_loop(False))
|
||||
self.assertTrue(plist.loop)
|
||||
|
||||
notify.Notify.notify_cancel("new-track", plist.add)
|
||||
notify.Notify.cancel("new-track", plist.add)
|
||||
|
|
|
@ -23,8 +23,8 @@ class TestPlaylistManager(unittest.TestCase):
|
|||
self.cb_plist = None
|
||||
|
||||
def tearDown(self):
|
||||
notify.Notify.notify_cancel("new-track", self.playman["Collection"].add)
|
||||
notify.Notify.notify_cancel("new-library-playlist", self.on_new_library)
|
||||
notify.Notify.cancel("new-track", self.playman["Collection"].add)
|
||||
notify.Notify.cancel("new-library-playlist", self.on_new_library)
|
||||
library.stop()
|
||||
|
||||
def on_new_library(self, plist):
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestPlaylist(unittest.TestCase):
|
|||
self.cb_index = None
|
||||
|
||||
def tearDown(self):
|
||||
notify.Notify.notify_cancel("add-track", self.on_add)
|
||||
notify.Notify.cancel("add-track", self.on_add)
|
||||
|
||||
def on_add(self, plist, track, index):
|
||||
self.cb_plist = plist
|
||||
|
|
|
@ -16,7 +16,7 @@ class TestPreviousPlaylist(unittest.TestCase):
|
|||
self.cb_index = 0
|
||||
|
||||
def tearDown(self):
|
||||
notify.Notify.notify_cancel("add-track", self.on_add_track)
|
||||
notify.Notify.cancel("add-track", self.on_add_track)
|
||||
|
||||
def on_add_track(self, plist, track, index):
|
||||
if isinstance(plist, previous.PreviousPlaylist):
|
||||
|
|
|
@ -43,12 +43,12 @@ class TestNotify(unittest.TestCase):
|
|||
notify.Notify.notify("no-cb", "Please", "Don't", "Crash")
|
||||
self.assertFalse(notify.Notify.run_queued())
|
||||
|
||||
notify.Notify.notify_cancel("on-test", self.on_test2)
|
||||
notify.Notify.cancel("on-test", self.on_test2)
|
||||
self.assertEqual(notify.Notify.notifications, {"on-test" : [ (self.on_test1, False),
|
||||
(self.on_test3, True) ]})
|
||||
notify.Notify.notify_cancel("on-test", self.on_test1)
|
||||
notify.Notify.cancel("on-test", self.on_test1)
|
||||
self.assertEqual(notify.Notify.notifications, {"on-test" : [ (self.on_test3, True) ]})
|
||||
notify.Notify.notify_cancel("on-test", self.on_test3, True)
|
||||
notify.Notify.cancel("on-test", self.on_test3, True)
|
||||
self.assertEqual(notify.Notify.notifications, { })
|
||||
notify.Notify.notify_cancel("on-test", self.on_test1)
|
||||
notify.Notify.cancel("on-test", self.on_test1)
|
||||
self.assertEqual(notify.Notify.notifications, { })
|
||||
|
|
|
@ -13,7 +13,7 @@ class TestAlbumTag(unittest.TestCase):
|
|||
self.cb_album = None
|
||||
|
||||
def tearDown(self):
|
||||
notify.Notify.notify_cancel("new-album", self.on_new_album)
|
||||
notify.Notify.cancel("new-album", self.on_new_album)
|
||||
|
||||
def on_new_album(self, album):
|
||||
self.cb_album = album
|
||||
|
|
|
@ -13,7 +13,7 @@ class TestTrackTag(unittest.TestCase):
|
|||
self.cb_track = None
|
||||
|
||||
def tearDown(self):
|
||||
notify.Notify.notify_cancel("new-track", self.on_new_track)
|
||||
notify.Notify.cancel("new-track", self.on_new_track)
|
||||
|
||||
def on_new_track(self, track):
|
||||
self.cb_track = track
|
||||
|
|
Loading…
Reference in New Issue