- def _remove_throbber(self, timeline, actor):
- """
- Callback function for timeline that fades out photograph menu throbber.
- This is called when animation is finished and we are free to remove
- throbber from memory.
- @param timeline: clutter.Timeline object
- @param actor: clutter.Actor object
- """
- # TODO: Figure out if/how timeline and actor should be used
- self.throbber.hide()
- self.remove(self.throbber)
- del self.throbber
-
def _update_image_info(self, number):
"""
Update image information box.
=== modified file 'entertainerlib/frontend/gui/widgets/grid_menu.py'
--- entertainerlib/frontend/gui/widgets/grid_menu.py 2008-11-17 21:45:53 +0000
+++ entertainerlib/frontend/gui/widgets/grid_menu.py 2009-01-03 15:16:54 +0000
@@ -60,7 +60,6 @@ self.active = True # Is this menu active self.content_timeline = None # Content scroll timeline self.cursor_timeline = None # Cursor move timeline
- self.optimize_memory = False # Should we optimize memory usage
- def optimize_memory_usage(self, boolean):
- """
- This method can be used to change widget's memory consuption. When
- memory usage is optimized, only visible menuitems are kept in memory.
- This saves memory, but the menu might be slower when scrolled.
- @param boolean: True to set optimize on, False to disable optimization
- """
- #FIXME: When changed relize or unrealize needed menuitems.
- self.optimize_memory = boolean
-
def set_cursor(self, cursor):
"""
Set cursor actor. This is usually a Texture or clutter.Rectangle.
@@ -423,7 +412,6 @@
if cur_y == 0: if con_y > 0: self._move_content(1, self.DOWN)
- self._update_memory_state() else: self._move_cursor(self.UP)
elif direction == self.DOWN:
@@ -432,7 +420,6 @@ else: if con_y < content_scroll_max: self._move_content(1, self.UP)
- self._update_memory_state()
elif direction == self.LEFT:
if cur_x > 0: self._move_cursor(self.LEFT)
@@ -452,7 +439,6 @@
if cur_x == 0: if con_x > 0: self._move_content(1, self.RIGHT)
- self._update_memory_state() else: self._move_cursor(self.LEFT)
elif direction == self.RIGHT:
@@ -461,7 +447,6 @@ else: if con_x < content_scroll_max: self._move_content(1, self.LEFT)
- self._update_memory_state()
old_position = self.logical_position
@@ -636,24 +621,6 @@
elif direction == self.LEFT: self.itemgroup.move_by(-x_offset, 0)
- def _update_memory_state(self):
- """This method checks which menuitems are currently on screen area.
-
- Menuitems that are not on screen at the moment are freed from the
- memory. This is done by calling clutter.Actor.unrealize() -method.
- This way large menus consume same amount memory as smaller menus. This
- method is called every time after content (menuitems) is moved.
- """
- # DEBUG information
- #print "content position: " + str(self.content_position)
- #print "row count: " + str(self.row_count)
- #print "cell count: " + str(self.visible_cols)
-
- if self.optimize_memory:
- # TODO: Implement this method. Relize textures on screen and
- # unrealize other textures
- pass
-
def _scale_menuitem(self, menuitem):
"""
Scale menuitem to fit into one cell. Preserves actor's aspect ratio.
- def testAlbumGetAlbumArtUrlNot(self):
- #TODO: doc string for get_album_art_url mentions raising an exception.
- # I don't see it anywhere handled anywhere.
- pass
-
def testAlbumGetTracks(self):
"""Test that all tracks for an album are returned"""
result = self.album.get_tracks()
- def testAddFeed(self):
- """
- testAddFeed: This tests the add_feed function of the FeedLibrary
- """
- #TODO testAddFeed needs writing
- pass
-
def testRemoveFeed(self):
""" testRemoveFeed: Tests FeedLibrary.remove_feed()
@@ -99,13 +92,15 @@
def testIsEmptyWhenFull(self):
"""
- testIsEmptyWhenFull: Tests FeedLibrary.is_empty() when there are feeds in database
+ testIsEmptyWhenFull: Tests FeedLibrary.is_empty() when there are feeds
+ in database
""" self.assertFalse(self.library.is_empty())
def testIsEmptyWhenEmpty(self):
"""
- testIsEmptyWhenEmpty: Tests FeedLibrary.is_empty() when the feed list is empty
+ testIsEmptyWhenEmpty: Tests FeedLibrary.is_empty() when the feed list
+ is empty
"""
for i in range(10): self.library.remove_feed("url"+str(i))
- def testGetCompactDiscInformation(self):
- """testGetCompactDiscInformation - Ensures compact disc information
- is returned"""
- #TODO: write this test
- pass
-
- def testGetPlaylist(self):
- #TODO: write this test, set up the playlist test table
- pass
-
- def testGetNumberOfTracksOnPlaylist(self):
- #TODO: write this test, set up the playlist test table
- pass
-
- def testGetTracksOnPlaylist(self):
- #TODO: write this test, set up the playlist test table
- pass
-
def testGetAllArtists(self): """testGetAllArtists - Ensures that all artists are returned from
the music library"""
@@ -149,7 +131,4 @@ '') self.musiclibrary.save_lyrics(self.track, 'some lyrics here') self.assertEqual(self.track.get_lyrics(), 'some lyrics here')
- #TODO: create second half of this test to check that lyrics were saved
- # to storage by creating a new track from the database and checking its
- # lyrics value
- def testTrackFetchLyrics(self):
- """testTrackFetchLyrics - Ensures that lyrics fetching is correctly
- handled by LyricsDownloader"""
- #TODO: write this test, how do you mock the LyricsDownloader that is
- # interal to this function?
- pass
-
- def testTrackFetchLyricsNoCallback(self):
- """testTrackFetchLyricsNoCallback - Ensures lyrics are at least set
- when no callback function is entered"""
- #TODO: write this test
- pass
-
def testTrackGetLyrics(self): """testTrackGetLyrics - Ensures that the lyrics are returned"""
result = self.track.get_lyrics()
=== modified file 'entertainerlib /frontend/ gui/screens/ photographs_ screen. py' frontend/ gui/screens/ photographs_ screen. py 2008-12-05 18:26:33 +0000 frontend/ gui/screens/ photographs_ screen. py 2009-01-03 15:16:54 +0000
photographs[ 1:]) show_effects( ): Timeline( 35, 26) Alpha(timeline, clutter. smoothstep_ inc_func) BehaviourOpacit y(255, 0, alpha) apply(self. throbber) connect( 'completed' , self._remove_ throbber, None) hide() self.throbber) hide()
--- entertainerlib/
+++ entertainerlib/
@@ -98,32 +98,9 @@
return False
else:
- if self.config.
- timeline = clutter.
- alpha = clutter.
- self.behaviour = clutter.
- self.behaviour.
- timeline.
- timeline.start()
- else:
- self.throbber.
- self.remove(
- del self.throbber
+ self.throbber.
return False
- def _remove_ throbber( self, timeline, actor): hide() self.throbber) image_info( self, number):
- """
- Callback function for timeline that fades out photograph menu throbber.
- This is called when animation is finished and we are free to remove
- throbber from memory.
- @param timeline: clutter.Timeline object
- @param actor: clutter.Actor object
- """
- # TODO: Figure out if/how timeline and actor should be used
- self.throbber.
- self.remove(
- del self.throbber
-
def _update_
"""
Update image information box.
=== modified file 'entertainerlib /frontend/ gui/widgets/ grid_menu. py' frontend/ gui/widgets/ grid_menu. py 2008-11-17 21:45:53 +0000 frontend/ gui/widgets/ grid_menu. py 2009-01-03 15:16:54 +0000
self. active = True # Is this menu active
self. content_ timeline = None # Content scroll timeline
self. cursor_ timeline = None # Cursor move timeline memory = False # Should we optimize memory usage
--- entertainerlib/
+++ entertainerlib/
@@ -60,7 +60,6 @@
- self.optimize_
@@ -69,16 +68,6 @@
c.set_ color(( 255, 0, 0, 128))
self. set_cursor( c)
- def optimize_ memory_ usage(self, boolean): memory = boolean
if con_y > 0:
self. _move_content( 1, self.DOWN) memory_ state()
else:
self._move_ cursor( self.UP)
else:
if con_y < content_scroll_max:
self. _move_content( 1, self.UP) memory_ state()
self._move_ cursor( self.LEFT)
if con_x > 0:
self. _move_content( 1, self.RIGHT) memory_ state()
else:
self._move_ cursor( self.LEFT)
else:
if con_x < content_scroll_max:
self. _move_content( 1, self.LEFT) memory_ state()
- """
- This method can be used to change widget's memory consuption. When
- memory usage is optimized, only visible menuitems are kept in memory.
- This saves memory, but the menu might be slower when scrolled.
- @param boolean: True to set optimize on, False to disable optimization
- """
- #FIXME: When changed relize or unrealize needed menuitems.
- self.optimize_
-
def set_cursor(self, cursor):
"""
Set cursor actor. This is usually a Texture or clutter.Rectangle.
@@ -423,7 +412,6 @@
if cur_y == 0:
- self._update_
elif direction == self.DOWN:
@@ -432,7 +420,6 @@
- self._update_
elif direction == self.LEFT:
if cur_x > 0:
@@ -452,7 +439,6 @@
if cur_x == 0:
- self._update_
elif direction == self.RIGHT:
@@ -461,7 +447,6 @@
- self._update_
@@ -636,24 +621,6 @@
self. itemgroup. move_by( -x_offset, 0)
elif direction == self.LEFT:
- def _update_ memory_ state(self) : Actor.unrealize () -method. content_ position) visible_ cols) memory: menuitem( self, menuitem):
- """This method checks which menuitems are currently on screen area.
-
- Menuitems that are not on screen at the moment are freed from the
- memory. This is done by calling clutter.
- This way large menus consume same amount memory as smaller menus. This
- method is called every time after content (menuitems) is moved.
- """
- # DEBUG information
- #print "content position: " + str(self.
- #print "row count: " + str(self.row_count)
- #print "cell count: " + str(self.
-
- if self.optimize_
- # TODO: Implement this method. Relize textures on screen and
- # unrealize other textures
- pass
-
def _scale_
"""
Scale menuitem to fit into one cell. Preserves actor's aspect ratio.
=== modified file 'entertainerlib /tests/ Album_test. py' tests/Album_ test.py 2008-10-25 17:56:14 +0000 tests/Album_ test.py 2009-01-03 15:16:54 +0000 join(self. art_path, album_artist + ".jpg")
self. assertEqual( result, album_art)
--- entertainerlib/
+++ entertainerlib/
@@ -67,11 +67,6 @@
album_art = os.path.
- def testAlbumGetAlb umArtUrlNot( self): cks(self) : get_tracks( )
- #TODO: doc string for get_album_art_url mentions raising an exception.
- # I don't see it anywhere handled anywhere.
- pass
-
def testAlbumGetTra
"""Test that all tracks for an album are returned"""
result = self.album.
=== modified file 'entertainerlib /tests/ FrontendFeedLib rary_test. py' tests/FrontendF eedLibrary_ test.py 2008-10-25 17:56:14 +0000 tests/FrontendF eedLibrary_ test.py 2009-01-03 15:16:54 +0000
TestCommon. tearDown( self)
--- entertainerlib/
+++ entertainerlib/
@@ -83,13 +83,6 @@
"""
- def testAddFeed(self): self):
testRemoveFee d: Tests FeedLibrary. remove_ feed()
- """
- testAddFeed: This tests the add_feed function of the FeedLibrary
- """
- #TODO testAddFeed needs writing
- pass
-
def testRemoveFeed(
"""
@@ -99,13 +92,15 @@
def testIsEmptyWhen Full(self) : Full: Tests FeedLibrary. is_empty( ) when there are feeds in database Full: Tests FeedLibrary. is_empty( ) when there are feeds
self. assertFalse( self.library. is_empty( ))
"""
- testIsEmptyWhen
+ testIsEmptyWhen
+ in database
"""
def testIsEmptyWhen Empty(self) : Empty: Tests FeedLibrary. is_empty( ) when the feed list is empty Empty: Tests FeedLibrary. is_empty( ) when the feed list
self. library. remove_ feed("url" +str(i) )
"""
- testIsEmptyWhen
+ testIsEmptyWhen
+ is empty
"""
for i in range(10):
=== modified file 'entertainerlib /tests/ MusicLibrary_ test.py' tests/MusicLibr ary_test. py 2008-10-25 17:56:14 +0000 tests/MusicLibr ary_test. py 2009-01-03 15:16:54 +0000
self. assertTrue( isinstance( self.musiclibra ry, MusicLibrary))
--- entertainerlib/
+++ entertainerlib/
@@ -31,24 +31,6 @@
class"""
- def testGetCompactD iscInformation( self): ctDiscInformati on - Ensures compact disc information (self): TracksOnPlaylis t(self) : Playlist( self): ts(self) :
"""testGetAll Artists - Ensures that all artists are returned from
'')
self. musiclibrary. save_lyrics( self.track, 'some lyrics here')
self. assertEqual( self.track. get_lyrics( ), 'some lyrics here')
- """testGetCompa
- is returned"""
- #TODO: write this test
- pass
-
- def testGetPlaylist
- #TODO: write this test, set up the playlist test table
- pass
-
- def testGetNumberOf
- #TODO: write this test, set up the playlist test table
- pass
-
- def testGetTracksOn
- #TODO: write this test, set up the playlist test table
- pass
-
def testGetAllArtis
the music library"""
@@ -149,7 +131,4 @@
- #TODO: create second half of this test to check that lyrics were saved
- # to storage by creating a new track from the database and checking its
- # lyrics value
=== modified file 'entertainerlib /tests/ Track_test. py' tests/Track_ test.py 2008-10-25 17:56:14 +0000 tests/Track_ test.py 2009-01-03 15:16:54 +0000 get_comment( )
self. assertEqual( result, 'comment')
--- entertainerlib/
+++ entertainerlib/
@@ -148,19 +148,6 @@
result = self.track.
- def testTrackFetchL yrics(self) : chLyrics - Ensures that lyrics fetching is correctly yricsNoCallback (self): chLyricsNoCallb ack - Ensures lyrics are at least set ics(self) :
"""testTrackG etLyrics - Ensures that the lyrics are returned""" get_lyrics( )
- """testTrackFet
- handled by LyricsDownloader"""
- #TODO: write this test, how do you mock the LyricsDownloader that is
- # interal to this function?
- pass
-
- def testTrackFetchL
- """testTrackFet
- when no callback function is entered"""
- #TODO: write this test
- pass
-
def testTrackGetLyr
result = self.track.