def menu(self,action): txt=(action.text()) if txt=='NEW Team': self.bat=0 self.bwl=0 self.ar=0 self.wk=0 self.avl=1000 self.used=0 self.list1.clear() self.list2.clear() #self.t7.setText("???") #self.dial() text, ok=QtWidgets.QInputDialog.getText(MainWindow, "Team", "Enter name of team:") if ok: self.t7.setText(str(text)) self.show() if txt=='SAVE Team': count=self.list2.count() selected="" for i in range(count): selected+=self.list2.item(i).text() if i<count: selected+="," self.saveteam(self.t7.text(),selected,self.used) if txt=='OPEN Team': self.bat=0 self.bwl=0 self.ar=0 self.wk=0 self.avl=1000 self.used=0 self.list1.clear() self.list2.clear() self.show() #print("rgr") self.openteam() if txt=='EVALUATE Team': from dlgscore import Ui_Dialog Dialog = QtWidgets.QDialog() ui = Ui_Dialog() ui.setupUi(Dialog) #print("effieh") ret=Dialog.exec()
def menufunction(self, action): """ action: The option selected from menu. function: Performs the selected option. """ txt = action.text() if txt == "New Team": ## Reset the class attributes self.bat = 0 self.bwl = 0 self.ar = 0 self.wk = 0 self.avl = 1000 self.used = 0 self.list1.clear() self.list2.clear() self.l1.setText("???") self.showstatus() text, ok = QtWidgets.QInputDialog.getText(MainWindow, 'Dream Team Selector', 'Enter name of team:') if ok: self.l1.setText(str(text)) if txt == 'Save Team': ## Iterate over the selected players list to create a string of player names separated by commas selected = "" count = self.list2.count() for i in range(count): selected = selected + self.list2.item(i).text() if i < count - 1: selected = selected + "," self.saveteam(self.l1.text(), selected, self.used) if txt == "Open Team": ## Reset the class attributes self.bat = 0 self.bwl = 0 self.ar = 0 self.wk = 0 self.avl = 1000 self.used = 0 self.list1.clear() self.list2.clear() self.l1.setText("???") self.showstatus() self.openteam() if txt == "Team Score": from dlgscore import Ui_Dialog Dialog = QtWidgets.QDialog() ui = Ui_Dialog() ui.setupUi(Dialog) ret = Dialog.exec()