Merge lp:~samuel-buffet/entertainer/more_base_on_widgets into lp:entertainer

Proposed by Samuel Buffet
Status: Merged
Approved by: Matt Layman
Approved revision: 394
Merged at revision: not available
Proposed branch: lp:~samuel-buffet/entertainer/more_base_on_widgets
Merge into: lp:entertainer
Diff against target: None lines
To merge this branch: bzr merge lp:~samuel-buffet/entertainer/more_base_on_widgets
Reviewer Review Type Date Requested Status
Matt Layman Approve
Review via email: mp+8092@code.launchpad.net

Commit message

More widgets now inherit from the Base Class.

To post a comment you must log in.
Revision history for this message
Samuel Buffet (samuel-buffet) wrote :

Devs,

This branch is there to continue what Matt started with Labels, Textures etc.

We have now more widgets inheriting from Base. I have excluded some widgets from this branch because either there's a refactoring in progress or an "idea" of refactoring.

Why base?

Not only it allows us to have readable instantiation of or widgets (avoiding the get_abs...) but it now also can be the Base (the name is really good Matt :)) of future work extending the Base Class.

I've also taken the opportunity to do some improvments and to create test for all the modified widgets (even if test is limited to a creation test for some of them).

Good review.
Samuel-

Revision history for this message
Matt Layman (mblayman) wrote :

Sweet, this is exactly the kind of clean up that I had envisioned doing with the rest of the widgets, but I never got around to it. Thanks for picking up that torch and running with it.

I didn't want to approve this branch immediately because I don't want Tarmac to auto-land it, but my comments that need fixing are very minor. Nice job.

I'm assuming that you've done some visual inspection of your changes to make sure things looked the same before and after your modifications.

GLOBAL:
 * Please kill or improve the init docstrings for the widget classes. Some are flat out wrong and most have the @param doxygen stuff that we aren't using.
 * What do you think about killing off the creat_indicator type methods that are in many of the screens? Those methods don't seem to do anything special that can't be done in init (especially since you've greatly simplified their creation).

album.py audio_play.py disc.py feed.py movie.py photo_albums.py photographs.py rss.py tv_episodes.py albums_tab.py artists_tab.py lyrics_tab.py movies_tab.py series_tab.py tracks_tab.py video_clips_tab.py arrow_texture.py eyecandy_texture.py:
 * No comments.

list_indicator.py:
 * I'm not sure about the modification for the "text_x_pos = width / 3" code. If I remember correctly, I think I set the code that way because the horizontal vs vertical orientation caused different spacing issues. Have you checked both? Have you checked both when there are many values in the indicator (e.g., some amount over 100)? You may have considered all these things and everything may be functioning perfectly, but I just wanted to highlight this because my brained raised a red flag when I saw those lines of code.

loading_animation.py:
 * set_anchor_point in init has incorrect spacing around the / characters.

reflection_texture.py:
 * No comments.

rounded_texture.py:
 * Is there a better variable than xx and yy? Those names are pretty vague.

scroll_area.py test_arrowtexture.py:
 * No comments.

test_eyecandytexture.py:
 * Import order is incorrect. os is a core module but gtk is not.

test_listindicator.py test_loadinganimation.py:
 * No comments.

test_reflectiontexture.py test_roundedtexture.py:
 * Import order is incorrect. os is a core module but gtk is not.

review: Needs Fixing
393. By Samuel Buffet

Fixes after Matt's comments.

Revision history for this message
Samuel Buffet (samuel-buffet) wrote :

Matt,

> I'm assuming that you've done some visual inspection of your changes to make
> sure things looked the same before and after your modifications.

Yes I've checked visually everything. There result is roughly the same but not exactly the same but I think that globally it's slightly improved. I remember to have made the LoadingAnimation on disc.py MUCH bigger.

> GLOBAL:
> * Please kill or improve the init docstrings for the widget classes. Some are
> flat out wrong and most have the @param doxygen stuff that we aren't using.

Removed.

> * What do you think about killing off the creat_indicator type methods that
> are in many of the screens? Those methods don't seem to do anything special
> that can't be done in init (especially since you've greatly simplified their
> creation).

Well I'm all for that. Was about to suggest that to you in fact :)
But I'd prefer to do that in another branch. I don't like to mix everything as you may have noticed. It's MUCH more easy to resolve merge conflicts when a branch does one and only one thing at the same time.

> list_indicator.py:
> * I'm not sure about the modification for the "text_x_pos = width / 3" code.
> If I remember correctly, I think I set the code that way because the
> horizontal vs vertical orientation caused different spacing issues. Have you
> checked both? Have you checked both when there are many values in the
> indicator (e.g., some amount over 100)? You may have considered all these
> things and everything may be functioning perfectly, but I just wanted to
> highlight this because my brained raised a red flag when I saw those lines of
> code.

Well, this modification gives better results on my screen but it may not be the same on yours. Could you please compare and report your result here? Thanks.

> loading_animation.py:
> * set_anchor_point in init has incorrect spacing around the / characters.

Yeah, /2 is now / 2

> rounded_texture.py:
> * Is there a better variable than xx and yy? Those names are pretty vague.

Those variables were useless. I've simply removed them.

> test_eyecandytexture.py:
> * Import order is incorrect. os is a core module but gtk is not.
>
> test_reflectiontexture.py test_roundedtexture.py:
> * Import order is incorrect. os is a core module but gtk is not.

Fixed.

Thanks for you review Matt.
Samuel-

Revision history for this message
Samuel Buffet (samuel-buffet) wrote :
Download full text (7.6 KiB)

incremental diff:

=== modified file 'entertainerlib/frontend/gui/widgets/arrow_texture.py'
--- entertainerlib/frontend/gui/widgets/arrow_texture.py 2009-06-30 20:11:01 +0000
+++ entertainerlib/frontend/gui/widgets/arrow_texture.py 2009-07-11 19:34:42 +0000
@@ -17,14 +17,6 @@
     ARC_TO_BEZIER = 0.55228475

     def __init__(self, x, y, size, fg_color, bg_color, direction):
- """
- Initialize ArrowTexture
- @param size: Width and height of the texture
- @param fg_color: Foreground color (arrows)
- @param bg_color: Background color (background)
- @param direction: Arrow direction UP,DOWN,RIGHT or LEFT (class
- constant)
- """
         Base.__init__(self)

         abs_size = self.get_abs_x(size)

