Merge branch 'master' of git://git.assembla.com/free_poker_tools
This commit is contained in:
commit
7269926d7b
|
@ -343,6 +343,7 @@ def idle_create(hud_main, new_hand_id, table, temp_key, max, poker_game, type, s
|
||||||
|
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
try:
|
try:
|
||||||
|
if table.gdkhandle is not None: # on windows this should already be set
|
||||||
table.gdkhandle = gtk.gdk.window_foreign_new(table.number)
|
table.gdkhandle = gtk.gdk.window_foreign_new(table.number)
|
||||||
newlabel = gtk.Label("%s - %s" % (table.site, temp_key))
|
newlabel = gtk.Label("%s - %s" % (table.site, temp_key))
|
||||||
hud_main.vb.add(newlabel)
|
hud_main.vb.add(newlabel)
|
||||||
|
|
|
@ -117,6 +117,7 @@ class Table_Window(object):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.site = site
|
self.site = site
|
||||||
self.hud = None # fill in later
|
self.hud = None # fill in later
|
||||||
|
self.gdkhandle = None
|
||||||
if tournament is not None and table_number is not None:
|
if tournament is not None and table_number is not None:
|
||||||
self.tournament = int(tournament)
|
self.tournament = int(tournament)
|
||||||
self.table = int(table_number)
|
self.table = int(table_number)
|
||||||
|
@ -136,7 +137,6 @@ class Table_Window(object):
|
||||||
self.search_string = getTableTitleRe(self.config, self.site, self.type, **table_kwargs)
|
self.search_string = getTableTitleRe(self.config, self.site, self.type, **table_kwargs)
|
||||||
self.find_table_parameters()
|
self.find_table_parameters()
|
||||||
|
|
||||||
# self.gdkhandle = gtk.gdk.window_foreign_new(self.number)
|
|
||||||
geo = self.get_geometry()
|
geo = self.get_geometry()
|
||||||
if geo is None: return None
|
if geo is None: return None
|
||||||
self.width = geo['width']
|
self.width = geo['width']
|
||||||
|
|
|
@ -76,6 +76,11 @@ class Table(Table_Window):
|
||||||
self.title = titles[hwnd]
|
self.title = titles[hwnd]
|
||||||
self.hud = None
|
self.hud = None
|
||||||
self.number = hwnd
|
self.number = hwnd
|
||||||
|
if self.gdkhandle is not None:
|
||||||
|
try: # Windows likes this here - Linux doesn't
|
||||||
|
self.gdkhandle = gtk.gdk.window_foreign_new(self.number)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def get_geometry(self):
|
def get_geometry(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -65,28 +65,35 @@ class Table(Table_Window):
|
||||||
|
|
||||||
if self.number is None:
|
if self.number is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
(self.window, self.parent) = self.get_window_from_xid(self.number)
|
(self.window, self.parent) = self.get_window_from_xid(self.number)
|
||||||
|
|
||||||
|
# def get_window_from_xid(self, id):
|
||||||
|
# for outside in root.query_tree().children:
|
||||||
|
# if outside.id == id:
|
||||||
|
# return (outside, outside.query_tree().parent)
|
||||||
|
# for inside in outside.query_tree().children:
|
||||||
|
# if inside.id == id: # GNOME, Xfce
|
||||||
|
# return (inside, inside.query_tree().parent)
|
||||||
|
# for wayinside in inside.query_tree().children:
|
||||||
|
# if wayinside.id == id: # KDE
|
||||||
|
# parent = wayinside.query_tree().parent
|
||||||
|
# return (wayinside, parent.query_tree().parent)
|
||||||
|
# return (None, None)
|
||||||
|
|
||||||
def get_window_from_xid(self, id):
|
def get_window_from_xid(self, id):
|
||||||
for outside in root.query_tree().children:
|
for top_level in root.query_tree().children:
|
||||||
if outside.id == id:
|
if top_level.id == id:
|
||||||
return (outside, outside.query_tree().parent)
|
return (top_level, None)
|
||||||
for inside in outside.query_tree().children:
|
for w in treewalk(top_level):
|
||||||
if inside.id == id: # GNOME, Xfce
|
if w.id == id:
|
||||||
return (inside, inside.query_tree().parent)
|
return (w, top_level)
|
||||||
for wayinside in inside.query_tree().children:
|
|
||||||
if wayinside.id == id: # KDE
|
|
||||||
parent = wayinside.query_tree().parent
|
|
||||||
return (wayinside, parent.query_tree().parent)
|
|
||||||
return (None, None)
|
|
||||||
|
|
||||||
def get_geometry(self):
|
def get_geometry(self):
|
||||||
try:
|
try:
|
||||||
my_geo = self.window.get_geometry()
|
my_geo = self.window.get_geometry()
|
||||||
if self.parent is None:
|
if self.parent is None:
|
||||||
return {'x' : my_geo.x + pa_geo.x,
|
return {'x' : my_geo.x,
|
||||||
'y' : my_geo.y + pa_geo.y,
|
'y' : my_geo.y,
|
||||||
'width' : my_geo.width,
|
'width' : my_geo.width,
|
||||||
'height' : my_geo.height
|
'height' : my_geo.height
|
||||||
}
|
}
|
||||||
|
@ -116,3 +123,10 @@ class Table(Table_Window):
|
||||||
# This is the gdkhandle for the HUD window
|
# This is the gdkhandle for the HUD window
|
||||||
gdkwindow = gtk.gdk.window_foreign_new(window.window.xid)
|
gdkwindow = gtk.gdk.window_foreign_new(window.window.xid)
|
||||||
gdkwindow.set_transient_for(self.gdkhandle)
|
gdkwindow.set_transient_for(self.gdkhandle)
|
||||||
|
|
||||||
|
def treewalk(parent):
|
||||||
|
for w in parent.query_tree().children:
|
||||||
|
for ww in treewalk(w):
|
||||||
|
yield ww
|
||||||
|
yield w
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user