Code review comment for lp:~samuel-buffet/entertainer/ftx3

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

2 FIXME removal + on loop to replace 12 blocks of code.

Cheers,
Samuel

=== modified file 'entertainerlib/frontend/gui/screens/tv_serie_episodes_screen.py'
--- entertainerlib/frontend/gui/screens/tv_serie_episodes_screen.py 2008-12-24 22:14:51 +0000
+++ entertainerlib/frontend/gui/screens/tv_serie_episodes_screen.py 2009-01-08 16:56:25 +0000
@@ -95,7 +95,7 @@
         thumbnail = menu_item.get_userdata().get_thumbnail_url()
         if(thumbnail is not None):
             pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail)
- thumb_width = self.ui.x(0.2928) #FIXME
+ thumb_width = self.ui.x(0.2928)
             thumb_height = self.ui.y(0.2799)
             thumb_x = self.ui.x(0.05)
             thumb_y = self.ui.y(0.2)

=== modified file 'entertainerlib/frontend/gui/widgets/loading_animation.py'
--- entertainerlib/frontend/gui/widgets/loading_animation.py 2008-12-08 03:28:26 +0000
+++ entertainerlib/frontend/gui/widgets/loading_animation.py 2009-01-08 19:54:20 +0000
@@ -39,123 +39,32 @@
         context.set_line_width (thickness)
         context.set_line_cap(cairo.LINE_CAP_ROUND)

- radius = outter_radius # radius of larger circle
- in_radius = inner_radius # radius of smaller circle
-
- # Background color
- context.set_source_rgba(bg[0], bg[1], bg[2], bg[3])
-
- #FIXME: Refactor line drawing to be done in a one loop
- angle = 0 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- angle = 30 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.9)
- angle = 60 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.8)
- angle = 90 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.7)
- angle = 120 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.6)
- angle = 150 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.5)
- angle = 180 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.4)
- angle = 210 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.3)
- angle = 240 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.2)
- angle = 270 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3] - 0.1)
- angle = 300 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.set_source_rgba(c[0], c[1], c[2], c[3])
- angle = 330 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.get_current_point()
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
+ # Draw the 12 lines
+ for i in range(12):
+ self._draw_line(context, bg, c, outter_radius, inner_radius, i)

         del(context) # Updates texture

         self.keep_going = False

+ def _draw_line(self, context, bg_col, fg_col, radius, in_radius, number):
+ """Draw one line"""
+ if number < 2:
+ context.set_source_rgba(bg_col[0], bg_col[1], bg_col[2], bg_col[3])
+ else:
+ context.set_source_rgba(fg_col[0], fg_col[1], fg_col[2], fg_col[3] \
+ - (1 -(number - 1) * 0.1))
+
+ # radius = radius of larger circle
+ # in_radius = radius of smaller circle
+ angle = number * 30 * (math.pi / 180.0)
+ context.arc(0.5, 0.5, in_radius, angle, angle)
+ (x, y) = context.get_current_point()
+ context.new_path()
+ context.arc(0.5, 0.5, radius, angle, angle)
+ context.line_to(x, y)
+ context.stroke()
+
     def _clutterColorToCairoColor(self, color):
         """
         Transform from 0-255 to 0-1.

=== modified file 'entertainerlib/frontend/translation_setup.py'
--- entertainerlib/frontend/translation_setup.py 2008-12-01 19:37:06 +0000
+++ entertainerlib/frontend/translation_setup.py 2009-01-08 19:52:54 +0000
@@ -38,7 +38,7 @@
             gtk.glade.bindtextdomain('entertainer',
                 TRANSLATION_SOURCE['package'])
         else:
- #XXX: laymansterms - what do we do if it can't find either locale
             pass

         gtk.glade.textdomain ('entertainer')
+

« Back to merge proposal