TrayLib problem: operator precedence confusion?

Tony Houghton <[email protected]> Sat, 23 Aug 2008 22:40:10 +0100
Newsgroups gmane.comp.desktop.rox.devel
Message-ID <[email protected]>
I got a stream of exceptions when I tried to run DevTray on a pared down
Ubuntu. I think the underlying cause was probably no python wnck
bindings, but it looks to me as if the code is supposed to be able to
cope with it but got a test wrong due to a false assumption about
operator precedence. I patched it and it seemed to work OK.

Traceback (most recent call last):
  File "/home/tony/Rox/DevTray/AppletRun", line 26, in <module>
    DevTrayMain().mainloop(sys.argv)
  File "/home/tony/Rox/DevTray/main.py", line 27, in mainloop
    Main.mainloop(self, app_args, DevTray, self.__win_config)
  File "/home/tony/lib/TrayLib/python/traylib/main.py", line 75, in mainloop
    rox.mainloop()
  File "/home/tony/lib/ROX-Lib2/python/rox/__init__.py", line 359, in mainloop
    g.main()
  File "/home/tony/lib/ROX-Lib2/python/rox/__init__.py", line 191, in _excepthook
    debug.show_exception(ex_type, value, tb)
  File "/home/tony/lib/ROX-Lib2/python/rox/debug.py", line 60, in show_exception
    resp = box.run()
  File "/home/tony/lib/TrayLib/python/traylib/icon.py", line 597, in __motion
    self.__update_mouse_over(event)
  File "/home/tony/lib/TrayLib/python/traylib/icon.py", line 269, in __update_mouse_over
    self.update_zoom_factor()
  File "/home/tony/lib/TrayLib/python/traylib/icon.py", line 215, in update_zoom_factor
    self.__zoom_factor = max(0.0, min(self.make_zoom_factor(), 1.5))
  File "/home/tony/lib/TrayLib/python/traylib/winicon.py", line 245, in make_zoom_factor
    if self.has_active_window:
  File "/home/tony/lib/TrayLib/python/traylib/winicon.py", line 420, in <lambda>
    has_active_window = property(lambda self : not screen and False or screen.get_active_window() in self.__windows)
AttributeError: 'NoneType' object has no attribute 'get_active_window'

-- 
TH * http://www.realh.co.uk

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
rox-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rox-devel
traylib.patch (text/x-patch, 488 B)
--- TrayLib/python/traylib/winicon.py~	2008-08-23 22:10:35.000000000 +0100
+++ TrayLib/python/traylib/winicon.py	2008-08-23 22:11:01.000000000 +0100
@@ -417,7 +417,7 @@
 	The list of visible windows.
 	"""
 	
-	has_active_window = property(lambda self : not screen and False or screen.get_active_window() in self.__windows)
+	has_active_window = property(lambda self : screen and screen.get_active_window() in self.__windows)
 	"""
 	{True} if the C{WinIcon} has the active window.
 	"""