=== modified file 'entertainerlib/frontend/gui/widgets/eyecandy_texture.py'
--- entertainerlib/frontend/gui/widgets/eyecandy_texture.py 2009-05-10 07:43:27 +0000
+++ entertainerlib/frontend/gui/widgets/eyecandy_texture.py 2009-07-11 19:34:42 +0000
@@ -16,10 +16,6 @@
     """

     def __init__(self, x, y, width, height, pixbuf):
- """
- Initialize new eye candy texture
- @param imagefile: Absoulte path to PNG file
- """
         Base.__init__(self)
         clutter.Group.__init__(self)

=== modified file 'entertainerlib/frontend/gui/widgets/list_indicator.py'
--- entertainerlib/frontend/gui/widgets/list_indicator.py 2009-05-10 07:43:27 +0000
+++ entertainerlib/frontend/gui/widgets/list_indicator.py 2009-07-11 19:34:42 +0000
@@ -20,12 +20,6 @@
     VERTICAL = 1

     def __init__(self, x, y, width, height, direction):
- """
- Initialize actor.
- @param width: Width of the widget in percentage (0-1)
- @param height: Height of the widget in percentage (0-1)
- @param direction: Direction (constant of this class)
- """
         Base.__init__(self)
         clutter.Group.__init__(self)

@@ -46,7 +40,7 @@

         text_x_pos = width / 3

- self.text = Label(height * 0.8, "text", text_x_pos, (height / 2),
+ self.text = Label(height * 0.8, "text", text_x_pos, height / 2,
             str(self.maximum) + self.delimiter + str(self.maximum))
         self.text.set_anchor_point_from_gravity(clutter.GRAVITY_CENTER)
         self.add(self.text)

=== modified file 'entertainerlib/frontend/gui/widgets/loading_animation.py'
--- entertainerlib/frontend/gui/widgets/loading_animation.py 2009-05-10 07:43:27 +0000
+++ entertainerlib/frontend/gui/widgets/loading_animation.py 2009-07-11 19:34:42 +0000
@@ -18,22 +18,13 @@

     def __init__(self, x, y, size=0.03, inner_radius=0.25, outter_radius=0.45,
             thickness=0.08):
- """
- Initialize LoadingAnimation
- @param size: Width and height of the texture
- @param fg_color: Foreground color
- @param bg_color: Background color
- @param inner_radius: Distance from origo to line start point 0-1
- @param outter_radius: Distance from origo to line end point 0-1
- @param thinkness: Lines thickness 0-1
- """
         Base.__init__(self)

         abs_size = self.get_abs_x(size)

         CairoTexture.__init__(...

Read more...

394. By Samuel Buffet

Back to previous behaviour of text_x_pos in list_indicator.py.

Revision history for this message
Matt Layman (mblayman) wrote :

Things look good now.

review: Approve
Revision history for this message
Paul Hummer (rockstar) wrote :
Download full text (123.5 KiB)

`which trial` entertainerlib.tests
entertainerlib.tests.test_arrowtexture
  ArrowTextureTest
    test_bounce ... /home/rockstar/.cache/entertainertree/entertainerlib/utils/theme.py:53: GtkWarning: gdk_pango_context_get_for_screen: assertion `GDK_IS_SCREEN (screen)' failed
/home/rockstar/.cache/entertainertree/entertainerlib/utils/theme.py:53: PangoWarning: pango_context_set_font_description: assertion `context != NULL' failed
/home/rockstar/.cache/entertainertree/entertainerlib/utils/theme.py:53: PangoWarning: pango_context_set_base_dir: assertion `context != NULL' failed
/home/rockstar/.cache/entertainertree/entertainerlib/utils/theme.py:53: PangoWarning: pango_context_set_language: assertion `context != NULL' failed
                                                    [ERROR]
    test_create ... [ERROR]
entertainerlib.tests.test_base
  BaseTest
    testCreate ... [OK]
    testGetAbsX ... [ERROR]
    testGetAbsY ... [ERROR]
entertainerlib.tests.test_configuration
  ConfigurationTest
    testBorg ... [OK]
    testCreate ... [OK]
    testGetCfgDir ... [OK]
    testGetSlideshowStep ... [OK]
    testGetStageHeight ... [ERROR]
    testGetStageWidth ... [ERROR]
    testGetThemeName ... [OK]
    testSetStageHeight ... [ERROR]
    testSetStageWidth ... [ERROR]
    testStartAutoServer ... [OK]
    testTrayIconEnabled ... [OK]
    test_create_dir ... [OK]
    test_hidden_files_folders ... [OK]
    test_sanitize ... [ERROR]
    test_taint ... [OK]
    test_taint_in_memory ... [OK]
    test_write_content_value ... [OK]
    test_write_preference_value ... [OK]
entertainerlib.tests.test_connection
  ConnectionServerTest
    testPortBinding ... [OK]
entertainerlib.tests.test_database
  DatabaseTest
    testCreate ... [OK]
    testUseExisting ... [OK]
entertainerlib.tests.test_eyecandytexture
  EyeCandyTextureTest
    test_create ... [ERROR]
entertainerlib.tests.test_feedconfigtools
  FeedConfigTo...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'entertainerlib/frontend/gui/screens/album.py'
--- entertainerlib/frontend/gui/screens/album.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/screens/album.py 2009-05-10 07:43:27 +0000
@@ -39,13 +39,8 @@
39 self.add(self.screen_title)39 self.add(self.screen_title)
4040
41 #List indicator41 #List indicator
42 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)42 self.li = ListIndicator(0.74, 0.8, 0.2, 0.045, ListIndicator.VERTICAL)
43 self.li.set_position(self.config.get_stage_width() - \
44 self.li.get_width() - self.get_abs_x(0.066),
45 self.config.get_stage_height() - self.get_abs_y(0.11))
46 self.li.set_delimiter(" | ")
47 self.li.set_maximum(self.track_menu.get_number_of_items())43 self.li.set_maximum(self.track_menu.get_number_of_items())
48 self.li.set_current(1)
49 self.add(self.li)44 self.add(self.li)
5045
51 def _create_album_cover_texture(self):46 def _create_album_cover_texture(self):
@@ -59,9 +54,7 @@
59 else:54 else:
60 pixbuf = gtk.gdk.pixbuf_new_from_file(55 pixbuf = gtk.gdk.pixbuf_new_from_file(
61 self.theme.getImage("default_album_art"))56 self.theme.getImage("default_album_art"))
62 self.art = EyeCandyTexture(pixbuf, self.get_abs_x(0.3148),57 self.art = EyeCandyTexture(0.1, 0.13, 0.3148, 0.5599, pixbuf)
63 self.get_abs_y(0.5599))
64 self.art.set_position(self.get_abs_x(0.1), self.get_abs_y(0.13))
65 self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)58 self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)
66 self.add(self.art)59 self.add(self.art)
6760
6861
=== modified file 'entertainerlib/frontend/gui/screens/audio_play.py'
--- entertainerlib/frontend/gui/screens/audio_play.py 2009-05-26 17:32:56 +0000
+++ entertainerlib/frontend/gui/screens/audio_play.py 2009-05-28 20:23:17 +0000
@@ -26,9 +26,7 @@
26 else:26 else:
27 pixbuf = gtk.gdk.pixbuf_new_from_file(27 pixbuf = gtk.gdk.pixbuf_new_from_file(
28 self.theme.getImage("default_album_art"))28 self.theme.getImage("default_album_art"))
29 self.art = EyeCandyTexture(pixbuf, self.get_abs_x(0.3148),29 self.art = EyeCandyTexture(0.1, 0.22, 0.3148, 0.5599, pixbuf)
30 self.get_abs_y(0.5599))
31 self.art.set_position(self.get_abs_x(0.1), self.get_abs_y(0.22))
32 self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)30 self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)
33 self.add(self.art)31 self.add(self.art)
3432
3533
=== modified file 'entertainerlib/frontend/gui/screens/disc.py'
--- entertainerlib/frontend/gui/screens/disc.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/screens/disc.py 2009-05-10 07:43:27 +0000
@@ -47,9 +47,7 @@
47 self.add(screen_title)47 self.add(screen_title)
4848
49 # Display throbber animation while loading CD metadata49 # Display throbber animation while loading CD metadata
50 self.throbber = LoadingAnimation(40, clutter.Color(255, 255, 255, 255),50 self.throbber = LoadingAnimation(0.5, 0.5, 0.1)
51 clutter.Color(128, 128, 128, 128))
52 self.throbber.set_position(self.get_abs_x(0.5), self.get_abs_y(0.5))
53 self.throbber.show()51 self.throbber.show()
54 self.add(self.throbber)52 self.add(self.throbber)
5553
@@ -145,9 +143,7 @@
145 pixbuf = gtk.gdk.pixbuf_new_from_file(coverfile)143 pixbuf = gtk.gdk.pixbuf_new_from_file(coverfile)
146 else:144 else:
147 pixbuf = gtk.gdk.pixbuf_new_from_file(self.theme.getImage("disc"))145 pixbuf = gtk.gdk.pixbuf_new_from_file(self.theme.getImage("disc"))
148 self.art = EyeCandyTexture(pixbuf, self.get_abs_x(0.3148),146 self.art = EyeCandyTexture(0.1, 0.13, 0.3148, 0.5599, pixbuf)
149 self.get_abs_y(0.5599))
150 self.art.set_position(self.get_abs_x(0.1), self.get_abs_y(0.13))
151 self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)147 self.art.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)
152 self.add(self.art)148 self.add(self.art)
153149
@@ -194,14 +190,8 @@
194 self.add(self.track_menu)190 self.add(self.track_menu)
195191
196 def _create_list_indicator(self):192 def _create_list_indicator(self):
197 """193 '''Create list indicator for track list.'''
198 Create list indicator widget194 self.li = ListIndicator(0.75, 0.8, 0.2, 0.045, ListIndicator.VERTICAL)
199 """
200 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)
201 self.li.set_position(self.config.get_stage_width() - \
202 self.li.get_width() - self.get_abs_x(0.06589),
203 self.config.get_stage_height() - self.get_abs_y(0.1953))
204 self.li.set_delimiter(" | ")
205 self.li.set_maximum(self.track_menu.get_number_of_items())195 self.li.set_maximum(self.track_menu.get_number_of_items())
206 self.add(self.li)196 self.add(self.li)
207197
208198
=== modified file 'entertainerlib/frontend/gui/screens/feed.py'
--- entertainerlib/frontend/gui/screens/feed.py 2009-06-15 03:19:46 +0000
+++ entertainerlib/frontend/gui/screens/feed.py 2009-06-25 19:06:28 +0000
@@ -55,13 +55,8 @@
55 self.add(date)55 self.add(date)
5656
57 #List indicator57 #List indicator
58 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)58 self.li = ListIndicator(0.57, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
59 self.li.set_position(self.get_abs_x(0.7562) - self.li.get_width(),
60 self.config.get_stage_height() - self.li.get_height() - \
61 self.get_abs_y(0.03906))
62 self.li.set_delimiter(" | ")
63 self.li.set_maximum(self.menu.get_number_of_items())59 self.li.set_maximum(self.menu.get_number_of_items())
64 self.li.set_current(1)
65 self.add(self.li)60 self.add(self.li)
6661
67 def _create_entry_menu(self):62 def _create_entry_menu(self):
6863
=== modified file 'entertainerlib/frontend/gui/screens/movie.py'
--- entertainerlib/frontend/gui/screens/movie.py 2009-06-02 10:24:20 +0000
+++ entertainerlib/frontend/gui/screens/movie.py 2009-06-05 05:10:21 +0000
@@ -52,9 +52,7 @@
52 else:52 else:
53 pixbuf = gtk.gdk.pixbuf_new_from_file(53 pixbuf = gtk.gdk.pixbuf_new_from_file(
54 self.theme.getImage("default_movie_art"))54 self.theme.getImage("default_movie_art"))
55 movie_art = EyeCandyTexture(pixbuf, self.get_abs_x(0.1),55 movie_art = EyeCandyTexture(0.33, 0.1, 0.1, 0.25, pixbuf)
56 self.get_abs_y(0.25))
57 movie_art.set_position(self.get_abs_x(0.33), self.get_abs_y(0.1))
58 self.add(movie_art)56 self.add(movie_art)
5957
60 # Movie title58 # Movie title
6159
=== modified file 'entertainerlib/frontend/gui/screens/photo_albums.py'
--- entertainerlib/frontend/gui/screens/photo_albums.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/screens/photo_albums.py 2009-05-10 07:43:27 +0000
@@ -114,31 +114,31 @@
114 images = album.get_preview_images(3)114 images = album.get_preview_images(3)
115 self.preview_textures = []115 self.preview_textures = []
116116
117 max_w = 0.4026
118 max_h = 0.5599
119 abs_max_w = self.get_abs_x(max_w)
120 abs_max_h = self.get_abs_y(max_h)
121
117 for image in images:122 for image in images:
118 pix_buffer = gtk.gdk.pixbuf_new_from_file(image.get_thumbnail_url())123 pix_buffer = gtk.gdk.pixbuf_new_from_file(image.get_thumbnail_url())
119 texture = EyeCandyTexture(pix_buffer, pix_buffer.get_width(),124 ratio = float(pix_buffer.get_width())
120 pix_buffer.get_height())125 ratio /= float(pix_buffer.get_height())
126
127 # Resize and center preview texture
128 if ratio > 1:
129 texture = EyeCandyTexture(0.0, 0.0, max_w, max_h / ratio,
130 pix_buffer)
131 new_y = int((abs_max_h - abs_max_h / ratio) / 2.0)
132 texture.set_position(0, new_y)
133 else:
134 texture = EyeCandyTexture(0.0, 0.0, max_w * ratio,
135 max_h, pix_buffer)
136 new_x = int((abs_max_w - abs_max_w * ratio) / 2.0)
137 texture.set_position(new_x, 0)
138
121 texture.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)139 texture.set_rotation(clutter.Y_AXIS, 25, 0, 0, 0)
122 texture.set_opacity(0)140 texture.set_opacity(0)
123141
124 # Resize and center preview texture
125 max_w = self.get_abs_x(0.4026)
126 max_h = self.get_abs_y(0.5599)
127 width = pix_buffer.get_width()
128 height = pix_buffer.get_height()
129 x_ratio = max_w / float(width)
130 y_ratio = max_h / float(height)
131 if x_ratio > y_ratio:
132 texture.set_scale(max_h /float(height), max_h / float(height))
133 new_width = int(width * (max_h / float(height)))
134 new_x = int((max_w - new_width) / 2.0)
135 texture.set_position(new_x, 0)
136 else:
137 texture.set_scale(max_w / float(width), max_w / float(width))
138 new_height = int(height * (max_w/ float(width)))
139 new_y = int((max_h - new_height) / 2.0)
140 texture.set_position(0, new_y)
141
142 self.preview_textures.append(texture)142 self.preview_textures.append(texture)
143 group.add(texture)143 group.add(texture)
144 self.preview_textures[0].set_opacity(255)144 self.preview_textures[0].set_opacity(255)
@@ -244,16 +244,9 @@
244 return True244 return True
245245
246 def _create_list_indicator(self):246 def _create_list_indicator(self):
247 """247 '''Create list indicator for albums list.'''
248 Create list indicator for albums list.248 self.li = ListIndicator(0.77, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
249 """
250 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)
251 self.li.set_position(self.get_abs_x(0.9297) - self.li.get_width(),
252 self.config.get_stage_height() - self.li.get_height() - \
253 self.get_abs_y(0.03906))
254 self.li.set_delimiter(" | ")
255 self.li.set_maximum(self.menu.get_number_of_items())249 self.li.set_maximum(self.menu.get_number_of_items())
256 self.li.set_current(1)
257 self.add(self.li)250 self.add(self.li)
258251
259 def _move_menu(self, menu_direction):252 def _move_menu(self, menu_direction):
260253
=== modified file 'entertainerlib/frontend/gui/screens/photographs.py'
--- entertainerlib/frontend/gui/screens/photographs.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/screens/photographs.py 2009-05-10 07:43:27 +0000
@@ -2,7 +2,6 @@
2'''Photographs - Screen contains a list/grid of photographs'''2'''Photographs - Screen contains a list/grid of photographs'''
33
4import pango4import pango
5import clutter
6import gobject5import gobject
76
8from entertainerlib.frontend.gui.screens.screen import Screen7from entertainerlib.frontend.gui.screens.screen import Screen
@@ -38,9 +37,7 @@
38 self.add(self.image_desc)37 self.add(self.image_desc)
3938
40 # Display throbber animation while loading photographs39 # Display throbber animation while loading photographs
41 self.throbber = LoadingAnimation(40, clutter.Color(255, 255, 255, 255),40 self.throbber = LoadingAnimation(0.9, 0.9)
42 clutter.Color(128, 128, 128, 128))
43 self.throbber.set_position(self.get_abs_x(0.9), self.get_abs_y(0.9))
44 self.throbber.show()41 self.throbber.show()
45 self.add(self.throbber)42 self.add(self.throbber)
4643
@@ -99,15 +96,10 @@
99 self.image_desc.set_size(0.366, 0.0911)96 self.image_desc.set_size(0.366, 0.0911)
10097
101 def _create_list_indicator(self):98 def _create_list_indicator(self):
102 """99 '''Create list indicator for albums list.'''
103 Create list indicator for albums list.100 self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
104 """101 ListIndicator.HORIZONTAL)
105 self.li = ListIndicator(0.18, 0.045, ListIndicator.HORIZONTAL)
106 self.li.set_position(self.get_abs_x(0.9297) - self.li.get_width(),
107 self.get_abs_y(0.7943))
108 self.li.set_delimiter(" | ")
109 self.li.set_maximum(len(self.images))102 self.li.set_maximum(len(self.images))
110 self.li.set_current(1)
111 self.add(self.li)103 self.add(self.li)
112104
113 def _move_menu(self, menu_direction):105 def _move_menu(self, menu_direction):
114106
=== modified file 'entertainerlib/frontend/gui/screens/rss.py'
--- entertainerlib/frontend/gui/screens/rss.py 2009-06-14 19:55:40 +0000
+++ entertainerlib/frontend/gui/screens/rss.py 2009-06-25 19:06:28 +0000
@@ -98,13 +98,8 @@
98 self.add(self.menu)98 self.add(self.menu)
9999
100 def _create_feed_menu_indicator(self):100 def _create_feed_menu_indicator(self):
101 """101 '''Create a ListIndicator for feed menu.'''
102 Create a ListIndicator for feed menu.102 self.li = ListIndicator(0.7, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
103 """
104 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)
105 self.li.set_position(self.get_abs_x(0.8858) - self.li.get_width(),
106 self.get_abs_y(0.9))
107 self.li.set_delimiter(" | ")
108 self.li.set_maximum(self.menu.get_number_of_items())103 self.li.set_maximum(self.menu.get_number_of_items())
109 self.add(self.li)104 self.add(self.li)
110105
111106
=== modified file 'entertainerlib/frontend/gui/screens/tv_episodes.py'
--- entertainerlib/frontend/gui/screens/tv_episodes.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/screens/tv_episodes.py 2009-07-01 11:15:57 +0000
@@ -39,13 +39,8 @@
39 self._create_episode_info_box()39 self._create_episode_info_box()
4040
41 #List indicator41 #List indicator
42 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)42 self.li = ListIndicator(0.8, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
43 self.li.set_position(self.config.get_stage_width() -
44 self.li.get_width() - self.get_abs_x(0.06589),
45 self.config.get_stage_height() - self.get_abs_y(0.1953))
46 self.li.set_delimiter(" | ")
47 self.li.set_maximum(self.episode_menu.get_number_of_items())43 self.li.set_maximum(self.episode_menu.get_number_of_items())
48 self.li.set_current(1)
49 self.add(self.li)44 self.add(self.li)
5045
51 # Add the additional actions that are needed but not handled by default46 # Add the additional actions that are needed but not handled by default
@@ -91,15 +86,15 @@
91 thumbnail = menu_item.get_userdata().get_thumbnail_url()86 thumbnail = menu_item.get_userdata().get_thumbnail_url()
92 if(thumbnail is not None):87 if(thumbnail is not None):
93 pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail)88 pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail)
94 thumb_width = self.get_abs_x(0.2928)89 thumb_width = 0.2928
95 thumb_height = self.get_abs_y(0.2799)90 thumb_height = 0.2799
96 thumb_x = self.get_abs_x(0.05)91 thumb_x = 0.05
97 thumb_y = self.get_abs_y(0.2)92 thumb_y = 0.2
98 else:93 else:
99 thumb_width = self.get_abs_x(0.1098)94 thumb_width = 0.1098
100 thumb_height = self.get_abs_y(0.2799)95 thumb_height = 0.2799
101 thumb_x = self.get_abs_x(0.20)96 thumb_x = 0.20
102 thumb_y = self.get_abs_y(0.15)97 thumb_y = 0.15
103 if(self.tv_series.has_cover_art()):98 if(self.tv_series.has_cover_art()):
104 pixbuf = gtk.gdk.pixbuf_new_from_file(99 pixbuf = gtk.gdk.pixbuf_new_from_file(
105 self.tv_series.get_cover_art_url())100 self.tv_series.get_cover_art_url())
@@ -107,8 +102,8 @@
107 pixbuf = gtk.gdk.pixbuf_new_from_file(102 pixbuf = gtk.gdk.pixbuf_new_from_file(
108 self.theme.getImage("default_movie_art"))103 self.theme.getImage("default_movie_art"))
109104
110 self.thumb = EyeCandyTexture(pixbuf, thumb_width, thumb_height)105 self.thumb = EyeCandyTexture(thumb_x, thumb_y, thumb_width,
111 self.thumb.set_position(thumb_x, thumb_y)106 thumb_height, pixbuf)
112 self.add(self.thumb)107 self.add(self.thumb)
113108
114 def _create_episode_info_box(self):109 def _create_episode_info_box(self):
115110
=== modified file 'entertainerlib/frontend/gui/screens/tv_series.py'
--- entertainerlib/frontend/gui/screens/tv_series.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/screens/tv_series.py 2009-07-01 11:15:57 +0000
@@ -31,13 +31,8 @@
31 self._create_season_menu()31 self._create_season_menu()
3232
33 #List indicator33 #List indicator
34 self.li = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)34 self.li = ListIndicator(0.8, 0.9, 0.2, 0.045, ListIndicator.VERTICAL)
35 self.li.set_position(self.config.get_stage_width() -
36 self.li.get_width() - self.get_abs_x(0.0659),
37 self.config.get_stage_height() - self.get_abs_y(0.1953))
38 self.li.set_delimiter(" | ")
39 self.li.set_maximum(self.season_menu.get_number_of_items())35 self.li.set_maximum(self.season_menu.get_number_of_items())
40 self.li.set_current(1)
41 self.add(self.li)36 self.add(self.li)
4237
43 def _create_season_menu(self):38 def _create_season_menu(self):
@@ -74,9 +69,7 @@
74 else:69 else:
75 pixbuf = gtk.gdk.pixbuf_new_from_file(70 pixbuf = gtk.gdk.pixbuf_new_from_file(
76 self.theme.getImage("default_movie_art"))71 self.theme.getImage("default_movie_art"))
77 self.art = EyeCandyTexture(pixbuf, self.get_abs_x(0.2196),72 self.art = EyeCandyTexture(0.16, 0.15, 0.2196, 0.5859, pixbuf)
78 self.get_abs_y(0.5859))
79 self.art.set_position(self.get_abs_x(0.16), self.get_abs_y(0.15))
80 self.add(self.art)73 self.add(self.art)
8174
82 def _move_menu(self, menu_direction):75 def _move_menu(self, menu_direction):
8376
=== modified file 'entertainerlib/frontend/gui/tabs/albums_tab.py'
--- entertainerlib/frontend/gui/tabs/albums_tab.py 2009-05-12 06:40:51 +0000
+++ entertainerlib/frontend/gui/tabs/albums_tab.py 2009-05-14 03:22:31 +0000
@@ -23,10 +23,7 @@
23 Tab.__init__(self, name, tab_title, move_to_new_screen_callback)23 Tab.__init__(self, name, tab_title, move_to_new_screen_callback)
2424
25 # Start the loading animation while the menu is loading25 # Start the loading animation while the menu is loading
26 self.throbber = LoadingAnimation(40,26 self.throbber = LoadingAnimation(0.6, 0.1)
27 clutter.Color(255, 255, 255, 255),
28 clutter.Color(128, 128, 128, 128))
29 self.throbber.set_position(self.get_abs_x(0.1), self.get_abs_y(0.1))
30 self.throbber.show()27 self.throbber.show()
31 self.add(self.throbber)28 self.add(self.throbber)
3229
@@ -73,12 +70,9 @@
7370
74 self.add(self.menu)71 self.add(self.menu)
7572
76 self.li = ListIndicator(0.18, 0.045, ListIndicator.HORIZONTAL)73 self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
77 self.li.set_position(self.get_abs_x(0.9297) - self.li.get_width(),74 ListIndicator.HORIZONTAL)
78 self.get_abs_y(0.7943))
79 self.li.set_delimiter(" | ")
80 self.li.set_maximum(len(albums))75 self.li.set_maximum(len(albums))
81 self.li.set_current(1)
82 self.li.show()76 self.li.show()
83 self.add(self.li)77 self.add(self.li)
8478
8579
=== modified file 'entertainerlib/frontend/gui/tabs/artists_tab.py'
--- entertainerlib/frontend/gui/tabs/artists_tab.py 2009-05-12 11:25:32 +0000
+++ entertainerlib/frontend/gui/tabs/artists_tab.py 2009-05-14 03:22:31 +0000
@@ -23,10 +23,7 @@
23 self.library = music_library23 self.library = music_library
2424
25 # Start the loading animation while the menu is loading25 # Start the loading animation while the menu is loading
26 self.throbber = LoadingAnimation(40,26 self.throbber = LoadingAnimation(0.1, 0.1)
27 clutter.Color(255, 255, 255, 255),
28 clutter.Color(128, 128, 128, 128))
29 self.throbber.set_position(self.get_abs_x(0.1), self.get_abs_y(0.1))
30 self.throbber.show()27 self.throbber.show()
31 self.add(self.throbber)28 self.add(self.throbber)
3229
@@ -56,12 +53,9 @@
56 self.add(self.artist_tracks)53 self.add(self.artist_tracks)
5754
58 # Create artis menu list indicator55 # Create artis menu list indicator
59 self.li = ListIndicator(0.18, 0.045, ListIndicator.HORIZONTAL)56 self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
60 self.li.set_position(self.get_abs_x(0.929) - self.li.get_width(),57 ListIndicator.HORIZONTAL)
61 self.get_abs_y(0.794))
62 self.li.set_delimiter(" | ")
63 self.li.set_maximum(len(artists))58 self.li.set_maximum(len(artists))
64 self.li.set_current(1)
65 self.add(self.li)59 self.add(self.li)
6660
67 self._async_menu_build(artists)61 self._async_menu_build(artists)
6862
=== modified file 'entertainerlib/frontend/gui/tabs/lyrics_tab.py'
--- entertainerlib/frontend/gui/tabs/lyrics_tab.py 2009-05-11 18:23:38 +0000
+++ entertainerlib/frontend/gui/tabs/lyrics_tab.py 2009-05-14 03:22:31 +0000
@@ -2,7 +2,6 @@
2'''Lyrics tab for the audio play screen'''2'''Lyrics tab for the audio play screen'''
33
4import pango4import pango
5import clutter
65
7from entertainerlib.frontend.gui.tabs.tab import Tab6from entertainerlib.frontend.gui.tabs.tab import Tab
8from entertainerlib.frontend.gui.widgets.label import Label7from entertainerlib.frontend.gui.widgets.label import Label
@@ -34,10 +33,7 @@
34 self.connect('deactivated', self._on_deactivated)33 self.connect('deactivated', self._on_deactivated)
35 else:34 else:
36 # Display throbber animation while searching for lyrics35 # Display throbber animation while searching for lyrics
37 white = clutter.Color(255, 255, 255, 255)36 self.throbber = LoadingAnimation(0.7, 0.5, 0.1)
38 gray = clutter.Color(128, 128, 128, 128)
39 self.throbber = LoadingAnimation(50, white, gray)
40 self.throbber.set_position(self.get_abs_x(0.7), self.get_abs_y(0.5))
41 self.throbber.show()37 self.throbber.show()
42 self.add(self.throbber)38 self.add(self.throbber)
43 self.track.fetch_lyrics(self._lyrics_search_callback)39 self.track.fetch_lyrics(self._lyrics_search_callback)
4440
=== modified file 'entertainerlib/frontend/gui/tabs/movies_tab.py'
--- entertainerlib/frontend/gui/tabs/movies_tab.py 2009-05-12 10:15:40 +0000
+++ entertainerlib/frontend/gui/tabs/movies_tab.py 2009-05-14 03:22:31 +0000
@@ -82,8 +82,7 @@
82 if movie.has_cover_art():82 if movie.has_cover_art():
83 pix_buffer = gtk.gdk.pixbuf_new_from_file(83 pix_buffer = gtk.gdk.pixbuf_new_from_file(
84 movie.get_cover_art_url())84 movie.get_cover_art_url())
85 texture = RoundedTexture(pix_buffer, self.get_abs_x(0.1),85 texture = RoundedTexture(0.0, 0.0, 0.1, 0.25, pix_buffer)
86 self.get_abs_y(0.25))
87 else:86 else:
88 texture = clutter.CloneTexture(default_cover)87 texture = clutter.CloneTexture(default_cover)
89 item = ImageMenuItem(0.1, 1.41, texture)88 item = ImageMenuItem(0.1, 1.41, texture)
@@ -99,12 +98,9 @@
99 self.add(self.menu)98 self.add(self.menu)
10099
101 # Create list indicator100 # Create list indicator
102 self.list_indicator = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)101 self.list_indicator = ListIndicator(0.75, 0.76, 0.2, 0.045,
103 self.list_indicator.set_position(self.get_abs_x(0.75),102 ListIndicator.VERTICAL)
104 self.get_abs_y(0.76))
105 self.list_indicator.set_delimiter(" | ")
106 self.list_indicator.set_maximum(self.menu.get_number_of_items())103 self.list_indicator.set_maximum(self.menu.get_number_of_items())
107 self.list_indicator.set_current(1)
108 self.show()104 self.show()
109 self.add(self.list_indicator)105 self.add(self.list_indicator)
110106
111107
=== modified file 'entertainerlib/frontend/gui/tabs/series_tab.py'
--- entertainerlib/frontend/gui/tabs/series_tab.py 2009-05-11 18:28:52 +0000
+++ entertainerlib/frontend/gui/tabs/series_tab.py 2009-05-14 03:22:31 +0000
@@ -81,8 +81,7 @@
81 if series.has_cover_art():81 if series.has_cover_art():
82 pix_buffer = gtk.gdk.pixbuf_new_from_file(82 pix_buffer = gtk.gdk.pixbuf_new_from_file(
83 series.get_cover_art_url())83 series.get_cover_art_url())
84 texture = RoundedTexture(pix_buffer, self.get_abs_x(0.1),84 texture = RoundedTexture(0.0, 0.0, 0.1, 0.25, pix_buffer)
85 self.get_abs_y(0.25))
86 else:85 else:
87 texture = clutter.CloneTexture(default_cover)86 texture = clutter.CloneTexture(default_cover)
8887
@@ -100,12 +99,9 @@
100 self.add(self.menu)99 self.add(self.menu)
101100
102 # Create list indicator101 # Create list indicator
103 self.list_indicator = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)102 self.list_indicator = ListIndicator(0.75, 0.76, 0.2, 0.045,
104 self.list_indicator.set_position(self.get_abs_x(0.75),103 ListIndicator.VERTICAL)
105 self.get_abs_y(0.76))
106 self.list_indicator.set_delimiter(" | ")
107 self.list_indicator.set_maximum(self.menu.get_number_of_items())104 self.list_indicator.set_maximum(self.menu.get_number_of_items())
108 self.list_indicator.set_current(1)
109 self.list_indicator.show()105 self.list_indicator.show()
110 self.add(self.list_indicator)106 self.add(self.list_indicator)
111107
112108
=== modified file 'entertainerlib/frontend/gui/tabs/tracks_tab.py'
--- entertainerlib/frontend/gui/tabs/tracks_tab.py 2009-05-11 10:10:27 +0000
+++ entertainerlib/frontend/gui/tabs/tracks_tab.py 2009-05-14 03:22:31 +0000
@@ -55,12 +55,9 @@
55 self.track_length = Label(0.037, "subtitle", 0.22, 0.91, "")55 self.track_length = Label(0.037, "subtitle", 0.22, 0.91, "")
56 self.add(self.track_length)56 self.add(self.track_length)
5757
58 self.li = ListIndicator(0.18, 0.045, ListIndicator.HORIZONTAL)58 self.li = ListIndicator(0.77, 0.8, 0.18, 0.045,
59 self.li.set_position(self.get_abs_x(0.9297) - self.li.get_width(),59 ListIndicator.HORIZONTAL)
60 self.get_abs_y(0.7943))
61 self.li.set_delimiter(" | ")
62 self.li.set_maximum(self.menu.get_number_of_items())60 self.li.set_maximum(self.menu.get_number_of_items())
63 self.li.set_current(1)
64 self.li.show()61 self.li.show()
65 self.add(self.li)62 self.add(self.li)
6663
6764
=== modified file 'entertainerlib/frontend/gui/tabs/video_clips_tab.py'
--- entertainerlib/frontend/gui/tabs/video_clips_tab.py 2009-05-11 10:12:11 +0000
+++ entertainerlib/frontend/gui/tabs/video_clips_tab.py 2009-05-14 03:22:31 +0000
@@ -75,8 +75,7 @@
75 clips = self.video_library.get_video_clips()75 clips = self.video_library.get_video_clips()
76 for clip in clips:76 for clip in clips:
77 pix_buffer = gtk.gdk.pixbuf_new_from_file(clip.get_thumbnail_url())77 pix_buffer = gtk.gdk.pixbuf_new_from_file(clip.get_thumbnail_url())
78 texture = RoundedTexture(pix_buffer, self.get_abs_x(0.233),78 texture = RoundedTexture(0.0, 0.0, 0.233, 0.25, pix_buffer)
79 self.get_abs_y(0.25))
80 item = ImageMenuItem(0.233, 0.5625, texture)79 item = ImageMenuItem(0.233, 0.5625, texture)
81 item.set_userdata(clip)80 item.set_userdata(clip)
82 self.menu.add_actor(item)81 self.menu.add_actor(item)
@@ -90,12 +89,9 @@
90 self.add(self.menu)89 self.add(self.menu)
9190
92 # Create list indicator91 # Create list indicator
93 self.list_indicator = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)92 self.list_indicator = ListIndicator(0.7, 0.8, 0.2, 0.045,
94 self.list_indicator.set_position(self.get_abs_x(0.67),93 ListIndicator.VERTICAL)
95 self.get_abs_y(0.76))
96 self.list_indicator.set_delimiter(" | ")
97 self.list_indicator.set_maximum(self.menu.get_number_of_items())94 self.list_indicator.set_maximum(self.menu.get_number_of_items())
98 self.list_indicator.set_current(1)
99 self.list_indicator.show()95 self.list_indicator.show()
100 self.add(self.list_indicator)96 self.add(self.list_indicator)
10197
10298
=== modified file 'entertainerlib/frontend/gui/widgets/arrow_texture.py'
--- entertainerlib/frontend/gui/widgets/arrow_texture.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/arrow_texture.py 2009-06-30 20:11:01 +0000
@@ -4,7 +4,9 @@
4import clutter4import clutter
5from cluttercairo import CairoTexture5from cluttercairo import CairoTexture
66
7class ArrowTexture(CairoTexture):7from entertainerlib.frontend.gui.widgets.base import Base
8
9class ArrowTexture(Base, CairoTexture):
8 """Clutter CairoTexture which represents an arrow."""10 """Clutter CairoTexture which represents an arrow."""
911
10 # Arrow direction (One of these should be passed as a paramter)12 # Arrow direction (One of these should be passed as a paramter)
@@ -14,7 +16,7 @@
14 LEFT = 316 LEFT = 3
15 ARC_TO_BEZIER = 0.5522847517 ARC_TO_BEZIER = 0.55228475
1618
17 def __init__(self, size, fg_color, bg_color, direction):19 def __init__(self, x, y, size, fg_color, bg_color, direction):
18 """20 """
19 Initialize ArrowTexture21 Initialize ArrowTexture
20 @param size: Width and height of the texture22 @param size: Width and height of the texture
@@ -23,9 +25,15 @@
23 @param direction: Arrow direction UP,DOWN,RIGHT or LEFT (class25 @param direction: Arrow direction UP,DOWN,RIGHT or LEFT (class
24 constant)26 constant)
25 """27 """
26 CairoTexture.__init__(self, size, size)28 Base.__init__(self)
29
30 abs_size = self.get_abs_x(size)
31
32 CairoTexture.__init__(self, abs_size, abs_size)
33
27 context = self.cairo_create()34 context = self.cairo_create()
28 context.scale(size, size)35 context.scale(abs_size, abs_size)
36
29 fg_cairo = self._color_to_cairo_color(fg_color)37 fg_cairo = self._color_to_cairo_color(fg_color)
30 bg_cairo = self._color_to_cairo_color(bg_color)38 bg_cairo = self._color_to_cairo_color(bg_color)
3139
@@ -69,6 +77,8 @@
69 self.behaviour = clutter.BehaviourScale(1.0, 1.0, 1.5, 1.5, self.alpha)77 self.behaviour = clutter.BehaviourScale(1.0, 1.0, 1.5, 1.5, self.alpha)
70 self.behaviour.apply(self)78 self.behaviour.apply(self)
7179
80 self.set_position(self.get_abs_x(x), self.get_abs_y(y))
81
72 def bounce(self):82 def bounce(self):
73 """83 """
74 Execute bounce effect for this array.84 Execute bounce effect for this array.
@@ -116,3 +126,4 @@
116 cr.rel_line_to(0, -height + 2 * radius_y)126 cr.rel_line_to(0, -height + 2 * radius_y)
117 cr.rel_curve_to(0.0, -c2, radius_x - c1, -radius_y, radius_x, -radius_y)127 cr.rel_curve_to(0.0, -c2, radius_x - c1, -radius_y, radius_x, -radius_y)
118 cr.close_path()128 cr.close_path()
129
119130
=== modified file 'entertainerlib/frontend/gui/widgets/eyecandy_texture.py'
--- entertainerlib/frontend/gui/widgets/eyecandy_texture.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/eyecandy_texture.py 2009-05-10 07:43:27 +0000
@@ -3,27 +3,33 @@
33
4import clutter4import clutter
55
6from entertainerlib.frontend.gui.widgets.base import Base
6from entertainerlib.frontend.gui.widgets.rounded_texture import RoundedTexture7from entertainerlib.frontend.gui.widgets.rounded_texture import RoundedTexture
7from entertainerlib.frontend.gui.widgets.reflection_texture import (8from entertainerlib.frontend.gui.widgets.reflection_texture import (
8 ReflectionTexture)9 ReflectionTexture)
910
10class EyeCandyTexture(clutter.Group):11class EyeCandyTexture(Base, clutter.Group):
11 """12 """
12 Just a simple wrapper class for RoundedTexture and ReflectionTexture.13 Just a simple wrapper class for RoundedTexture and ReflectionTexture.
1314
14 EyeCandyTexture is a texture with rounded corners and reflection below.15 EyeCandyTexture is a texture with rounded corners and reflection below.
15 """16 """
1617
17 def __init__(self, pixbuf, width, height):18 def __init__(self, x, y, width, height, pixbuf):
18 """19 """
19 Initialize new eye candy texture20 Initialize new eye candy texture
20 @param imagefile: Absoulte path to PNG file21 @param imagefile: Absoulte path to PNG file
21 """22 """
23 Base.__init__(self)
22 clutter.Group.__init__(self)24 clutter.Group.__init__(self)
23 rounded = RoundedTexture(pixbuf, width, height)25
24 reflection = ReflectionTexture(pixbuf, width, height,26 rounded = RoundedTexture(0.0, 0.0, width, height, pixbuf)
27 reflection = ReflectionTexture(0.0, 0.0, width, height, pixbuf,
25 round_corners=True)28 round_corners=True)
26 reflection.set_position(0, height)29
30 reflection.set_position(0, rounded.get_height())
31 self.set_position(self.get_abs_x(x), self.get_abs_y(y))
32
27 self.add(rounded)33 self.add(rounded)
28 self.add(reflection)34 self.add(reflection)
2935
3036
=== modified file 'entertainerlib/frontend/gui/widgets/list_indicator.py'
--- entertainerlib/frontend/gui/widgets/list_indicator.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/list_indicator.py 2009-05-10 07:43:27 +0000
@@ -4,10 +4,11 @@
4import clutter4import clutter
55
6from entertainerlib.frontend.gui.widgets.arrow_texture import ArrowTexture6from entertainerlib.frontend.gui.widgets.arrow_texture import ArrowTexture
7from entertainerlib.frontend.gui.widgets.base import Base
7from entertainerlib.frontend.gui.widgets.label import Label8from entertainerlib.frontend.gui.widgets.label import Label
8from entertainerlib.utils.configuration import Configuration9from entertainerlib.utils.configuration import Configuration
910
10class ListIndicator(clutter.Group):11class ListIndicator(Base, clutter.Group):
11 """12 """
12 ListIndicator displays 'current / maximum' value label and arrows.13 ListIndicator displays 'current / maximum' value label and arrows.
13 """14 """
@@ -18,22 +19,24 @@
18 HORIZONTAL = 019 HORIZONTAL = 0
19 VERTICAL = 120 VERTICAL = 1
2021
21 def __init__(self, width, height, direction):22 def __init__(self, x, y, width, height, direction):
22 """23 """
23 Initialize actor.24 Initialize actor.
24 @param width: Width of the widget in percentage (0-1)25 @param width: Width of the widget in percentage (0-1)
25 @param height: Height of the widget in percentage (0-1)26 @param height: Height of the widget in percentage (0-1)
26 @param direction: Direction (constant of this class)27 @param direction: Direction (constant of this class)
27 """28 """
29 Base.__init__(self)
28 clutter.Group.__init__(self)30 clutter.Group.__init__(self)
31
29 self.config = Configuration()32 self.config = Configuration()
3033
31 # Size34 # Size
32 self.width = int(self.config.get_stage_width() * width)35 self.width = self.get_abs_x(width)
33 self.height = int(self.config.get_stage_height() * height)36 self.height = self.get_abs_y(height)
3437
35 self.direction = direction38 self.direction = direction
36 self.delimiter = " / "39 self.delimiter = " | "
37 self.current = 140 self.current = 1
38 self.maximum = 141 self.maximum = 1
3942
@@ -41,10 +44,7 @@
41 self.fg = self.theme.get_color("arrow_foreground")44 self.fg = self.theme.get_color("arrow_foreground")
42 self.bg = self.theme.get_color("arrow_background")45 self.bg = self.theme.get_color("arrow_background")
4346
44 if direction == ListIndicator.VERTICAL:47 text_x_pos = width / 3
45 text_x_pos = width / 3
46 else:
47 text_x_pos = width / 2
4848
49 self.text = Label(height * 0.8, "text", text_x_pos, (height / 2),49 self.text = Label(height * 0.8, "text", text_x_pos, (height / 2),
50 str(self.maximum) + self.delimiter + str(self.maximum))50 str(self.maximum) + self.delimiter + str(self.maximum))
@@ -53,30 +53,22 @@
5353
54 # Create arrows and calculate positions on screen54 # Create arrows and calculate positions on screen
55 if direction == ListIndicator.VERTICAL:55 if direction == ListIndicator.VERTICAL:
56 self.arrow1 = ArrowTexture(56 self.arrow1 = ArrowTexture(5 * width / 7, height / 2, height / 2,
57 self.height, self.fg, self.bg, ArrowTexture.UP)57 self.fg, self.bg, ArrowTexture.UP)
58 self.arrow2 = ArrowTexture(58 self.arrow2 = ArrowTexture(6 * width / 7, height / 2, height / 2,
59 self.height, self.fg, self.bg, ArrowTexture.DOWN)59 self.fg, self.bg, ArrowTexture.DOWN)
60 self.arrow1.set_position(
61 int(self.width - self.height / 2.0), int(self.height / 2.0))
62 self.arrow2.set_position(
63 int(self.width - (self.height * 1.5 + self.height / 6.0)),
64 int(self.height / 2.0))
6560
66 elif direction == ListIndicator.HORIZONTAL:61 elif direction == ListIndicator.HORIZONTAL:
67 self.arrow1 = ArrowTexture(62 self.arrow1 = ArrowTexture(height / 2, height / 2, height / 2,
68 self.height, self.fg, self.bg, ArrowTexture.LEFT)63 self.fg, self.bg, ArrowTexture.LEFT)
69 self.arrow2 = ArrowTexture(64 self.arrow2 = ArrowTexture(6 * width / 7, height / 2, height / 2,
70 self.height, self.fg, self.bg, ArrowTexture.RIGHT)65 self.fg, self.bg, ArrowTexture.RIGHT)
71 self.arrow1.set_position(
72 int(self.height / 2.0),
73 int(self.height / 2.0))
74 self.arrow2.set_position(
75 int(self.width - self.height / 2.0), int(self.height / 2.0))
7666
77 self.add(self.arrow1)67 self.add(self.arrow1)
78 self.add(self.arrow2)68 self.add(self.arrow2)
7969
70 self.set_position(self.get_abs_x(x), self.get_abs_y(y))
71
80 def set_current(self, value):72 def set_current(self, value):
81 """73 """
82 Set current value74 Set current value
8375
=== modified file 'entertainerlib/frontend/gui/widgets/loading_animation.py'
--- entertainerlib/frontend/gui/widgets/loading_animation.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/loading_animation.py 2009-05-10 07:43:27 +0000
@@ -7,15 +7,17 @@
7import gobject7import gobject
8from cluttercairo import CairoTexture8from cluttercairo import CairoTexture
99
10class LoadingAnimation(CairoTexture):10from entertainerlib.frontend.gui.widgets.base import Base
11
12class LoadingAnimation(Base, CairoTexture):
11 """13 """
12 Loading animation widget14 Loading animation widget
1315
14 This widget is used when we want to tell user that Entertainer is loading.16 This widget is used when we want to tell user that Entertainer is loading.
15 """17 """
1618
17 def __init__(self, size, fg_color, bg_color, inner_radius = 0.25,19 def __init__(self, x, y, size=0.03, inner_radius=0.25, outter_radius=0.45,
18 outter_radius = 0.45, thickness = 0.08):20 thickness=0.08):
19 """21 """
20 Initialize LoadingAnimation22 Initialize LoadingAnimation
21 @param size: Width and height of the texture23 @param size: Width and height of the texture
@@ -25,14 +27,19 @@
25 @param outter_radius: Distance from origo to line end point 0-127 @param outter_radius: Distance from origo to line end point 0-1
26 @param thinkness: Lines thickness 0-128 @param thinkness: Lines thickness 0-1
27 """29 """
28 CairoTexture.__init__(self, size, size)30 Base.__init__(self)
29 self.set_anchor_point(size /2, size /2)31
3032 abs_size = self.get_abs_x(size)
31 c = self._clutterColorToCairoColor(fg_color)33
32 bg = self._clutterColorToCairoColor(bg_color)34 CairoTexture.__init__(self, abs_size, abs_size)
35
36 self.set_anchor_point(abs_size /2, abs_size /2)
37
38 c = self._clutterColorToCairoColor(clutter.Color(255, 255, 255, 255))
39 bg = self._clutterColorToCairoColor(clutter.Color(128, 128, 128, 128))
3340
34 context = self.cairo_create()41 context = self.cairo_create()
35 context.scale(size, size)42 context.scale(abs_size, abs_size)
36 context.set_line_width (thickness)43 context.set_line_width (thickness)
37 context.set_line_cap(cairo.LINE_CAP_ROUND)44 context.set_line_cap(cairo.LINE_CAP_ROUND)
3845
@@ -44,6 +51,8 @@
4451
45 self.keep_going = False52 self.keep_going = False
4653
54 self.set_position(self.get_abs_x(x), self.get_abs_y(y))
55
47 def _draw_line(self, context, bg_col, fg_col, radius, in_radius, number):56 def _draw_line(self, context, bg_col, fg_col, radius, in_radius, number):
48 """Draw one line"""57 """Draw one line"""
49 if number < 2:58 if number < 2:
5059
=== modified file 'entertainerlib/frontend/gui/widgets/reflection_texture.py'
--- entertainerlib/frontend/gui/widgets/reflection_texture.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/reflection_texture.py 2009-07-01 10:52:59 +0000
@@ -6,7 +6,9 @@
6import clutter6import clutter
7from cluttercairo import CairoTexture7from cluttercairo import CairoTexture
88
9class ReflectionTexture(CairoTexture):9from entertainerlib.frontend.gui.widgets.base import Base
10
11class ReflectionTexture(Base, CairoTexture):
10 """12 """
11 Reflection texture13 Reflection texture
1214
@@ -14,7 +16,7 @@
14 is rendered with Cairo.16 is rendered with Cairo.
15 """17 """
1618
17 def __init__(self, pixbuf, width, height, ref_height=0.3, opacity=0.3,19 def __init__(self, x, y, width, height, pixbuf, ref_height=0.3, opacity=0.3,
18 round_corners=False, margin=1, radius=15):20 round_corners=False, margin=1, radius=15):
19 """21 """
20 Create a new reflection texture22 Create a new reflection texture
@@ -27,7 +29,13 @@
27 @param margin: number of pixels to cut off from sides29 @param margin: number of pixels to cut off from sides
28 @param radius: Radius for rounded corners30 @param radius: Radius for rounded corners
29 """31 """
30 CairoTexture.__init__(self, width, height)32 Base.__init__(self)
33
34 abs_width = self.get_abs_x(width)
35 abs_height = self.get_abs_y(height)
36
37 CairoTexture.__init__(self, abs_width, abs_height)
38
31 context = self.cairo_create()39 context = self.cairo_create()
32 ct = gtk.gdk.CairoContext(context)40 ct = gtk.gdk.CairoContext(context)
3341
@@ -35,13 +43,13 @@
35 if round_corners:43 if round_corners:
36 x = 0 + margin44 x = 0 + margin
37 y = 0 + margin45 y = 0 + margin
38 w1 = width - (margin * 2)46 w1 = abs_width - (margin * 2)
39 h1 = height - (margin * 2)47 h1 = abs_height - (margin * 2)
40 self.roundedCorners(context, x, y, w1, h1, radius, radius)48 self.roundedCorners(context, x, y, w1, h1, radius, radius)
4149
42 # Scale context area50 # Scale context area
43 wr = width / float(pixbuf.get_width())51 wr = abs_width / float(pixbuf.get_width())
44 hr = height / float(pixbuf.get_height())52 hr = abs_height / float(pixbuf.get_height())
45 context.scale(wr, hr)53 context.scale(wr, hr)
4654
47 # Create gradient mask55 # Create gradient mask
@@ -59,6 +67,8 @@
59 self.set_rotation(clutter.Z_AXIS, 180, 0, 0, 0)67 self.set_rotation(clutter.Z_AXIS, 180, 0, 0, 0)
60 self.set_rotation(clutter.Y_AXIS, 180, 0, 0, 0)68 self.set_rotation(clutter.Y_AXIS, 180, 0, 0, 0)
6169
70 self.set_position(self.get_abs_x(x), self.get_abs_y(y))
71
62 def roundedCorners(self, context, x, y, w, h, radius_x, radius_y):72 def roundedCorners(self, context, x, y, w, h, radius_x, radius_y):
63 """73 """
64 Clip cairo texture with rounded rectangle.74 Clip cairo texture with rounded rectangle.
@@ -87,3 +97,4 @@
87 -radius_y)97 -radius_y)
88 context.close_path()98 context.close_path()
89 context.clip()99 context.clip()
100
90101
=== modified file 'entertainerlib/frontend/gui/widgets/rounded_texture.py'
--- entertainerlib/frontend/gui/widgets/rounded_texture.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/rounded_texture.py 2009-05-10 07:43:27 +0000
@@ -4,7 +4,9 @@
4from cluttercairo import CairoTexture4from cluttercairo import CairoTexture
5import gtk5import gtk
66
7class RoundedTexture(CairoTexture):7from entertainerlib.frontend.gui.widgets.base import Base
8
9class RoundedTexture(Base, CairoTexture):
8 """10 """
9 Texture with rounded corners11 Texture with rounded corners
1012
@@ -12,7 +14,7 @@
12 rounded smooth corners.14 rounded smooth corners.
13 """15 """
1416
15 def __init__(self, pixbuf, width, height, margin=1, radius=15):17 def __init__(self, x, y, width, height, pixbuf, margin=1, radius=15):
16 """18 """
17 Create a new cairo based texture from GDK pixel buffer. This texture is19 Create a new cairo based texture from GDK pixel buffer. This texture is
18 similar to clutter.Texture, but this is rendered with cairo and it adds20 similar to clutter.Texture, but this is rendered with cairo and it adds
@@ -22,26 +24,34 @@
22 @param margin: number of pixels to cut off from sides24 @param margin: number of pixels to cut off from sides
23 @param radius: Radius for rounded corners25 @param radius: Radius for rounded corners
24 """26 """
25 CairoTexture.__init__(self, width, height)27 Base.__init__(self)
28
29 abs_width = self.get_abs_x(width)
30 abs_height = self.get_abs_y(height)
31
32 CairoTexture.__init__(self, abs_width, abs_height)
33
26 context = self.cairo_create()34 context = self.cairo_create()
27 ct = gtk.gdk.CairoContext(context)35 ct = gtk.gdk.CairoContext(context)
2836
29 # Round corners37 # Round corners
30 x = 0 + margin38 xx = 0 + margin
31 y = 0 + margin39 yy = 0 + margin
32 w1 = width - (margin * 2)40 w1 = abs_width - (margin * 2)
33 h1 = height - (margin * 2)41 h1 = abs_height - (margin * 2)
34 self.roundedCorners(context, x, y, w1, h1, radius, radius)42 self.roundedCorners(context, xx, yy, w1, h1, radius, radius)
3543
36 # Scale context area44 # Scale context area
37 wr = width / float(pixbuf.get_width())45 wr = abs_width / float(pixbuf.get_width())
38 hr = height / float(pixbuf.get_height())46 hr = abs_height / float(pixbuf.get_height())
39 context.scale(wr, hr)47 context.scale(wr, hr)
40 ct.set_source_pixbuf(pixbuf, 0, 0)48 ct.set_source_pixbuf(pixbuf, 0, 0)
41 context.paint()49 context.paint()
42 del context # Update texture50 del context # Update texture
43 del ct51 del ct
4452
53 self.set_position(self.get_abs_x(x), self.get_abs_y(y))
54
45 def roundedCorners(self, context, x, y, w, h, radius_x, radius_y):55 def roundedCorners(self, context, x, y, w, h, radius_x, radius_y):
46 """56 """
47 Clip cairo texture with rounded rectangle.57 Clip cairo texture with rounded rectangle.
4858
=== modified file 'entertainerlib/frontend/gui/widgets/scroll_area.py'
--- entertainerlib/frontend/gui/widgets/scroll_area.py 2009-05-06 03:40:22 +0000
+++ entertainerlib/frontend/gui/widgets/scroll_area.py 2009-05-10 07:43:27 +0000
@@ -30,12 +30,9 @@
30 self.get_abs_y(y_pos_percent))30 self.get_abs_y(y_pos_percent))
3131
32 # Create content position indicator32 # Create content position indicator
33 self.indicator = ListIndicator(0.2, 0.045, ListIndicator.VERTICAL)33 self.indicator = ListIndicator(3 * x_size_percent / 4, y_size_percent,
34 0.2, 0.045, ListIndicator.VERTICAL)
34 self.indicator.hide_position()35 self.indicator.hide_position()
35 self.indicator.set_current(1)
36 self.indicator.set_position(
37 self.area_width - self.indicator.get_width(),
38 self.area_height + self.get_abs_y(0.01))
39 self.add(self.indicator)36 self.add(self.indicator)
4037
41 if active:38 if active:
4239
=== added file 'entertainerlib/tests/test_arrowtexture.py'
--- entertainerlib/tests/test_arrowtexture.py 1970-01-01 00:00:00 +0000
+++ entertainerlib/tests/test_arrowtexture.py 2009-06-30 20:11:01 +0000
@@ -0,0 +1,25 @@
1# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2'''Tests ArrowTexture.'''
3
4from entertainerlib.frontend.gui.widgets.arrow_texture import ArrowTexture
5from entertainerlib.tests import EntertainerTest
6
7class ArrowTextureTest(EntertainerTest):
8 '''Test for entertainerlib.frontend.gui.widgets.arrow_texture.'''
9
10 def setUp(self):
11 '''Set up the test.'''
12 EntertainerTest.setUp(self)
13
14 self.arrow = ArrowTexture(0.5, 0.9, 0.40, (21, 45, 83, 255),
15 (255, 0, 0, 255), ArrowTexture.UP)
16
17 def test_create(self):
18 '''Test correct ArrowTexture initialization.'''
19 self.assertTrue(isinstance(self.arrow, ArrowTexture))
20
21 def test_bounce(self):
22 '''Test the bounce method.'''
23 self.arrow.bounce()
24 self.assertTrue(self.arrow.timeline.is_playing())
25
026
=== added file 'entertainerlib/tests/test_eyecandytexture.py'
--- entertainerlib/tests/test_eyecandytexture.py 1970-01-01 00:00:00 +0000
+++ entertainerlib/tests/test_eyecandytexture.py 2009-06-30 22:02:55 +0000
@@ -0,0 +1,25 @@
1# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2'''Tests ArrowTexture.'''
3
4import gtk
5import os
6
7from entertainerlib.frontend.gui.widgets.eyecandy_texture import EyeCandyTexture
8from entertainerlib.tests import EntertainerTest
9
10THIS_DIR = os.path.dirname(__file__)
11
12class EyeCandyTextureTest(EntertainerTest):
13 '''Test for entertainerlib.frontend.gui.widgets.eyecandy_texture.'''
14
15 def setUp(self):
16 '''Set up the test.'''
17 EntertainerTest.setUp(self)
18
19 filename = os.path.join(THIS_DIR, 'data/ImageThumbnailer/test.jpg')
20 pix_buffer = gtk.gdk.pixbuf_new_from_file(filename)
21 self.eyecandy = EyeCandyTexture(0.5, 0.9, 0.40, 0.4, pix_buffer)
22
23 def test_create(self):
24 '''Test correct EyeCandyTexture initialization.'''
25 self.assertTrue(isinstance(self.eyecandy, EyeCandyTexture))
026
=== added file 'entertainerlib/tests/test_listindicator.py'
--- entertainerlib/tests/test_listindicator.py 1970-01-01 00:00:00 +0000
+++ entertainerlib/tests/test_listindicator.py 2009-06-30 22:18:48 +0000
@@ -0,0 +1,37 @@
1# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2'''Tests ListIndicator.'''
3
4from entertainerlib.frontend.gui.widgets.list_indicator import ListIndicator
5from entertainerlib.tests import EntertainerTest
6
7class ListIndicatorTest(EntertainerTest):
8 '''Test for entertainerlib.frontend.gui.widgets.list_indicator.'''
9
10 def setUp(self):
11 '''Set up the test.'''
12 EntertainerTest.setUp(self)
13
14 self.indicator = ListIndicator(0.7, 0.8, 0.2, 0.045,
15 ListIndicator.HORIZONTAL)
16
17 def test_create(self):
18 '''Test correct ListIndicator initialization.'''
19 self.assertTrue(isinstance(self.indicator, ListIndicator))
20
21 def test_currentmax(self):
22 '''Test methods to handle the current and maximum attributes.'''
23 self.indicator.set_current(10)
24 self.assertEqual(self.indicator.get_current(), 1)
25 self.indicator.set_current(-99)
26 self.assertEqual(self.indicator.get_current(), 1)
27 self.indicator.set_maximum(10)
28 self.indicator.set_current(5)
29 self.assertEqual(self.indicator.get_current(), 5)
30
31 def test_setdelimiter(self):
32 '''Test the set_delimiter method.'''
33 self.indicator.set_maximum(100)
34 self.indicator.set_current(50)
35 self.indicator.set_delimiter(" * ")
36 self.assertEqual(self.indicator.text.get_text(), "50 * 100")
37
038
=== added file 'entertainerlib/tests/test_loadinganimation.py'
--- entertainerlib/tests/test_loadinganimation.py 1970-01-01 00:00:00 +0000
+++ entertainerlib/tests/test_loadinganimation.py 2009-07-01 11:07:28 +0000
@@ -0,0 +1,28 @@
1# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2'''Tests LoadingAnimation.'''
3
4from entertainerlib.frontend.gui.widgets.loading_animation import (
5 LoadingAnimation)
6from entertainerlib.tests import EntertainerTest
7
8class LoadingAnimationTest(EntertainerTest):
9 '''Test for entertainerlib.frontend.gui.widgets.loading_animation.'''
10
11 def setUp(self):
12 '''Set up the test.'''
13 EntertainerTest.setUp(self)
14
15 self.animation = LoadingAnimation(0.5, 0.5)
16
17 def test_create(self):
18 '''Test correct LoadingAnimation initialization.'''
19 self.assertTrue(isinstance(self.animation, LoadingAnimation))
20
21 def test_hide(self):
22 '''Test the hide method.'''
23 self.assertTrue(self.animation.hide)
24
25 def test_show(self):
26 '''Test the show method.'''
27 self.assertTrue(self.animation.show)
28
029
=== added file 'entertainerlib/tests/test_reflectiontexture.py'
--- entertainerlib/tests/test_reflectiontexture.py 1970-01-01 00:00:00 +0000
+++ entertainerlib/tests/test_reflectiontexture.py 2009-07-01 11:07:28 +0000
@@ -0,0 +1,27 @@
1# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2'''Tests ReflectionTexture.'''
3
4import gtk
5import os
6
7from entertainerlib.frontend.gui.widgets.reflection_texture import (
8 ReflectionTexture)
9from entertainerlib.tests import EntertainerTest
10
11THIS_DIR = os.path.dirname(__file__)
12
13class ReflectionTextureTest(EntertainerTest):
14 '''Test for entertainerlib.frontend.gui.widgets.reflection_texture.'''
15
16 def setUp(self):
17 '''Set up the test.'''
18 EntertainerTest.setUp(self)
19
20 filename = os.path.join(THIS_DIR, 'data/ImageThumbnailer/test.jpg')
21 pix_buffer = gtk.gdk.pixbuf_new_from_file(filename)
22 self.texture = ReflectionTexture(0.5, 0.9, 0.40, 0.4, pix_buffer)
23
24 def test_create(self):
25 '''Test correct ReflectionTexture initialization.'''
26 self.assertTrue(isinstance(self.texture, ReflectionTexture))
27
028
=== added file 'entertainerlib/tests/test_roundedtexture.py'
--- entertainerlib/tests/test_roundedtexture.py 1970-01-01 00:00:00 +0000
+++ entertainerlib/tests/test_roundedtexture.py 2009-07-01 11:16:44 +0000
@@ -0,0 +1,26 @@
1# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2'''Tests RoundedTexture.'''
3
4import gtk
5import os
6
7from entertainerlib.frontend.gui.widgets.rounded_texture import RoundedTexture
8from entertainerlib.tests import EntertainerTest
9
10THIS_DIR = os.path.dirname(__file__)
11
12class RoundedTextureTest(EntertainerTest):
13 '''Test for entertainerlib.frontend.gui.widgets.rounded_texture.'''
14
15 def setUp(self):
16 '''Set up the test.'''
17 EntertainerTest.setUp(self)
18
19 filename = os.path.join(THIS_DIR, 'data/ImageThumbnailer/test.jpg')
20 pix_buffer = gtk.gdk.pixbuf_new_from_file(filename)
21 self.texture = RoundedTexture(0.5, 0.9, 0.40, 0.4, pix_buffer)
22
23 def test_create(self):
24 '''Test correct RoundedTexture initialization.'''
25 self.assertTrue(isinstance(self.texture, RoundedTexture))
26

Subscribers

People subscribed via source and target branches