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 committed by Worros
parent fb7aae9186
commit 6c5c479ee8

View File

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