示例#1
0
文件: main.py 项目: BoarCub/Neumann
    def executionPopupConfirmCallback(self, instance):

        if self.exportNumber == None:
            self.customPopup = Popup(title="Warning",
                                     content=FloatLayout(size=self.size),
                                     size_hint=(0.5, 0.8))

            # Label which will display "Your Input Was Invalid"
            messageLabel = Label(size_hint=(0.5, 0.1),
                                 pos_hint={
                                     'center_x': 0.5,
                                     'center_y': 0.7
                                 },
                                 text="Your Input Was\nEmpty",
                                 halign='center',
                                 font_size="20sp")

            # Okay Button which will close the popup
            okayButton = Button(size_hint=(0.5, 0.1),
                                pos_hint={
                                    'center_x': 0.5,
                                    'center_y': 0.3
                                },
                                text="Okay")
            okayButton.bind(
                on_release=self.closeCustomPopup
            )  # Binds the Okay Button to self.closeCustomPopup()

            # Adds the label and the button to the popup
            self.customPopup.content.add_widget(messageLabel)
            self.customPopup.content.add_widget(okayButton)

            self.customPopup.open()  # Opens the popup

        elif self.exportNumber <= 0:
            self.customPopup = Popup(title="Warning",
                                     content=FloatLayout(size=self.size),
                                     size_hint=(0.5, 0.8))

            # Label which will display "Your Input Was Invalid"
            messageLabel = Label(size_hint=(0.5, 0.1),
                                 pos_hint={
                                     'center_x': 0.5,
                                     'center_y': 0.7
                                 },
                                 text="Your Input Was\nInvalid",
                                 halign='center',
                                 font_size="20sp")

            # Okay Button which will close the popup
            okayButton = Button(size_hint=(0.5, 0.1),
                                pos_hint={
                                    'center_x': 0.5,
                                    'center_y': 0.3
                                },
                                text="Okay")
            okayButton.bind(
                on_release=self.closeCustomPopup
            )  # Binds the Okay Button to self.closeCustomPopup()

            # Adds the label and the button to the popup
            self.customPopup.content.add_widget(messageLabel)
            self.customPopup.content.add_widget(okayButton)

            self.customPopup.open()  # Opens the popup

        else:
            TaskManager.exportWorksheet(self.exportNumber)
            self.executionPopup.dismiss()
            self.makeCustomPopup(
                "Worksheet Successfully\nSaved!"
            )  # Displays a popup to the user that tells the user that the task saved