[cairo-commit] pycairo/examples/cairo_snippets snippets_gtk.py, 1.16, 1.17

Steve Chaplin commit at pdx.freedesktop.org
Tue Dec 9 22:52:37 PST 2008


Committed by: stevech1097

Update of /cvs/cairo/pycairo/examples/cairo_snippets
In directory kemper:/tmp/cvs-serv21543/examples/cairo_snippets

Modified Files:
	snippets_gtk.py 
Log Message:
'SC'

Index: snippets_gtk.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/cairo_snippets/snippets_gtk.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- snippets_gtk.py	21 Dec 2006 11:36:46 -0000	1.16
+++ snippets_gtk.py	10 Dec 2008 06:52:34 -0000	1.17
@@ -3,6 +3,7 @@
 """
 from __future__ import division
 from math import pi as M_PI  # used by many snippets
+import os.path
 import sys
 
 import cairo
@@ -11,8 +12,11 @@
 
 from snippets import snip_list, snippet_normalize
 
+
 Width, Height = 400, 400
 
+snippets_path = os.path.join(os.path.dirname(__file__), 'snippets')
+
 
 def gdkcolor_to_rgb (gdkcolor):
     return gdkcolor.red/65535, gdkcolor.green/65535, gdkcolor.blue/65535
@@ -88,7 +92,8 @@
         if iter:
             filename = model[iter][0] + '.py'
             try:
-                file_obj = file('snippets/%s' % filename)
+                path = os.path.join(snippets_path, filename)
+                file_obj = open(path, 'r')
                 self.snippet_str = file_obj.read()
                 file_obj.close()
                 self.text_buffer.set_text(self.snippet_str)



More information about the cairo-commit mailing list