add button to display info from TP to tourneyviewer
This commit is contained in:
parent
c5bd036b6e
commit
bb743b4567
|
@ -2120,7 +2120,6 @@ class Database:
|
|||
c = self.get_cursor()
|
||||
c.execute(self.sql.query['getTourneyInfo'], (siteName, tourneyNo))
|
||||
columnNames=c.description
|
||||
#print "columnNames:",columnNames
|
||||
|
||||
names=[]
|
||||
for column in columnNames:
|
||||
|
@ -2129,6 +2128,19 @@ class Database:
|
|||
data=c.fetchone()
|
||||
return (names,data)
|
||||
#end def getTourneyInfo
|
||||
|
||||
def getTourneyPlayerInfo(self, siteName, tourneyNo, playerName):
|
||||
c = self.get_cursor()
|
||||
c.execute(self.sql.query['getTourneyPlayerInfo'], (siteName, tourneyNo, playerName))
|
||||
columnNames=c.description
|
||||
|
||||
names=[]
|
||||
for column in columnNames:
|
||||
names.append(column[0])
|
||||
|
||||
data=c.fetchone()
|
||||
return (names,data)
|
||||
#end def getTourneyPlayerInfo
|
||||
#end class Database
|
||||
|
||||
# Class used to hold all the data needed to write a hand to the db
|
||||
|
|
|
@ -37,12 +37,19 @@ class GuiTourneyViewer (threading.Thread):
|
|||
label=gtk.Label("Enter the tourney number you want to display:")
|
||||
self.interfaceHBox.add(label)
|
||||
|
||||
self.entryBox = gtk.Entry()
|
||||
self.interfaceHBox.add(self.entryBox)
|
||||
self.entryTourney = gtk.Entry()
|
||||
self.interfaceHBox.add(self.entryTourney)
|
||||
|
||||
self.button = gtk.Button("_Display")
|
||||
self.button.connect('clicked', self.displayClicked)
|
||||
self.interfaceHBox.add(self.button)
|
||||
self.displayButton = gtk.Button("_Display")
|
||||
self.displayButton.connect('clicked', self.displayClicked)
|
||||
self.interfaceHBox.add(self.displayButton)
|
||||
|
||||
self.entryPlayer = gtk.Entry()
|
||||
self.interfaceHBox.add(self.entryPlayer)
|
||||
|
||||
self.playerButton = gtk.Button("Display _Player")
|
||||
self.playerButton.connect('clicked', self.displayPlayerClicked)
|
||||
self.interfaceHBox.add(self.playerButton)
|
||||
|
||||
self.table = gtk.Table(columns=10, rows=9)
|
||||
self.mainVBox.add(self.table)
|
||||
|
@ -51,7 +58,7 @@ class GuiTourneyViewer (threading.Thread):
|
|||
#end def __init__
|
||||
|
||||
def displayClicked(self, widget, data=None):
|
||||
tourneyNo=int(self.entryBox.get_text())
|
||||
tourneyNo=int(self.entryTourney.get_text())
|
||||
siteName=self.siteBox.get_active_text()
|
||||
|
||||
self.table.destroy()
|
||||
|
@ -79,6 +86,36 @@ class GuiTourneyViewer (threading.Thread):
|
|||
self.mainVBox.show_all()
|
||||
#def displayClicked
|
||||
|
||||
def displayPlayerClicked(self, widget, data=None):
|
||||
tourneyNo=int(self.entryTourney.get_text())
|
||||
siteName=self.siteBox.get_active_text()
|
||||
playerName=self.entryPlayer.get_text()
|
||||
|
||||
self.table.destroy()
|
||||
self.table=gtk.Table(columns=4, rows=5)
|
||||
self.mainVBox.add(self.table)
|
||||
|
||||
result=self.db.getTourneyPlayerInfo(siteName, tourneyNo, playerName)
|
||||
x=0
|
||||
y=0
|
||||
for i in range(1,len(result[0])):
|
||||
if y==5:
|
||||
x+=2
|
||||
y=0
|
||||
|
||||
label=gtk.Label(result[0][i])
|
||||
self.table.attach(label,x,x+1,y,y+1)
|
||||
|
||||
if result[1][i]==None:
|
||||
label=gtk.Label("N/A")
|
||||
else:
|
||||
label=gtk.Label(result[1][i])
|
||||
self.table.attach(label,x+1,x+2,y,y+1)
|
||||
|
||||
y+=1
|
||||
self.mainVBox.show_all()
|
||||
#def displayPlayerClicked
|
||||
|
||||
def get_vbox(self):
|
||||
"""returns the vbox of this thread"""
|
||||
return self.mainVBox
|
||||
|
|
|
@ -3819,6 +3819,15 @@ class Sql:
|
|||
WHERE s.name=%s AND t.siteTourneyNo=%s
|
||||
"""
|
||||
|
||||
self.query['getTourneyPlayerInfo'] = """SELECT tp.*
|
||||
FROM Tourneys t
|
||||
INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id)
|
||||
INNER JOIN Sites s ON (tt.siteId = s.id)
|
||||
INNER JOIN TourneysPlayers tp ON (tp.tourneyId = t.id)
|
||||
INNER JOIN Players p ON (p.id = tp.playerId)
|
||||
WHERE s.name=%s AND t.siteTourneyNo=%s AND p.name=%s
|
||||
"""
|
||||
|
||||
self.query['insertTourney'] = """INSERT INTO Tourneys
|
||||
(tourneyTypeId, siteTourneyNo, entries, prizepool,
|
||||
startTime, endTime, tourneyName, matrixIdProcessed,
|
||||
|
|
Loading…
Reference in New Issue
Block a user