summaryrefslogtreecommitdiff
path: root/colorblind
diff options
context:
space:
mode:
authorCarlos Eduardo Rodrigues DiĆ³genes <carlosd@src.gnome.org>2007-09-10 18:22:46 +0000
committerCarlos Eduardo Rodrigues DiĆ³genes <carlosd@src.gnome.org>2007-09-10 18:22:46 +0000
commit59c00047e743aaa50b612a94f78074c934af73b4 (patch)
tree61f11d08bc3f691ecd04e80fd4e597f311557148 /colorblind
parentd988b2566af6cd4cf090c02f897e34c47acfe2b2 (diff)
fix for bug #473569
svn path=/trunk/; revision=606
Diffstat (limited to 'colorblind')
-rw-r--r--colorblind/ColorblindApplet.py43
1 files changed, 25 insertions, 18 deletions
diff --git a/colorblind/ColorblindApplet.py b/colorblind/ColorblindApplet.py
index 93535d0..f60f78c 100644
--- a/colorblind/ColorblindApplet.py
+++ b/colorblind/ColorblindApplet.py
@@ -90,6 +90,25 @@ class ColorblindApplet(object):
if self.enabled == True:
filter = colorblind.GCONF_CLIENT.get_int(colorblind.GCONF_COLORBLIND_FILTER)
bonobo.pbclient_set_short (self.zoomerPBag, "color-blind-filter", filter)
+
+ def activate_magnifier (self):
+ self.magnifier = bonobo.get_object ("OAFIID:GNOME_Magnifier_Magnifier:0.9", "GNOME/Magnifier/Magnifier")
+ magPBag = self.magnifier.getProperties ()
+ tdb = magPBag.getValue ("target-display-bounds").value ()
+ if tdb.x1 == 0 and tdb.y1 == 0 and tdb.x2 == 0 and tdb.y2 == 0:
+ self.zoomer = self.magnifier.createZoomRegion (1, 1, GNOME.Magnifier.RectBounds (0, 0, gtk.gdk.screen_width (), gtk.gdk.screen_height ()), GNOME.Magnifier.RectBounds (0, 0, gtk.gdk.screen_width (), gtk.gdk.screen_height ()))
+ self.magnifier.addZoomRegion (self.zoomer)
+ bonobo.pbclient_set_long (magPBag, "crosswire-size", 0)
+ self.shutdown = True
+ if self.zoomer == None:
+ self.zoomer = self.magnifier.getZoomRegions ()
+ self.zoomer = self.zoomer[0]
+ self.zoomerPBag = self.zoomer.getProperties ()
+ if tdb.x1 == 0 and tdb.y1 == 0 and tdb.x2 == 0 and tdb.y2 == 0:
+ bonobo.pbclient_set_boolean (self.zoomerPBag, "draw-cursor", False)
+ cb_filter = colorblind.GCONF_CLIENT.get_int(colorblind.GCONF_DEFAULT_FILTER)
+ bonobo.pbclient_set_short (self.zoomerPBag, "color-blind-filter", cb_filter)
+ self.enabled = True
def enable_disable_filters (self):
global _magnifierAvailable
@@ -105,7 +124,11 @@ class ColorblindApplet(object):
except:
pass
if self.zoomer:
- bonobo.pbclient_set_short (self.zoomerPBag, "color-blind-filter", 0)
+ try:
+ bonobo.pbclient_set_short (self.zoomerPBag, "color-blind-filter", 0)
+ except:
+ self.activate_magnifier ()
+ return
self.enabled = False
self.shutdown = False
save_actual_filter = colorblind.GCONF_CLIENT.get_bool (colorblind.GCONF_CHECK_DEFAULT)
@@ -113,23 +136,7 @@ class ColorblindApplet(object):
af = colorblind.GCONF_CLIENT.get_int (colorblind.GCONF_COLORBLIND_FILTER)
colorblind.GCONF_CLIENT.set_int (colorblind.GCONF_DEFAULT_FILTER, af)
else:
- self.magnifier = bonobo.get_object ("OAFIID:GNOME_Magnifier_Magnifier:0.9", "GNOME/Magnifier/Magnifier")
- magPBag = self.magnifier.getProperties ()
- tdb = magPBag.getValue ("target-display-bounds").value ()
- if tdb.x1 == 0 and tdb.y1 == 0 and tdb.x2 == 0 and tdb.y2 == 0:
- self.zoomer = self.magnifier.createZoomRegion (1, 1, GNOME.Magnifier.RectBounds (0, 0, gtk.gdk.screen_width (), gtk.gdk.screen_height ()), GNOME.Magnifier.RectBounds (0, 0, gtk.gdk.screen_width (), gtk.gdk.screen_height ()))
- self.magnifier.addZoomRegion (self.zoomer)
- bonobo.pbclient_set_long (magPBag, "crosswire-size", 0)
- self.shutdown = True
- if self.zoomer == None:
- self.zoomer = self.magnifier.getZoomRegions ()
- self.zoomer = self.zoomer[0]
- self.zoomerPBag = self.zoomer.getProperties ()
- if tdb.x1 == 0 and tdb.y1 == 0 and tdb.x2 == 0 and tdb.y2 == 0:
- bonobo.pbclient_set_boolean (self.zoomerPBag, "draw-cursor", False)
- cb_filter = colorblind.GCONF_CLIENT.get_int(colorblind.GCONF_DEFAULT_FILTER)
- bonobo.pbclient_set_short (self.zoomerPBag, "color-blind-filter", cb_filter)
- self.enabled = True
+ self.activate_magnifier ()
def next_filter (self):
cb_filter = colorblind.GCONF_CLIENT.get_int (colorblind.GCONF_COLORBLIND_FILTER)