Really basic check that username exists

This commit is contained in:
Worros 2008-12-10 21:21:43 +09:00
parent dc33003ce4
commit 9ca0574d78

View File

@ -46,41 +46,42 @@ class GuiPlayerStats (threading.Thread):
result = self.cursor.execute(self.sql.query['getPlayerId'], self.heroes[self.activesite]) result = self.cursor.execute(self.sql.query['getPlayerId'], self.heroes[self.activesite])
result = self.db.cursor.fetchall() result = self.db.cursor.fetchall()
pid = result[0][0] if not result == ():
tmp = tmp.replace("<player_test>", "(" + str(pid) + ")") pid = result[0][0]
self.cursor.execute(tmp) tmp = tmp.replace("<player_test>", "(" + str(pid) + ")")
result = self.db.cursor.fetchall() self.cursor.execute(tmp)
cols = 18 result = self.db.cursor.fetchall()
rows = len(result)+1 # +1 for title row cols = 18
self.stats_table = gtk.Table(rows, cols, False) rows = len(result)+1 # +1 for title row
self.stats_table.set_col_spacings(4) self.stats_table = gtk.Table(rows, cols, False)
self.stats_table.show() self.stats_table.set_col_spacings(4)
vbox.add(self.stats_table) self.stats_table.show()
vbox.add(self.stats_table)
# Create header row # Create header row
titles = ("GID", "base", "Style", "Site", "$BB", "Hands", "VPIP", "PFR", "saw_f", "sawsd", "wtsdwsf", "wmsd", "FlAFq", "TuAFq", "RvAFq", "PFAFq", "Net($)", "BB/100") titles = ("GID", "base", "Style", "Site", "$BB", "Hands", "VPIP", "PFR", "saw_f", "sawsd", "wtsdwsf", "wmsd", "FlAFq", "TuAFq", "RvAFq", "PFAFq", "Net($)", "BB/100")
col = 0 col = 0
row = 0 row = 0
for t in titles: for t in titles:
l = gtk.Label(titles[col]) l = gtk.Label(titles[col])
l.show() l.show()
self.stats_table.attach(l, col, col+1, row, row+1) self.stats_table.attach(l, col, col+1, row, row+1)
col +=1 col +=1
for row in range(rows-1): for row in range(rows-1):
for col in range(cols): for col in range(cols):
if(row%2 == 0): if(row%2 == 0):
bgcolor = "white" bgcolor = "white"
else: else:
bgcolor = "lightgrey" bgcolor = "lightgrey"
eb = gtk.EventBox() eb = gtk.EventBox()
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
l = gtk.Label(result[row-1][col]) l = gtk.Label(result[row-1][col])
eb.add(l) eb.add(l)
self.stats_table.attach(eb, col, col+1, row+1, row+2) self.stats_table.attach(eb, col, col+1, row+1, row+2)
l.show() l.show()
eb.show() eb.show()
def fillPlayerFrame(self, vbox): def fillPlayerFrame(self, vbox):