Comment 2 for bug 585504

Revision history for this message
Bartek Wilczynski (bartek) wrote :

It seems that these problems are in fact unrelated. The empty window comes from ui/excepthook being broken for reasons unknown to me. The cause of those Program errors seem to be the use of context.reset_clip(), which now requires parameters. It seems, that this patch fixes the problems:

=== modified file 'pybridge/ui/__init__.py'
--- pybridge/ui/__init__.py 2009-12-13 14:49:27 +0000
+++ pybridge/ui/__init__.py 2010-05-25 18:52:54 +0000
@@ -45,7 +45,7 @@
     # Set exception hook to display error dialog.
     import sys
     from excepthook import excepthook
- sys.excepthook = excepthook
+ #sys.excepthook = excepthook

     from manager import wm
     from window_main import WindowMain

=== modified file 'pybridge/ui/canvas.py'
--- pybridge/ui/canvas.py 2007-07-12 15:44:44 +0000
+++ pybridge/ui/canvas.py 2010-05-25 19:04:45 +0000
@@ -134,6 +134,7 @@
         """
         context = cairo.Context(self.backing)
         context.rectangle(x, y, width, height)
+ context.save()
         context.clip() # Set clip region.

         # Redraw background pattern in area.
@@ -151,7 +152,8 @@
             context.set_source_surface(item['source'], pos_x, pos_y)
             context.paint_with_alpha(item['opacity'])

- context.reset_clip()
+ #context.reset_clip()
+ context.restore()
         self.window.invalidate_rect((x, y, width, height), False) # Expose.

@@ -212,9 +214,11 @@
     def _expose(self, widget, event):
         context = widget.window.cairo_create()
         context.rectangle(*event.area)
+ context.save()
         context.clip() # Only redraw the exposed area.
         context.set_source_surface(self.backing, 0, 0)
         context.paint()
- context.reset_clip()
+ #context.reset_clip()
+ context.restore()
         return False # Expected to return False.