Autocomplete Hero names only lists the valid names for that pokersite

SiteID list needed to be filled before the Hero field was filled.
This commit is contained in:
Gerko de Roo 2010-01-26 20:25:04 +01:00
parent 12c93ea9a6
commit 4814c30d8f

View File

@ -51,6 +51,16 @@ class Filters(threading.Thread):
self.heroes = {}
self.boxes = {}
for site in self.conf.get_supported_sites():
#Get db site id for filtering later
self.cursor.execute(self.sql.query['getSiteId'], (site,))
result = self.db.cursor.fetchall()
if len(result) == 1:
self.siteid[site] = result[0][0]
else:
print "Either 0 or more than one site matched - EEK"
# text used on screen stored here so that it can be configured
self.filterText = {'limitsall':'All', 'limitsnone':'None', 'limitsshow':'Show _Limits'
,'seatsbetween':'Between:', 'seatsand':'And:', 'seatsshow':'Show Number of _Players'
@ -259,7 +269,7 @@ class Filters(threading.Thread):
liststore = gtk.ListStore(gobject.TYPE_STRING)
completion.set_model(liststore)
completion.set_text_column(0)
names = self.db.get_player_names(self.conf) # (config=self.conf, site_id=None, like_player_name="%")
names = self.db.get_player_names(self.conf, self.siteid[site]) # (config=self.conf, site_id=None, like_player_name="%")
for n in names: # list of single-element "tuples"
_n = Charset.to_gui(n[0])
_nt = (_n, )
@ -487,12 +497,12 @@ class Filters(threading.Thread):
vbox.pack_start(hbox, False, True, 0)
self.createSiteLine(hbox, site)
#Get db site id for filtering later
self.cursor.execute(self.sql.query['getSiteId'], (site,))
result = self.db.cursor.fetchall()
if len(result) == 1:
self.siteid[site] = result[0][0]
else:
print "Either 0 or more than one site matched - EEK"
#self.cursor.execute(self.sql.query['getSiteId'], (site,))
#result = self.db.cursor.fetchall()
#if len(result) == 1:
# self.siteid[site] = result[0][0]
#else:
# print "Either 0 or more than one site matched - EEK"
def fillGamesFrame(self, vbox):
self.cursor.execute(self.sql.query['getGames'])