コード例 #1
0
    def main(self):
        from utility.user_input import confirm

        self.user_choice()
        while self.user_selection.lower() != 'b' and\
                not confirm(f'{self.text["confirmation"]}{self.user_selection}'):
            self.user_choice()
コード例 #2
0
    def main(self):
        from utility.user_input import confirm

        self.user_choice()
        while self.user_selection.lower() != 'b' and not\
                confirm(self.text['confirmation'].format(self.user_selection)):
            self.user_choice()
コード例 #3
0
    def main(self):
        from utility.user_input import confirm

        self.user_choice()
        while self.user_selection.lower() != 'b' and\
                not confirm(f'Delivery #{self.user_selection}'):
            self.user_choice()
コード例 #4
0
 def main(self):
     from utility.user_input import confirm
     self.user_choice()
     while self.user_selection.lower() not in ('v', 'b') and\
             not confirm(self.confirmation):
         self.user_choice()
     self.result()
コード例 #5
0
    def main(self):
        from utility.user_input import confirm

        self.user_choice()
        while self.user_selection.lower() != 'b' and\
                not confirm(f"{self.text['confrimation']}{self.user_selection}"):
            self.user_choice()
コード例 #6
0
    def main(self):
        from utility.user_input import confirm

        self.user_choice()
        while self.user_selection.lower() != 'b' and\
                not confirm(self.confirmation_text):
            self.user_choice()
        self.result()
コード例 #7
0
    def main(self):
        from utility.user_input import confirm

        self.user_choice()
        while self.user_selection not in ('b', 'v') and\
                not confirm(self.confirmation_text):
            self.user_choice()
        self.result()
コード例 #8
0
    def change_day(self):
        from utility.user_input import confirm

        pattern = '^(3[01]|[12][0-9]|[1-9])$'
        prompt = 'Please enter the new day:\n'
        error_message = 'Error: please enter a number 1 - 31'
        # display current value to user
        print(f'\nCurrent day is {self.datetime.day}')
        # user inputs new day
        new_day = self.validate_user_input(pattern, prompt, error_message)
        # user confirms what they have entered
        while not confirm(f'New day is: {new_day}'):
            new_day = self.validate_user_input(pattern, prompt, error_message)
        # update datetime object with changes
        self.datetime = self.datetime.replace(day=int(new_day))
コード例 #9
0
    def change_year(self):
        from utility.user_input import confirm

        pattern = '^[1-2][0-9][0-9][0-9]$'
        prompt = 'Please enter the new year:\n'
        error_message = 'Error: please enter a number 1000 - 2999'
        # display current value to user
        print(f'\nCurrent year is {self.datetime.year}')
        # user inputs new year
        new_year = self.validate_user_input(pattern, prompt, error_message)
        # user confirms what they have entered
        while not confirm(f'New year is: {new_year}'):
            new_year = self.validate_user_input(pattern, prompt, error_message)
        # update datetime object with changes
        self.datetime = self.datetime.replace(year=int(new_year))
コード例 #10
0
    def change_hour(self):
        from utility.user_input import confirm

        pattern = '^(2[0-4]|1[0-9]|[1-9])$'
        prompt = 'Please enter the new hour:\n'
        error_message = 'Error: please enter a number 1 - 24'
        # display current value to user
        print(f'\nCurrent hour is {self.datetime.hour}')
        # user inputs new hour
        new_hour = self.validate_user_input(pattern, prompt, error_message)
        # user confirms what they have entered
        while not confirm(f'New hour is: {new_hour}'):
            new_hour = self.validate_user_input(pattern, prompt, error_message)
        # update datetime object with changes
        self.datetime = self.datetime.replace(hour=int(new_hour))
コード例 #11
0
    def change_second(self):
        from utility.user_input import confirm

        pattern = '^[1-5]?[0-9]$'
        prompt = 'Please enter the new second:\n'
        error_message = 'Error: please enter a number 0 - 59'
        # display current value to user
        print(f'\nCurrent second is {self.datetime.second}')
        # user inputs new second
        new_second = self.validate_user_input(pattern, prompt, error_message)
        # user confirms what they have entered
        while not confirm(f'New second is: {new_second}'):
            new_second = self.validate_user_input(pattern, prompt,
                                                  error_message)
        # update datetime object with changes
        self.datetime = self.datetime.replace(second=int(new_second))
コード例 #12
0
    def change_month(self):
        from utility.user_input import confirm

        pattern = '^(1[0-2]|[1-9])$'
        prompt = 'Please enter the new month:\n'
        error_message = 'Error: please enter a number 1 - 12'
        # display current value to user
        print(f'\nCurrent month is {self.datetime.month}')
        # user inputs new month
        new_month = self.validate_user_input(pattern, prompt, error_message)
        # user confirms what they have entered
        while not confirm(f'New month is: {new_month}'):
            new_month = self.validate_user_input(pattern, prompt,
                                                 error_message)
        # update datetime object with changes
        self.datetime = self.datetime.replace(month=int(new_month))