HUD_main:
Add site name to list of windows being HUDed, fix weird call convention to the "del" operator, which is not a function. call clean_title() on hud titles being killed, so we actually kill (deep) tables and such HUD: Add function "kill_hud_menu", which is now called from the Kill This HUD menu option, to avoid a potential loop in kill_hud() Record the handle of the HUD's destroy signal, use it to un-register, before performing a kill, also avoiding potential loop there Do not allow kill_hud() to be called twice in the same HUD object, return doing nothing if deleted is already set on it (that should totally solve the loop problem)
This commit is contained in:
parent
b965654962
commit
cd1d4df96d
|
@ -65,7 +65,7 @@ def create_HUD(new_hand_id, table, db_name, table_name, max, poker_game, db_conn
|
|||
|
||||
gtk.gdk.threads_enter()
|
||||
try:
|
||||
newlabel = gtk.Label(table_name)
|
||||
newlabel = gtk.Label(table.site + " - " + table_name)
|
||||
eb.add(newlabel)
|
||||
newlabel.show()
|
||||
|
||||
|
@ -98,9 +98,12 @@ def update_HUD(new_hand_id, table_name, config, stat_dict):
|
|||
def HUD_removed(tablename):
|
||||
global hud_dict, eb
|
||||
|
||||
tablename = Tables.clean_title(tablename)
|
||||
# TODO: There's a potential problem here somewhere, that this hacks around .. the table_name as being passed to HUD_create is cleaned,
|
||||
# but the table.name as being passed here is not cleaned. I don't know why. -eric
|
||||
if tablename in hud_dict and hud_dict[tablename].deleted:
|
||||
eb.remove(hud_dict[tablename].tablehudlabel)
|
||||
del(hud_dict[tablename])
|
||||
del hud_dict[tablename]
|
||||
return False
|
||||
|
||||
return True
|
||||
|
|
|
@ -76,7 +76,7 @@ class Hud:
|
|||
self.main_window = gtk.Window()
|
||||
self.main_window.set_gravity(gtk.gdk.GRAVITY_STATIC)
|
||||
self.main_window.set_title(table.name + " FPDBHUD")
|
||||
self.main_window.connect("destroy", self.kill_hud)
|
||||
self.main_window.destroyhandler = self.main_window.connect("destroy", self.kill_hud)
|
||||
self.main_window.set_decorated(False)
|
||||
self.main_window.set_opacity(self.colors["hudopacity"])
|
||||
|
||||
|
@ -101,7 +101,7 @@ class Hud:
|
|||
self.menu = gtk.Menu()
|
||||
self.item1 = gtk.MenuItem('Kill this HUD')
|
||||
self.menu.append(self.item1)
|
||||
self.item1.connect("activate", self.kill_hud)
|
||||
self.item1.connect("activate", self.kill_hud_menu)
|
||||
self.item1.show()
|
||||
|
||||
self.item2 = gtk.MenuItem('Save Layout')
|
||||
|
@ -163,11 +163,17 @@ class Hud:
|
|||
return False
|
||||
|
||||
def kill_hud(self, *args):
|
||||
if self.deleted:
|
||||
return # no killing self twice.
|
||||
for k in self.stat_windows:
|
||||
self.stat_windows[k].window.destroy()
|
||||
self.main_window.destroy()
|
||||
self.deleted = True
|
||||
self.main_window.disconnect(self.main_window.destroyhandler) # so we don't potentially infiniteloop in here, right
|
||||
self.main_window.destroy()
|
||||
HUD_main.HUD_removed(self.table.name)
|
||||
|
||||
def kill_hud_menu(self, *args):
|
||||
self.main_window.destroy()
|
||||
|
||||
def reposition_windows(self, *args):
|
||||
for w in self.stat_windows:
|
||||
|
|
Loading…
Reference in New Issue
Block a user