Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/constants.py
diff options
context:
space:
mode:
authorerikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-12-14 04:09:53 (GMT)
committer erikb <erikb@574bc980-5f2d-0410-acbc-c8f9f0eb14e0>2007-12-14 04:09:53 (GMT)
commite92b82ffd3aab074f09cce320d76b2061615c575 (patch)
treed316484e6731aa82d1bfaa69ad4aa001b7583600 /constants.py
parentf33d8a5e79653d802e369f83bf7482b253d01e0d (diff)
better use of data directory
git-svn-id: http://mediamods.com/public-svn/camera-activity/tags/46@975 574bc980-5f2d-0410-acbc-c8f9f0eb14e0
Diffstat (limited to 'constants.py')
-rw-r--r--constants.py74
1 files changed, 39 insertions, 35 deletions
diff --git a/constants.py b/constants.py
index aa73598..2fc6d1b 100644
--- a/constants.py
+++ b/constants.py
@@ -280,48 +280,52 @@ class Constants:
def createCountdownPng( self, num ):
todisk = True
+ rendered = False
if (todisk):
path = os.path.join(Instance.dataPath, str(num)+".png")
if (os.path.exists(path)):
- return
-
- w = self.__class__.dim_CONTROLBAR_HT
- h = w
- if (todisk):
- cimg = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h)
- ctx = cairo.Context(cimg)
- else:
- pixmap = gtk.gdk.Pixmap(None, w, h, 24)
- ctx = pixmap.cairo_create()
- ctx.rectangle(0, 0, w, h)
- ctx.set_source_rgb(0, 0, 0)
- ctx.fill()
- x = 0
- y = 4
- ctx.translate(x,y)
- ctx.set_source_surface (self.__class__.recCircleCairo, 0, 0)
- ctx.paint()
- ctx.translate(-x,-y)
-
- ctx.set_source_rgb(255, 255, 255)
- pctx = pangocairo.CairoContext(ctx)
- play = pctx.create_layout()
- font = pango.FontDescription("sans 30")
- play.set_font_description(font)
- play.set_text( ""+str(num) )
- dim = play.get_pixel_extents()
- ctx.translate( -dim[0][0], -dim[0][1] )
- xoff = (w-dim[0][2])/2
- yoff = (h-dim[0][3])/2
- ctx.translate( xoff, yoff )
- ctx.translate( -3, 0 )
- pctx.show_layout(play)
+ rendered = True
+
+
+ if (not rendered):
+ w = self.__class__.dim_CONTROLBAR_HT
+ h = w
+ if (todisk):
+ cimg = cairo.ImageSurface(cairo.FORMAT_ARGB32, w, h)
+ ctx = cairo.Context(cimg)
+ else:
+ pixmap = gtk.gdk.Pixmap(None, w, h, 24)
+ ctx = pixmap.cairo_create()
+ ctx.rectangle(0, 0, w, h)
+ ctx.set_source_rgb(0, 0, 0)
+ ctx.fill()
+ x = 0
+ y = 4
+ ctx.translate(x,y)
+ ctx.set_source_surface (self.__class__.recCircleCairo, 0, 0)
+ ctx.paint()
+ ctx.translate(-x,-y)
+
+ ctx.set_source_rgb(255, 255, 255)
+ pctx = pangocairo.CairoContext(ctx)
+ play = pctx.create_layout()
+ font = pango.FontDescription("sans 30")
+ play.set_font_description(font)
+ play.set_text( ""+str(num) )
+ dim = play.get_pixel_extents()
+ ctx.translate( -dim[0][0], -dim[0][1] )
+ xoff = (w-dim[0][2])/2
+ yoff = (h-dim[0][3])/2
+ ctx.translate( xoff, yoff )
+ ctx.translate( -3, 0 )
+ pctx.show_layout(play)
img = gtk.Image()
if (todisk):
path = os.path.join(Instance.dataPath, str(num)+".png")
- path = utils.getUniqueFilepath(path, 0)
- cimg.write_to_png(path)
+ if (not rendered):
+ path = utils.getUniqueFilepath(path, 0)
+ cimg.write_to_png(path)
numPixbuf = gtk.gdk.pixbuf_new_from_file(path)
img.set_from_pixbuf( numPixbuf )
else: