From 08451c77d5437bb0bdaace275c967cc34178de0f Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 10 Aug 2010 00:49:14 +0200 Subject: [PATCH] handle player not found --- pyfpdb/GuiTourneyViewer.py | 39 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/pyfpdb/GuiTourneyViewer.py b/pyfpdb/GuiTourneyViewer.py index c30cb642..70a8a7d7 100644 --- a/pyfpdb/GuiTourneyViewer.py +++ b/pyfpdb/GuiTourneyViewer.py @@ -88,23 +88,28 @@ class GuiTourneyViewer (threading.Thread): def displayPlayerClicked(self, widget, data=None): if self.prepare(4, 5): result=self.db.getTourneyPlayerInfo(self.siteName, self.tourneyNo, self.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 + if result[1] == None: + self.table.destroy() + self.errorLabel=gtk.Label("Player or tourney not found - please ensure you imported it and selected the correct site") + self.mainVBox.add(self.errorLabel) + else: + 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