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
2 FIXME removal + on loop to replace 12 blocks of code.
Cheers,
Samuel
=== modified file 'entertainerlib /frontend/ gui/screens/ tv_serie_ episodes_ screen. py' frontend/ gui/screens/ tv_serie_ episodes_ screen. py 2008-12-24 22:14:51 +0000 frontend/ gui/screens/ tv_serie_ episodes_ screen. py 2009-01-08 16:56:25 +0000 get_userdata( ).get_thumbnail _url()
if(thumbnail is not None): pixbuf_ new_from_ file(thumbnail)
thumb_ height = self.ui.y(0.2799)
thumb_ x = self.ui.x(0.05)
thumb_ y = self.ui.y(0.2)
--- entertainerlib/
+++ entertainerlib/
@@ -95,7 +95,7 @@
thumbnail = menu_item.
pixbuf = gtk.gdk.
- thumb_width = self.ui.x(0.2928) #FIXME
+ thumb_width = self.ui.x(0.2928)
=== modified file 'entertainerlib /frontend/ gui/widgets/ loading_ animation. py' frontend/ gui/widgets/ loading_ animation. py 2008-12-08 03:28:26 +0000 frontend/ gui/widgets/ loading_ animation. py 2009-01-08 19:54:20 +0000
context. set_line_ width (thickness)
context. set_line_ cap(cairo. LINE_CAP_ ROUND)
--- entertainerlib/
+++ entertainerlib/
@@ -39,123 +39,32 @@
- radius = outter_radius # radius of larger circle set_source_ rgba(bg[ 0], bg[1], bg[2], bg[3]) get_current_ point() get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.9) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.8) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.7) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.6) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.5) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.4) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.3) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.2) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3] - 0.1) get_current_ point() set_source_ rgba(c[ 0], c[1], c[2], c[3]) get_current_ point() line(context, bg, c, outter_radius, inner_radius, i)
- in_radius = inner_radius # radius of smaller circle
-
- # Background color
- context.
-
- #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.
- 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.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 60 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 90 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 120 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 150 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 180 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 210 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 240 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 270 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 300 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- context.new_path()
- context.arc(0.5, 0.5, radius, angle, angle)
- context.line_to(x, y)
- context.stroke()
-
- context.
- angle = 330 * (math.pi / 180.0)
- context.arc(0.5, 0.5, in_radius, angle, angle)
- (x, y) = context.
- 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_
+ def _draw_line(self, context, bg_col, fg_col, radius, in_radius, number): set_source_ rgba(bg_ col[0], bg_col[1], bg_col[2], bg_col[3]) set_source_ rgba(fg_ col[0], fg_col[1], fg_col[2], fg_col[3] \ get_current_ point() CairoColor( self, color):
+ """Draw one line"""
+ if number < 2:
+ context.
+ else:
+ context.
+ - (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.
+ context.new_path()
+ context.arc(0.5, 0.5, radius, angle, angle)
+ context.line_to(x, y)
+ context.stroke()
+
def _clutterColorTo
"""
Transform from 0-255 to 0-1.
=== modified file 'entertainerlib /frontend/ translation_ setup.py' frontend/ translation_ setup.py 2008-12-01 19:37:06 +0000 frontend/ translation_ setup.py 2009-01-08 19:52:54 +0000
gtk. glade.bindtextd omain(' entertainer' ,
TRANSLATION_ SOURCE[ 'package' ])
--- entertainerlib/
+++ entertainerlib/
@@ -38,7 +38,7 @@
else:
- #XXX: laymansterms - what do we do if it can't find either locale
pass
+