Eliminate erronious multi huds on same table in some cases.
This commit is contained in:
parent
e45c42b172
commit
167ea98b8b
|
@ -87,7 +87,6 @@ class HUD_main(object):
|
||||||
self.vb.add(newlabel)
|
self.vb.add(newlabel)
|
||||||
newlabel.show()
|
newlabel.show()
|
||||||
|
|
||||||
self.hud_dict[table_name] = Hud.Hud(self, table, max, poker_game, self.config, self.db_connection)
|
|
||||||
self.hud_dict[table_name].tablehudlabel = newlabel
|
self.hud_dict[table_name].tablehudlabel = newlabel
|
||||||
self.hud_dict[table_name].create(new_hand_id, self.config, stat_dict, cards)
|
self.hud_dict[table_name].create(new_hand_id, self.config, stat_dict, cards)
|
||||||
for m in self.hud_dict[table_name].aux_windows:
|
for m in self.hud_dict[table_name].aux_windows:
|
||||||
|
@ -98,6 +97,8 @@ class HUD_main(object):
|
||||||
return False
|
return False
|
||||||
finally:
|
finally:
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
|
self.hud_dict[table_name] = Hud.Hud(self, table, max, poker_game, self.config, self.db_connection)
|
||||||
gobject.idle_add(idle_func)
|
gobject.idle_add(idle_func)
|
||||||
|
|
||||||
def update_HUD(self, new_hand_id, table_name, config):
|
def update_HUD(self, new_hand_id, table_name, config):
|
||||||
|
|
|
@ -48,6 +48,8 @@ import HUD_main
|
||||||
class Hud:
|
class Hud:
|
||||||
|
|
||||||
def __init__(self, parent, table, max, poker_game, config, db_connection):
|
def __init__(self, parent, table, max, poker_game, config, db_connection):
|
||||||
|
# __init__ is (now) intended to be called from the stdin thread, so it
|
||||||
|
# cannot touch the gui
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.table = table
|
self.table = table
|
||||||
self.config = config
|
self.config = config
|
||||||
|
@ -57,26 +59,28 @@ class Hud:
|
||||||
self.deleted = False
|
self.deleted = False
|
||||||
self.stacked = True
|
self.stacked = True
|
||||||
self.site = table.site
|
self.site = table.site
|
||||||
self.colors = config.get_default_colors(self.table.site)
|
self.mw_created = False
|
||||||
|
|
||||||
self.stat_windows = {}
|
self.stat_windows = {}
|
||||||
self.popup_windows = {}
|
self.popup_windows = {}
|
||||||
self.aux_windows = []
|
self.aux_windows = []
|
||||||
|
|
||||||
(font, font_size) = config.get_default_font(self.table.site)
|
(font, font_size) = config.get_default_font(self.table.site)
|
||||||
|
self.colors = config.get_default_colors(self.table.site)
|
||||||
|
|
||||||
if font == None:
|
if font == None:
|
||||||
font = "Sans"
|
font = "Sans"
|
||||||
if font_size == None:
|
if font_size == None:
|
||||||
font_size = "8"
|
font_size = "8"
|
||||||
|
|
||||||
self.font = pango.FontDescription(font + " " + font_size)
|
self.font = pango.FontDescription(font + " " + font_size)
|
||||||
|
|
||||||
# do we need to add some sort of condition here for dealing with a request for a font that doesn't exist?
|
# do we need to add some sort of condition here for dealing with a request for a font that doesn't exist?
|
||||||
|
|
||||||
|
def create_mw(self):
|
||||||
|
|
||||||
# Set up a main window for this this instance of the HUD
|
# Set up a main window for this this instance of the HUD
|
||||||
self.main_window = gtk.Window()
|
self.main_window = gtk.Window()
|
||||||
self.main_window.set_gravity(gtk.gdk.GRAVITY_STATIC)
|
self.main_window.set_gravity(gtk.gdk.GRAVITY_STATIC)
|
||||||
self.main_window.set_title(table.name + " FPDBHUD")
|
self.main_window.set_title(self.table.name + " FPDBHUD")
|
||||||
self.main_window.destroyhandler = 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_decorated(False)
|
||||||
self.main_window.set_opacity(self.colors["hudopacity"])
|
self.main_window.set_opacity(self.colors["hudopacity"])
|
||||||
|
@ -123,6 +127,7 @@ class Hud:
|
||||||
self.ebox.connect_object("button-press-event", self.on_button_press, self.menu)
|
self.ebox.connect_object("button-press-event", self.on_button_press, self.menu)
|
||||||
|
|
||||||
self.main_window.show_all()
|
self.main_window.show_all()
|
||||||
|
self.mw_created = True
|
||||||
|
|
||||||
# TODO: fold all uses of this type of 'topify' code into a single function, if the differences between the versions don't
|
# TODO: fold all uses of this type of 'topify' code into a single function, if the differences between the versions don't
|
||||||
# create adverse effects?
|
# create adverse effects?
|
||||||
|
@ -234,6 +239,9 @@ class Hud:
|
||||||
#
|
#
|
||||||
# this method also manages the creating and destruction of stat
|
# this method also manages the creating and destruction of stat
|
||||||
# windows via calls to the Stat_Window class
|
# windows via calls to the Stat_Window class
|
||||||
|
if not self.mw_created:
|
||||||
|
self.create_mw()
|
||||||
|
|
||||||
self.stat_dict = stat_dict
|
self.stat_dict = stat_dict
|
||||||
self.cards = cards
|
self.cards = cards
|
||||||
sys.stderr.write("------------------------------------------------------------\nCreating hud from hand %s\n" % hand)
|
sys.stderr.write("------------------------------------------------------------\nCreating hud from hand %s\n" % hand)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user