Merge branch 'master' of git://git.assembla.com/free_poker_tools
This commit is contained in:
commit
7269926d7b
|
@ -343,7 +343,8 @@ def idle_create(hud_main, new_hand_id, table, temp_key, max, poker_game, type, s
|
|||
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
table.gdkhandle = gtk.gdk.window_foreign_new(table.number)
|
||||
if table.gdkhandle is not None: # on windows this should already be set
|
||||
table.gdkhandle = gtk.gdk.window_foreign_new(table.number)
|
||||
newlabel = gtk.Label("%s - %s" % (table.site, temp_key))
|
||||
hud_main.vb.add(newlabel)
|
||||
newlabel.show()
|
||||
|
|
|
@ -117,6 +117,7 @@ class Table_Window(object):
|
|||
self.config = config
|
||||
self.site = site
|
||||
self.hud = None # fill in later
|
||||
self.gdkhandle = None
|
||||
if tournament is not None and table_number is not None:
|
||||
self.tournament = int(tournament)
|
||||
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.find_table_parameters()
|
||||
|
||||
# self.gdkhandle = gtk.gdk.window_foreign_new(self.number)
|
||||
geo = self.get_geometry()
|
||||
if geo is None: return None
|
||||
self.width = geo['width']
|
||||
|
|
|
@ -76,6 +76,11 @@ class Table(Table_Window):
|
|||
self.title = titles[hwnd]
|
||||
self.hud = None
|
||||
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):
|
||||
try:
|
||||
|
|
|
@ -65,28 +65,35 @@ class Table(Table_Window):
|
|||
|
||||
if self.number is None:
|
||||
return None
|
||||
|
||||
(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):
|
||||
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)
|
||||
for top_level in root.query_tree().children:
|
||||
if top_level.id == id:
|
||||
return (top_level, None)
|
||||
for w in treewalk(top_level):
|
||||
if w.id == id:
|
||||
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 + pa_geo.x,
|
||||
'y' : my_geo.y + pa_geo.y,
|
||||
return {'x' : my_geo.x,
|
||||
'y' : my_geo.y,
|
||||
'width' : my_geo.width,
|
||||
'height' : my_geo.height
|
||||
}
|
||||
|
@ -116,3 +123,10 @@ class Table(Table_Window):
|
|||
# This is the gdkhandle for the HUD window
|
||||
gdkwindow = gtk.gdk.window_foreign_new(window.window.xid)
|
||||
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