[cairo-commit] pycairo/examples/cairo_snippets snippets_png.py, 1.1, 1.2 snippets_gtk.py, 1.2, 1.3

Steve Chaplin commit at pdx.freedesktop.org
Wed Apr 6 19:09:59 PDT 2005


Committed by: stevech1097

Update of /cvs/cairo/pycairo/examples/cairo_snippets
In directory gabe:/tmp/cvs-serv16838/examples/cairo_snippets

Modified Files:
	snippets_png.py snippets_gtk.py 
Log Message:
SC 2005/04/07

Index: snippets_png.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/cairo_snippets/snippets_png.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- snippets_png.py	6 Apr 2005 13:54:10 -0000	1.1
+++ snippets_png.py	7 Apr 2005 02:09:57 -0000	1.2
@@ -10,10 +10,12 @@
 from snippets import snip_list, snippet_normalize, snippet_set_bg_svg
 
 Width, Height = 256, 256
+Verbose_mode = True
 
 
 def snippet_do_png (snippet):
-    print 'processing %s' % snippet,
+    if Verbose_mode:
+        print 'processing %s' % snippet,
     
     surface = cairo.Surface(cairo.FORMAT_ARGB32, Width, Height)
     cr = cairo.Context()
@@ -31,9 +33,14 @@
     surface.write_png (file_obj)
     file_obj.close()
 
-    print
+    if Verbose_mode:
+        print
 
 if __name__ == '__main__':
+    if len(sys.argv) > 1 and sys.argv[1] == '-s':
+        Verbose_mode=False
+        del sys.argv[1]
+    
     if len(sys.argv) > 1: # do specified snippets
         snippet_list = sys.argv[1:]
     else:                 # do all snippets

Index: snippets_gtk.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/cairo_snippets/snippets_gtk.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- snippets_gtk.py	7 Apr 2005 00:50:19 -0000	1.2
+++ snippets_gtk.py	7 Apr 2005 02:09:57 -0000	1.3
@@ -39,7 +39,7 @@
         vpaned = gtk.VPaned()
         self.add (vpaned)
 
-        sv = self.create_source_view()
+        sv = self.create_text_view()
         vpaned.pack1 (put_in_frame (sv), True, True)
         sv.set_size_request (Width, int(Height/2))
 
@@ -107,9 +107,9 @@
         return True
 
 
-    def create_source_view (self):
+    def create_text_view (self):
         sw = gtk.ScrolledWindow()
-        sw.set_policy (hscrollbar_policy=gtk.POLICY_NEVER,
+        sw.set_policy (hscrollbar_policy=gtk.POLICY_AUTOMATIC,
                        vscrollbar_policy=gtk.POLICY_AUTOMATIC)
 
         text_view = gtk.TextView()
@@ -117,7 +117,7 @@
         # set a fixed width font, so any tabs line up
         text_view.modify_font(pango.FontDescription ("Fixed"))
         
-        self.source_buffer = text_view.get_buffer()
+        self.text_buffer = text_view.get_buffer()
 
         return sw
 
@@ -130,7 +130,7 @@
                 file_obj = file('snippets/%s' % filename)
                 self.snippet_str = file_obj.read()
                 file_obj.close()
-                self.source_buffer.set_text(self.snippet_str)
+                self.text_buffer.set_text(self.snippet_str)
             except IOError, exc:
                 print "%s: %s" % (exc.filename, exc.strerror)
 




More information about the cairo-commit mailing list