Merge branch 'master' of git://git.assembla.com/free_poker_tools

This commit is contained in:
Worros 2011-02-11 14:32:05 +08:00
commit 7b43aef4f7
2 changed files with 44 additions and 16 deletions

View File

@ -116,7 +116,7 @@ class HUD_main(object):
self.main_window.set_icon_stock(gtk.STOCK_HOME) self.main_window.set_icon_stock(gtk.STOCK_HOME)
if not options.hidden: if not options.hidden:
self.main_window.show_all() self.main_window.show_all()
# gobject.timeout_add(100, self.check_tables) gobject.timeout_add(100, self.check_tables)
except: except:
log.exception("Error initializing main_window") log.exception("Error initializing main_window")

View File

@ -88,23 +88,51 @@ class Table(Table_Window):
if w.id == id: if w.id == id:
return (w, top_level) return (w, top_level)
#def get_geometry(self):
#try:
#my_geo = self.window.get_geometry()
#if self.parent is None:
#return {'x' : my_geo.x,
#'y' : my_geo.y,
#'width' : my_geo.width,
#'height' : my_geo.height
#}
#else:
#pa_geo = self.parent.get_geometry()
#return {'x' : my_geo.x + pa_geo.x,
#'y' : my_geo.y + pa_geo.y,
#'width' : my_geo.width,
#'height' : my_geo.height
#}
#except:
#return None
def get_geometry(self): def get_geometry(self):
geo_re = '''
Absolute\supper-left\sX: \s+ (?P<X>\d+) # x
.+
Absolute\supper-left\sY: \s+ (?P<Y>\d+) # y
.+
Width: \s+ (?P<W>\d+) # width
.+
Height: \s+ (?P<H>\d+) # height
'''
des_re = 'No such window with id'
listing = os.popen("xwininfo -id %d -stats" % (self.number)).read()
mo = re.search(des_re, listing)
if mo is not None:
return None # table has been destroyed
mo = re.search(geo_re, listing, re.VERBOSE|re.DOTALL)
try: try:
my_geo = self.window.get_geometry() return {'x' : int(mo.groupdict()['X']),
if self.parent is None: 'y' : int(mo.groupdict()['Y']),
return {'x' : my_geo.x, 'width' : int(mo.groupdict()['W']),
'y' : my_geo.y, 'height' : int(mo.groupdict()['H'])
'width' : my_geo.width, }
'height' : my_geo.height except AttributeError:
}
else:
pa_geo = self.parent.get_geometry()
return {'x' : my_geo.x + pa_geo.x,
'y' : my_geo.y + pa_geo.y,
'width' : my_geo.width,
'height' : my_geo.height
}
except:
return None return None
def get_window_title(self): def get_window_title(self):