<s> import os <EOL> from PySide . QtGui import * <EOL> from PySide . QtCore import * <EOL> from ui_Event import Ui_Event <EOL> '''<STR_LIT>''' <EOL> class EventWindow ( QDialog , Ui_Event ) : <EOL> def __init__ ( self , parent , eventId ) : <EOL> super ( EventWindow , self ) . __init__ ( parent ) <EOL> self . rent = parent <EOL> self . data = parent . eventData [ eventId ] <EOL> self . deckAssignment = [ ] <EOL> self . setupUi ( self ) <EOL> self . assignWidgets ( ) <EOL> self . setWindowTitle ( unicode ( "<STR_LIT>" % eventId ) ) <EOL> def savePressed ( self ) : <EOL> self . data [ "<STR_LIT>" ] = self . notesText . toPlainText ( ) <EOL> self . data [ "<STR_LIT>" ] = self . deckText . text ( ) <EOL> self . data [ "<STR_LIT>" ] = self . placeText . text ( ) <EOL> self . data [ "<STR_LIT>" ] = self . eventTypeText . text ( ) <EOL> self . data [ "<STR_LIT>" ] = self . playersText . text ( ) <EOL> self . data [ "<STR_LIT>" ] = self . formatText . text ( ) <EOL> self . data [ "<STR_LIT>" ] = self . locationText . text ( ) <EOL> self . data [ "<STR_LIT>" ] = self . dateText . text ( ) <EOL> ourCounter = <NUM_LIT:0> <EOL> for ourRound in self . deckAssignment : <EOL> self . data [ "<STR_LIT>" ] [ self . deckAssignment [ ourCounter ] [ <NUM_LIT:0> ] ] [ <NUM_LIT:2> ] = self . deckAssignment [ ourCounter ] [ <NUM_LIT:1> ] <EOL> ourCounter += <NUM_LIT:1> <EOL> self . rent . updateGUI ( ) <EOL> self . rent . messageBox ( "<STR_LIT>" ) <EOL> def closePressed ( self ) : <EOL> self . hide ( ) <EOL> def roundSelected ( self , ourRound , ourColumn ) : <EOL> ourIndex = int ( ourRound . text ( <NUM_LIT:0> ) ) - <NUM_LIT:1> <EOL> deckName , ok = QInputDialog . getText ( self , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> if ok and deckName : <EOL> self . data [ "<STR_LIT>" ] [ ourIndex ] [ <NUM_LIT:3> ] . setData ( <NUM_LIT:3> , <NUM_LIT:0> , deckName ) <EOL> self . deckAssignment . append ( [ ourIndex , deckName ] ) <EOL> def assignWidgets ( self ) : <EOL> self . saveChangesButton . clicked . connect ( self . savePressed ) <EOL> self . closeButton . clicked . connect ( self . closePressed ) <EOL> self . roundTree . itemDoubleClicked . connect ( self . roundSelected ) <EOL> self . notesText . setPlainText ( self . data [ "<STR_LIT>" ] ) <EOL> self . deckText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> self . placeText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> self . eventTypeText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> self . playersText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> self . formatText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> self . locationText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> self . dateText . setText ( self . data [ "<STR_LIT>" ] ) <EOL> matchItem = TreeWidgetItem ( self . resultsTree ) <EOL> matchItem . setText ( <NUM_LIT:0> , unicode ( self . data [ "<STR_LIT>" ] ) ) <EOL> matchItem . setText ( <NUM_LIT:1> , unicode ( self . data [ "<STR_LIT>" ] ) ) <EOL> matchItem . setText ( <NUM_LIT:2> , unicode ( self . data [ "<STR_LIT>" ] ) ) <EOL> matchItem . setText ( <NUM_LIT:3> , unicode ( self . data [ "<STR_LIT>" ] ) ) <EOL> self . resultsTree . addTopLevelItem ( matchItem ) <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> self . resultsTree . resizeColumnToContents ( i ) <EOL> roundCounter = <NUM_LIT:1> <EOL> for opponent in self . data [ "<STR_LIT>" ] : <EOL> roundItem = TreeWidgetItem ( self . roundTree ) <EOL> roundItem . setText ( <NUM_LIT:0> , unicode ( roundCounter ) ) <EOL> roundItem . setText ( <NUM_LIT:1> , unicode ( opponent [ <NUM_LIT:0> ] ) ) <EOL> roundItem . setText ( <NUM_LIT:2> , unicode ( opponent [ <NUM_LIT:1> ] ) ) <EOL> roundItem . setText ( <NUM_LIT:3> , unicode ( opponent [ <NUM_LIT:2> ] ) ) <EOL> opponent [ <NUM_LIT:3> ] = roundItem <EOL> self . roundTree . addTopLevelItem ( roundItem ) <EOL> roundCounter += <NUM_LIT:1> <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> self . roundTree . resizeColumnToContents ( i ) <EOL> class TreeWidgetItem ( QTreeWidgetItem ) : <EOL> def __init__ ( self , parent = None ) : <EOL> QTreeWidgetItem . __init__ ( self , parent ) <EOL> def __lt__ ( self , otherItem ) : <EOL> column = self . treeWidget ( ) . sortColumn ( ) <EOL> try : <EOL> return float ( self . text ( column ) ) > float ( otherItem . text ( column ) ) <EOL> except ValueError : <EOL> return self . text ( column ) > otherItem . text ( column ) </s>
