add error handling for invalid entry into tourneNo field
This commit is contained in:
parent
3467f757d3
commit
391c42cdff
|
@ -58,8 +58,7 @@ class GuiTourneyViewer (threading.Thread):
|
|||
#end def __init__
|
||||
|
||||
def displayClicked(self, widget, data=None):
|
||||
self.prepare(10, 9)
|
||||
|
||||
if self.prepare(10, 9):
|
||||
result=self.db.getTourneyInfo(self.siteName, self.tourneyNo)
|
||||
x=0
|
||||
y=0
|
||||
|
@ -82,8 +81,7 @@ class GuiTourneyViewer (threading.Thread):
|
|||
#def displayClicked
|
||||
|
||||
def displayPlayerClicked(self, widget, data=None):
|
||||
self.prepare(4, 5)
|
||||
|
||||
if self.prepare(4, 5):
|
||||
result=self.db.getTourneyPlayerInfo(self.siteName, self.tourneyNo, self.playerName)
|
||||
x=0
|
||||
y=0
|
||||
|
@ -111,12 +109,21 @@ class GuiTourneyViewer (threading.Thread):
|
|||
#end def get_vbox
|
||||
|
||||
def prepare(self, columns, rows):
|
||||
try: self.errorLabel.destroy()
|
||||
except: pass
|
||||
|
||||
try:
|
||||
self.tourneyNo=int(self.entryTourney.get_text())
|
||||
except ValueError:
|
||||
self.errorLabel=gtk.Label("invalid entry in tourney number - must enter numbers only")
|
||||
self.mainVBox.add(self.errorLabel)
|
||||
return False
|
||||
self.siteName=self.siteBox.get_active_text()
|
||||
self.playerName=self.entryPlayer.get_text()
|
||||
|
||||
self.table.destroy()
|
||||
self.table=gtk.Table(columns=columns, rows=rows)
|
||||
self.mainVBox.add(self.table)
|
||||
return True
|
||||
#end def readInfo
|
||||
#end class GuiTourneyViewer
|
||||
|
|
Loading…
Reference in New Issue
Block a user