def saveFileScreen(self, nextScreen, currentScreen): # Returns True if none of questions are empty and none of the parameters of the question are empty checkNone = TaskManager.checkNone() titlePresent = not TaskManager.title == "" # No issues, the task and all of its questions are valid if checkNone and TaskManager.questionsPerSheet <= len( TaskManager.newTaskQuestions ) and TaskManager.questionsPerSheet > 0 and titlePresent: return nextScreen # Returns the nextScreen to continue to else: #There are some issues with the task, displaying error to the user through a notification self.customPopup = Popup(title="Warning", content=FloatLayout(size=self.size), size_hint=(0.5, 0.8)) #labelText is the string that will be displayed to the user if not checkNone: #One or more questions are empty or have empty parameters labelText = "Some Questions Are\nIncomplete" elif not titlePresent: #Since no questions are empty, the error must be that the pump goes out of bounds labelText = "The Title Is\nEmpty" else: labelText = "Questions Per\nSheet are Invalid" # Creates a label that will display the message to the user messageLabel = Label(size_hint=(0.5, 0.1), pos_hint={ 'center_x': 0.5, 'center_y': 0.7 }, text=labelText, halign='center', font_size="20sp") # Creates an "Okay" Button okayButton = Button(size_hint=(0.5, 0.1), pos_hint={ 'center_x': 0.5, 'center_y': 0.3 }, text="Okay") # Binds the button to the self.closeCustomPopup function so that pressing the button will close the popup okayButton.bind(on_release=self.closeCustomPopup) # Adds the button and label widgets to the popup self.customPopup.content.add_widget(messageLabel) self.customPopup.content.add_widget(okayButton) # Opens the popup self.customPopup.open() return currentScreen
def executeTask(self): if TaskManager.checkNone( ): # None of questions are empty or have empty parameters titlePresent = not TaskManager.title == "" inBounds = TaskManager.questionsPerSheet <= len( TaskManager.newTaskQuestions ) and TaskManager.questionsPerSheet > 0 if not inBounds: # The task causes the pump to go out of bounds and the appropriate error message is displayed self.makeCustomPopup("Questions Per\nSheet are Invalid") elif titlePresent: # Since the task is valid, an attempt is made at making a connection self.executionPopup = self.makeExecutionPopup( ) # Connection was successful, opening execution popup else: # Connection was unsuccessful self.makeCustomPopup("The Title Is\nEmpty") else: # At least on question is empty or has empty parameters self.makeCustomPopup("Some Questions Are\nIncomplete")