Allow user to choose image directory
(self)
| 11 | self.isMergePDF = True |
| 12 | |
| 13 | def getUserDir(self): |
| 14 | """Allow user to choose image directory""" |
| 15 | |
| 16 | msg = "\n1. Current directory\n2. Custom directory\nEnter a number: " |
| 17 | user_option = int(input(msg)) |
| 18 | |
| 19 | # Restrict input to either (1 or 2) |
| 20 | while user_option <= 0 or user_option >= 3: |
| 21 | user_option = int(input(f"\n*Invalid input*\n{msg}")) |
| 22 | |
| 23 | self.directory = ( |
| 24 | os.getcwd() if user_option == 1 else input("\nEnter custom directory: ") |
| 25 | ) |
| 26 | |
| 27 | def filter(self, item): |
| 28 | return item.endswith(self.validFormats) |