HUD: added max seats submenu
This commit is contained in:
parent
f00a6ebfd2
commit
4c449059ed
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""Hud.py
|
"""Hud.py
|
||||||
|
|
||||||
Create and manage the hud overlays.
|
Create and manage the hud overlays.
|
||||||
|
@ -96,6 +97,8 @@ class Hud:
|
||||||
continue
|
continue
|
||||||
self.aux_windows.append(my_import(self, config, aux_params))
|
self.aux_windows.append(my_import(self, config, aux_params))
|
||||||
|
|
||||||
|
self.creation_attrs = None
|
||||||
|
|
||||||
def create_mw(self):
|
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
|
||||||
|
@ -146,6 +149,21 @@ class Hud:
|
||||||
self.item4.connect("activate", self.debug_stat_windows)
|
self.item4.connect("activate", self.debug_stat_windows)
|
||||||
self.item4.show()
|
self.item4.show()
|
||||||
|
|
||||||
|
self.item5 = gtk.MenuItem('Set max seats')
|
||||||
|
self.menu.append(self.item5)
|
||||||
|
self.item5.show()
|
||||||
|
self.maxSeatsMenu = gtk.Menu()
|
||||||
|
self.item5.set_submenu(self.maxSeatsMenu)
|
||||||
|
for i in range(2, 11, 1):
|
||||||
|
item = gtk.MenuItem('%d-max' % i)
|
||||||
|
item.ms = i
|
||||||
|
self.maxSeatsMenu.append(item)
|
||||||
|
item.connect("activate", self.change_max_seats)
|
||||||
|
item.show()
|
||||||
|
setattr(self, 'maxSeatsMenuItem%d' % (i-1), item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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()
|
||||||
|
@ -163,6 +181,18 @@ class Hud:
|
||||||
|
|
||||||
self.update_table_position()
|
self.update_table_position()
|
||||||
|
|
||||||
|
def change_max_seats(self, widget):
|
||||||
|
if self.max != widget.ms:
|
||||||
|
print 'change_max_seats', widget.ms
|
||||||
|
self.max = widget.ms
|
||||||
|
try:
|
||||||
|
self.kill()
|
||||||
|
self.create(*self.creation_attrs)
|
||||||
|
self.update(self.hand, self.config)
|
||||||
|
except Exception, e:
|
||||||
|
print "Expcetion:",str(e)
|
||||||
|
pass
|
||||||
|
|
||||||
def update_table_position(self):
|
def update_table_position(self):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
if not win32gui.IsWindow(self.table.number):
|
if not win32gui.IsWindow(self.table.number):
|
||||||
|
@ -264,6 +294,8 @@ 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
|
||||||
|
self.creation_attrs = hand, config, stat_dict, cards
|
||||||
|
|
||||||
self.hand = hand
|
self.hand = hand
|
||||||
if not self.mw_created:
|
if not self.mw_created:
|
||||||
self.create_mw()
|
self.create_mw()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user