diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index b0da336b..37a31c9e 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -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'])