From 215ec630806c111286ab79c93758a5a6063b27c3 Mon Sep 17 00:00:00 2001 From: Eratosthenes Date: Fri, 12 Nov 2010 09:08:18 -0500 Subject: [PATCH 1/4] Test xlib on X systems to diagnose HUD problems. --- pyfpdb/xlib_tester.py | 89 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 pyfpdb/xlib_tester.py diff --git a/pyfpdb/xlib_tester.py b/pyfpdb/xlib_tester.py new file mode 100644 index 00000000..66a180d0 --- /dev/null +++ b/pyfpdb/xlib_tester.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Test program to see if XTables.py will correctly id the poker client. +""" +# Copyright 2010, Ray E. Barker + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# ====EXAMPLE OUTPUT FROM MY SYSTEM==== +#enter table xid find (in hex): +#0x3600018 <---GET THIS BY RUNNING xwininfo FROM A TERMINAL. +#Window information from xwininfo: +#------------------------------------------------------- +# +#xwininfo: Window id: 0x3600018 "Baseline Rd(26128925) - $100/$200 - Limit Hold'em" +# +# Root window id: 0x107 (the root window) (has no name) +# Parent window id: 0xe6e0a2 (has no name) +# 1 child: +# 0x3600019 (has no name): () 792x573+0+0 +2171+192 +# +# +#------------------------------------------------------- +# +# +#Window information from functions: +#matched inside +#window = Xlib.display.Window(0x03600018) title = "Baseline Rd(26128925) - $100/$200 - Limit Hold'em" +# +#parent = Xlib.display.Window(0x00e6e0a2) + +import sys +import os +import re + +# Other Library modules +import Xlib.display + +disp = Xlib.display.Display() +root = disp.screen().root +name_atom = disp.get_atom("WM_NAME", 1) + +def get_window_from_xid(id): + for outside in root.query_tree().children: + if outside.id == id: + print "matched outside" + return outside + for inside in outside.query_tree().children: + if inside.id == id: + print "matched inside" + return inside + return None + +def get_window_title(xid): + s = os.popen("xwininfo -children -id %d" % xid).read() + mo = re.search('"(.+)"', s) + try: + return mo.group(1) + except AttributeError: + return None + +if __name__== "__main__": + + print "enter table xid find (in hex): " + xid = sys.stdin.readline() + + print "Window information from xwininfo:" + s = os.popen("xwininfo -children -id %d" % int(xid, 0)).read() + print "-------------------------------------------------------" + print s + print "-------------------------------------------------------\n\n" + + print "Window information from functions:" + window = get_window_from_xid(int(xid, 0)) + print "window =", window, "title = \"" + get_window_title(int(xid, 0)) + "\"\n" + + print "parent =", window.query_tree().parent From 790e26ff1dda1d8b630028d335dbea315e1f492c Mon Sep 17 00:00:00 2001 From: Eratosthenes Date: Fri, 12 Nov 2010 11:02:21 -0500 Subject: [PATCH 2/4] Fix for UC table names on Windows. --- pyfpdb/WinTables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/WinTables.py b/pyfpdb/WinTables.py index f6ddd93b..b7114ae3 100644 --- a/pyfpdb/WinTables.py +++ b/pyfpdb/WinTables.py @@ -59,7 +59,7 @@ class Table(Table_Window): for hwnd in titles: if titles[hwnd] == "": continue - if re.search(self.search_string, titles[hwnd]): + if re.search(self.search_string, titles[hwnd], re.I): if self.check_bad_words(titles[hwnd]): continue self.window = hwnd From c7ce6c374582c1f175049b68e082e2863a81b901 Mon Sep 17 00:00:00 2001 From: Eratosthenes Date: Fri, 12 Nov 2010 11:03:30 -0500 Subject: [PATCH 3/4] Doh! Make executable. --- pyfpdb/xlib_tester.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 pyfpdb/xlib_tester.py diff --git a/pyfpdb/xlib_tester.py b/pyfpdb/xlib_tester.py old mode 100644 new mode 100755 From 50b7fd31a0b8bd1db9c813ee826ea266b48e0734 Mon Sep 17 00:00:00 2001 From: Eratosthenes Date: Fri, 12 Nov 2010 14:37:47 -0500 Subject: [PATCH 4/4] Comment out table watching due to bug under windows. --- pyfpdb/HUD_main.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/HUD_main.pyw b/pyfpdb/HUD_main.pyw index 31e50b27..8de098b6 100755 --- a/pyfpdb/HUD_main.pyw +++ b/pyfpdb/HUD_main.pyw @@ -130,7 +130,7 @@ class HUD_main(object): else: self.main_window.set_icon_stock(gtk.STOCK_HOME) self.main_window.show_all() - gobject.timeout_add(100, self.check_tables) +# gobject.timeout_add(100, self.check_tables) except: log.error("*** Exception in HUD_main.init() *** ")