Merge branch 'master' of git://git.assembla.com/fpdb-eric
This commit is contained in:
commit
acb2fa23cb
|
@ -163,8 +163,8 @@ def get_logger(file_name, config = "config", fallback = False, log_dir=None, log
|
||||||
log = logging.basicConfig(filename=file, level=logging.INFO)
|
log = logging.basicConfig(filename=file, level=logging.INFO)
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
# but it looks like default is no output :-( maybe because all the calls name a module?
|
# but it looks like default is no output :-( maybe because all the calls name a module?
|
||||||
log.debug(_("Default logger initialised for ")+file)
|
log.debug(_("Default logger initialised for %s") % file)
|
||||||
print _("Default logger intialised for ")+file
|
print(_("Default logger initialised for %s") % file)
|
||||||
return log
|
return log
|
||||||
|
|
||||||
def check_dir(path, create = True):
|
def check_dir(path, create = True):
|
||||||
|
@ -834,7 +834,7 @@ class Config:
|
||||||
try:
|
try:
|
||||||
example_doc = xml.dom.minidom.parse(example_file)
|
example_doc = xml.dom.minidom.parse(example_file)
|
||||||
except:
|
except:
|
||||||
log.error(_("Error parsing example file %s. See error log file.") % (example_file))
|
log.error(_("Error parsing example configuration file %s. See error log file.") % (example_file))
|
||||||
return nodes_added
|
return nodes_added
|
||||||
|
|
||||||
for cnode in doc.getElementsByTagName("FreePokerToolsConfig"):
|
for cnode in doc.getElementsByTagName("FreePokerToolsConfig"):
|
||||||
|
|
|
@ -1169,7 +1169,7 @@ class Database:
|
||||||
for idx in self.indexes[self.backend]:
|
for idx in self.indexes[self.backend]:
|
||||||
if idx['drop'] == 1:
|
if idx['drop'] == 1:
|
||||||
if self.backend == self.MYSQL_INNODB:
|
if self.backend == self.MYSQL_INNODB:
|
||||||
print _("Creating mysql index %s %s") % (idx['tab'], idx['col'])
|
print _("Creating MySQL index %s %s") % (idx['tab'], idx['col'])
|
||||||
try:
|
try:
|
||||||
s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col'])
|
s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col'])
|
||||||
c.execute(s)
|
c.execute(s)
|
||||||
|
@ -1178,7 +1178,7 @@ class Database:
|
||||||
elif self.backend == self.PGSQL:
|
elif self.backend == self.PGSQL:
|
||||||
# pass
|
# pass
|
||||||
# mod to use tab_col for index name?
|
# mod to use tab_col for index name?
|
||||||
print _("Creating pg index "), idx['tab'], idx['col']
|
print _("Creating PostgreSQL index "), idx['tab'], idx['col']
|
||||||
try:
|
try:
|
||||||
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||||
c.execute(s)
|
c.execute(s)
|
||||||
|
@ -1423,22 +1423,22 @@ class Database:
|
||||||
if cons:
|
if cons:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
print _("creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||||
try:
|
try:
|
||||||
c.execute("alter table " + fk['fktab'] + " add foreign key ("
|
c.execute("alter table " + fk['fktab'] + " add foreign key ("
|
||||||
+ fk['fkcol'] + ") references " + fk['rtab'] + "("
|
+ fk['fkcol'] + ") references " + fk['rtab'] + "("
|
||||||
+ fk['rcol'] + ")")
|
+ fk['rcol'] + ")")
|
||||||
except:
|
except:
|
||||||
print _(" create foreign key failed: ") + str(sys.exc_info())
|
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||||
elif self.backend == self.PGSQL:
|
elif self.backend == self.PGSQL:
|
||||||
print _("creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||||
try:
|
try:
|
||||||
c.execute("alter table " + fk['fktab'] + " add constraint "
|
c.execute("alter table " + fk['fktab'] + " add constraint "
|
||||||
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
||||||
+ " foreign key (" + fk['fkcol']
|
+ " foreign key (" + fk['fkcol']
|
||||||
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
|
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
|
||||||
except:
|
except:
|
||||||
print _(" create foreign key failed: ") + str(sys.exc_info())
|
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||||
else:
|
else:
|
||||||
print _("Only MySQL and Postgres supported so far")
|
print _("Only MySQL and Postgres supported so far")
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['playerstitle'])
|
lbl_title = gtk.Label(self.filterText['playerstitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="refresh", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("Refresh"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__refresh, 'players')
|
showb.connect('clicked', self.__refresh, 'players')
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
|
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'sites')
|
showb.connect('clicked', self.__toggle_box, 'sites')
|
||||||
showb.show()
|
showb.show()
|
||||||
|
@ -705,7 +705,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['tourneyTypesTitle'])
|
lbl_title = gtk.Label(self.filterText['tourneyTypesTitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'tourneyTypes')
|
showb.connect('clicked', self.__toggle_box, 'tourneyTypes')
|
||||||
top_hbox.pack_start(showb, expand=False, padding=1)
|
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -731,7 +731,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['gamestitle'])
|
lbl_title = gtk.Label(self.filterText['gamestitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'games')
|
showb.connect('clicked', self.__toggle_box, 'games')
|
||||||
top_hbox.pack_start(showb, expand=False, padding=1)
|
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -758,7 +758,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['limitstitle'])
|
lbl_title = gtk.Label(self.filterText['limitstitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'limits')
|
showb.connect('clicked', self.__toggle_box, 'limits')
|
||||||
top_hbox.pack_start(showb, expand=False, padding=1)
|
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -872,7 +872,7 @@ class Filters(threading.Thread):
|
||||||
title = gtk.Label(_("Graphing Options:"))
|
title = gtk.Label(_("Graphing Options:"))
|
||||||
title.set_alignment(xalign=0.0, yalign=0.5)
|
title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(title, expand=True, padding=3)
|
top_hbox.pack_start(title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'graphops')
|
showb.connect('clicked', self.__toggle_box, 'graphops')
|
||||||
top_hbox.pack_start(showb, expand=False, padding=1)
|
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -923,7 +923,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['seatstitle'])
|
lbl_title = gtk.Label(self.filterText['seatstitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
hbox.pack_start(lbl_title, expand=True, padding=3)
|
hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'seats')
|
showb.connect('clicked', self.__toggle_box, 'seats')
|
||||||
hbox.pack_start(showb, expand=False, padding=1)
|
hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -957,7 +957,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['groupstitle'])
|
lbl_title = gtk.Label(self.filterText['groupstitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
hbox.pack_start(lbl_title, expand=True, padding=3)
|
hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'groups')
|
showb.connect('clicked', self.__toggle_box, 'groups')
|
||||||
hbox.pack_start(showb, expand=False, padding=1)
|
hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -1015,7 +1015,7 @@ class Filters(threading.Thread):
|
||||||
lbl_title = gtk.Label(self.filterText['datestitle'])
|
lbl_title = gtk.Label(self.filterText['datestitle'])
|
||||||
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
lbl_title.set_alignment(xalign=0.0, yalign=0.5)
|
||||||
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
top_hbox.pack_start(lbl_title, expand=True, padding=3)
|
||||||
showb = gtk.Button(label="hide", stock=None, use_underline=True)
|
showb = gtk.Button(label=_("hide"), stock=None, use_underline=True)
|
||||||
showb.set_alignment(xalign=1.0, yalign=0.5)
|
showb.set_alignment(xalign=1.0, yalign=0.5)
|
||||||
showb.connect('clicked', self.__toggle_box, 'dates')
|
showb.connect('clicked', self.__toggle_box, 'dates')
|
||||||
top_hbox.pack_start(showb, expand=False, padding=1)
|
top_hbox.pack_start(showb, expand=False, padding=1)
|
||||||
|
@ -1065,10 +1065,10 @@ class Filters(threading.Thread):
|
||||||
def __toggle_box(self, widget, entry):
|
def __toggle_box(self, widget, entry):
|
||||||
if self.boxes[entry].props.visible:
|
if self.boxes[entry].props.visible:
|
||||||
self.boxes[entry].hide()
|
self.boxes[entry].hide()
|
||||||
widget.set_label("show")
|
widget.set_label(_("show"))
|
||||||
else:
|
else:
|
||||||
self.boxes[entry].show()
|
self.boxes[entry].show()
|
||||||
widget.set_label("hide")
|
widget.set_label(_("hide"))
|
||||||
#end def __toggle_box
|
#end def __toggle_box
|
||||||
|
|
||||||
def __calendar_dialog(self, widget, entry):
|
def __calendar_dialog(self, widget, entry):
|
||||||
|
|
|
@ -228,7 +228,7 @@ class GuiGraphViewer (threading.Thread):
|
||||||
#TODO: Do something useful like alert user
|
#TODO: Do something useful like alert user
|
||||||
#print "No hands returned by graph query"
|
#print "No hands returned by graph query"
|
||||||
else:
|
else:
|
||||||
self.ax.set_title(_("Profit graph for ring games"+names),fontsize=12)
|
self.ax.set_title((_("Profit graph for ring games")+names),fontsize=12)
|
||||||
|
|
||||||
#Draw plot
|
#Draw plot
|
||||||
self.ax.plot(green, color='green', label=_('Hands: %d\nProfit (%s): %.2f') %(len(green),graphops['dspin'], green[-1]))
|
self.ax.plot(green, color='green', label=_('Hands: %d\nProfit (%s): %.2f') %(len(green),graphops['dspin'], green[-1]))
|
||||||
|
|
|
@ -140,9 +140,9 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats):
|
||||||
}
|
}
|
||||||
|
|
||||||
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
|
||||||
self.filters.registerButton1Name("_Filters")
|
self.filters.registerButton1Name(_("_Filters"))
|
||||||
self.filters.registerButton1Callback(self.showDetailFilter)
|
self.filters.registerButton1Callback(self.showDetailFilter)
|
||||||
self.filters.registerButton2Name("_Refresh Stats")
|
self.filters.registerButton2Name(_("_Refresh Stats"))
|
||||||
self.filters.registerButton2Callback(self.refreshStats)
|
self.filters.registerButton2Callback(self.refreshStats)
|
||||||
|
|
||||||
# ToDo: store in config
|
# ToDo: store in config
|
||||||
|
|
|
@ -52,6 +52,7 @@ if sys.platform == 'linux2':
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
import OSXTables as Tables
|
import OSXTables as Tables
|
||||||
else: # This is bad--figure out the values for the various windows flavors
|
else: # This is bad--figure out the values for the various windows flavors
|
||||||
|
is_windows = True
|
||||||
import WinTables as Tables
|
import WinTables as Tables
|
||||||
|
|
||||||
# get config and set up logger
|
# get config and set up logger
|
||||||
|
@ -126,7 +127,9 @@ class HUD_main(object):
|
||||||
hud.up_update_table_position()
|
hud.up_update_table_position()
|
||||||
|
|
||||||
def client_resized(self, widget, hud):
|
def client_resized(self, widget, hud):
|
||||||
gobject.idle_add(idle_resize, hud)
|
# Don't forget to get rid of this.
|
||||||
|
if not is_windows:
|
||||||
|
gigobject.idle_add(idle_resize, hud)
|
||||||
|
|
||||||
def client_destroyed(self, widget, hud): # call back for terminating the main eventloop
|
def client_destroyed(self, widget, hud): # call back for terminating the main eventloop
|
||||||
self.kill_hud(None, hud.table.key)
|
self.kill_hud(None, hud.table.key)
|
||||||
|
|
|
@ -370,7 +370,7 @@ class Hud:
|
||||||
self.label = label
|
self.label = label
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
self.main_window.show_all()
|
self.main_window.show_all()
|
||||||
self.topify_window(self.main_window)
|
# self.topify_window(self.main_window)
|
||||||
|
|
||||||
def change_max_seats(self, widget):
|
def change_max_seats(self, widget):
|
||||||
if self.max != widget.ms:
|
if self.max != widget.ms:
|
||||||
|
@ -645,6 +645,9 @@ class Hud:
|
||||||
player_id = 'fake',
|
player_id = 'fake',
|
||||||
font = self.font)
|
font = self.font)
|
||||||
|
|
||||||
|
self.topify_window(self.main_window)
|
||||||
|
for i in xrange(1, self.max + 1):
|
||||||
|
self.topify_window(self.stat_windows[i].window, self.main_window)
|
||||||
self.stats = []
|
self.stats = []
|
||||||
game = config.supported_games[self.poker_game]
|
game = config.supported_games[self.poker_game]
|
||||||
|
|
||||||
|
@ -710,13 +713,18 @@ class Hud:
|
||||||
window.window.show_all()
|
window.window.show_all()
|
||||||
unhidewindow = False
|
unhidewindow = False
|
||||||
|
|
||||||
def topify_window(self, window):
|
def topify_window(self, window, parentwindow=None):
|
||||||
window.set_focus_on_map(False)
|
window.set_focus_on_map(False)
|
||||||
window.set_accept_focus(False)
|
window.set_accept_focus(False)
|
||||||
|
# print "topify_window", window, parentwindow
|
||||||
|
|
||||||
if not self.table.gdkhandle:
|
if not self.table.gdkhandle:
|
||||||
self.table.gdkhandle = gtk.gdk.window_foreign_new(int(self.table.number)) # gtk handle to poker window
|
self.table.gdkhandle = gtk.gdk.window_foreign_new(int(self.table.number)) # gtk handle to poker window
|
||||||
window.window.set_transient_for(self.table.gdkhandle)
|
if parentwindow is not None:
|
||||||
|
window.window.set_transient_for(parentwindow.window)
|
||||||
|
else:
|
||||||
|
window.window.set_transient_for(self.table.gdkhandle)
|
||||||
|
window.set_destroy_with_parent(True)
|
||||||
|
|
||||||
class Stat_Window:
|
class Stat_Window:
|
||||||
|
|
||||||
|
@ -791,6 +799,8 @@ class Stat_Window:
|
||||||
self.window.set_focus_on_map(False)
|
self.window.set_focus_on_map(False)
|
||||||
self.window.set_accept_focus(False)
|
self.window.set_accept_focus(False)
|
||||||
|
|
||||||
|
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY)
|
||||||
|
|
||||||
grid = gtk.Table(rows = game.rows, columns = game.cols, homogeneous = False)
|
grid = gtk.Table(rows = game.rows, columns = game.cols, homogeneous = False)
|
||||||
self.grid = grid
|
self.grid = grid
|
||||||
self.window.add(grid)
|
self.window.add(grid)
|
||||||
|
@ -845,20 +855,10 @@ class Stat_Window:
|
||||||
|
|
||||||
|
|
||||||
self.window.move(self.x, self.y)
|
self.window.move(self.x, self.y)
|
||||||
self.window.realize() # window must be realized before it has a gdkwindow so we can attach it to the table window..
|
|
||||||
self.topify_window(self.window)
|
|
||||||
|
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
self.window.realize() # window must be realized before it has a gdkwindow so we can attach it to the table window..
|
||||||
|
# self.topify_window(self.window)
|
||||||
|
|
||||||
def topify_window(self, window):
|
|
||||||
window.set_focus_on_map(False)
|
|
||||||
window.set_accept_focus(False)
|
|
||||||
|
|
||||||
if not self.table.gdkhandle:
|
|
||||||
self.table.gdkhandle = gtk.gdk.window_foreign_new(int(self.table.number)) # gtk handle to poker window
|
|
||||||
# window.window.reparent(self.table.gdkhandle, 0, 0)
|
|
||||||
window.window.set_transient_for(self.table.gdkhandle)
|
|
||||||
# window.present()
|
|
||||||
|
|
||||||
def destroy(*args): # call back for terminating the main eventloop
|
def destroy(*args): # call back for terminating the main eventloop
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
|
@ -26,6 +26,9 @@ client has been resized, destroyed, etc.
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
import L10n
|
||||||
|
_ = L10n.get_translation()
|
||||||
|
|
||||||
# Standard Library modules
|
# Standard Library modules
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -66,7 +69,7 @@ bad_words = ('History for table:', 'HUD:', 'Chat:', 'FPDBHUD')
|
||||||
|
|
||||||
# Here are the custom signals we define for allowing the 'client watcher'
|
# Here are the custom signals we define for allowing the 'client watcher'
|
||||||
# thread to communicate with the gui thread. Any time a poker client is
|
# thread to communicate with the gui thread. Any time a poker client is
|
||||||
# is moved, resized, or closed on of these signals is emitted to the
|
# is moved, resized, or closed one of these signals is emitted to the
|
||||||
# HUD main window.
|
# HUD main window.
|
||||||
gobject.signal_new("client_moved", gtk.Window,
|
gobject.signal_new("client_moved", gtk.Window,
|
||||||
gobject.SIGNAL_RUN_LAST,
|
gobject.SIGNAL_RUN_LAST,
|
||||||
|
|
|
@ -56,12 +56,23 @@ class Table(Table_Window):
|
||||||
"""Finds poker client window with the given table name."""
|
"""Finds poker client window with the given table name."""
|
||||||
titles = {}
|
titles = {}
|
||||||
win32gui.EnumWindows(win_enum_handler, titles)
|
win32gui.EnumWindows(win_enum_handler, titles)
|
||||||
for hwnd in titles:
|
for hwnd in titles:
|
||||||
if titles[hwnd] == "":
|
if titles[hwnd] == "":
|
||||||
continue
|
continue
|
||||||
if re.search(self.search_string, titles[hwnd], re.I):
|
if re.search(self.search_string, titles[hwnd], re.I):
|
||||||
if self.check_bad_words(titles[hwnd]):
|
if self.check_bad_words(titles[hwnd]):
|
||||||
continue
|
continue
|
||||||
|
if not win32gui.IsWindowVisible(hwnd): # if window not visible, probably not a table
|
||||||
|
continue
|
||||||
|
if win32gui.GetParent(hwnd) != 0: # if window is a child of another window, probably not a table
|
||||||
|
continue
|
||||||
|
HasNoOwner = win32gui.GetWindow(hwnd, win32con.GW_OWNER) == 0
|
||||||
|
WindowStyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
|
||||||
|
if HasNoOwner and WindowStyle & win32con.WS_EX_TOOLWINDOW != 0:
|
||||||
|
continue
|
||||||
|
if not HasNoOwner and WindowStyle & win32con.WS_EX_APPWINDOW == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
self.window = hwnd
|
self.window = hwnd
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user