Lines 1-4
Link Here
|
1 |
import cairo, rsvg, math |
1 |
import cairo, math |
2 |
from const import * |
2 |
from const import * |
3 |
from preferences import preferences |
3 |
from preferences import preferences |
4 |
import os |
4 |
import os |
Lines 222-238
Link Here
|
222 |
self.cr.translate( self.padding, self.padding ) |
222 |
self.cr.translate( self.padding, self.padding ) |
223 |
|
223 |
|
224 |
if self.icon.endswith( ".svg" ): |
224 |
if self.icon.endswith( ".svg" ): |
225 |
# Render SVG files |
225 |
pass |
226 |
try: |
|
|
227 |
i_svg = rsvg.Handle( self.icon ) |
228 |
self.icon_width = ( float( self.icon_height )/float( i_svg.props.height ) ) * float( i_svg.props.width ) |
229 |
self.cr.translate( ( self.icon_height - self.icon_width )/2, 0 ) |
230 |
if i_svg.props.width > 1 and i_svg.props.height > 1 and self.icon_width > 1: |
231 |
self.cr.scale( float( self.icon_width )/float( i_svg.props.width ), |
232 |
float( self.icon_height )/float( i_svg.props.height ) ) |
233 |
i_svg.render_cairo( self.cr ) |
234 |
except: |
235 |
pass |
236 |
elif self.icon.endswith( ".png" ): |
226 |
elif self.icon.endswith( ".png" ): |
237 |
# Render PNG files |
227 |
# Render PNG files |
238 |
try: |
228 |
try: |
Lines 347-360
Link Here
|
347 |
self.cr.translate( self.width - self.height + self.padding, self.padding ) |
337 |
self.cr.translate( self.width - self.height + self.padding, self.padding ) |
348 |
|
338 |
|
349 |
if self.status_image.endswith( ".svg" ): |
339 |
if self.status_image.endswith( ".svg" ): |
350 |
# Render SVG files |
340 |
pass |
351 |
i_svg = rsvg.Handle( self.status_image ) |
|
|
352 |
width = ( float( self.icon_height )/float( i_svg.props.height ) ) * float( i_svg.props.width ) |
353 |
self.cr.translate( ( self.icon_height - self.icon_width )/2, 0 ) |
354 |
if i_svg.props.width > 1 and i_svg.props.height > 1 and self.icon_width > 1: |
355 |
self.cr.scale( float( width )/float( i_svg.props.width ), |
356 |
float( self.icon_height )/float( i_svg.props.height ) ) |
357 |
i_svg.render_cairo( self.cr ) |
358 |
elif self.status_image.endswith( ".png" ): |
341 |
elif self.status_image.endswith( ".png" ): |
359 |
# Render PNG files |
342 |
# Render PNG files |
360 |
image = cairo.ImageSurface.create_from_png ( self.status_image ) |
343 |
image = cairo.ImageSurface.create_from_png ( self.status_image ) |