discover functions all return None, instead of False

This commit is contained in:
eblade 2008-12-31 13:13:35 -05:00
parent 9b6e18c2c0
commit 26a549d7d2

View File

@ -152,7 +152,7 @@ def discover_posix_by_name(c, tablename):
info = decode_xwininfo(c, listing) info = decode_xwininfo(c, listing)
if not info['name'] == tablename: continue if not info['name'] == tablename: continue
return info return info
return False return None
def discover_posix_tournament(c, t_number, s_number): def discover_posix_tournament(c, t_number, s_number):
"""Finds the X window for a client, given tournament and table nos.""" """Finds the X window for a client, given tournament and table nos."""
@ -160,7 +160,7 @@ def discover_posix_tournament(c, t_number, s_number):
for listing in os.popen('xwininfo -root -tree').readlines(): for listing in os.popen('xwininfo -root -tree').readlines():
if re.search(search_string, listing): if re.search(search_string, listing):
return decode_xwininfo(c, listing) return decode_xwininfo(c, listing)
return False return None
def decode_xwininfo(c, info_string): def decode_xwininfo(c, info_string):
"""Gets window parameters from xwinifo string--XWindows.""" """Gets window parameters from xwinifo string--XWindows."""
@ -231,7 +231,7 @@ def discover_nt_by_name(c, tablename):
if titles[hwnd].find("HUD:") > -1: continue if titles[hwnd].find("HUD:") > -1: continue
if titles[hwnd].find("Chat:") > -1: continue if titles[hwnd].find("Chat:") > -1: continue
return decode_windows(c, titles[hwnd], hwnd) return decode_windows(c, titles[hwnd], hwnd)
return False return None
def discover_nt_tournament(c, tour_number, tab_number): def discover_nt_tournament(c, tour_number, tab_number):
"""Finds the Windows window handle for the given tournament/table.""" """Finds the Windows window handle for the given tournament/table."""
@ -242,7 +242,7 @@ def discover_nt_tournament(c, tour_number, tab_number):
for hwnd in titles.keys(): for hwnd in titles.keys():
if re.search(search_string, titles[hwnd]): if re.search(search_string, titles[hwnd]):
return decode_windows(c, titles[hwnd], hwnd) return decode_windows(c, titles[hwnd], hwnd)
return False return None
def get_nt_exe(hwnd): def get_nt_exe(hwnd):
"""Finds the name of the executable that the given window handle belongs to.""" """Finds the name of the executable that the given window handle belongs to."""