Пример #1
0
 def get_word_amount(self):
     '''prompts user for an integer for word amount'''
     message = 'Enter the amount of words you would like to type: '
     word_amount = TextWindow(self.stdscr, message=message).get_output()
     while not str(word_amount).isdigit():
         word_amount = TextWindow(self.stdscr, message=message).get_output()
     return word_amount
Пример #2
0
 def get_type_ahead_amount(self):
     '''prompts user for an integer for blank amount'''
     message = 'Enter the amount of spaces you would like to type ahead: '
     blank_amount = TextWindow(self.stdscr, message = message).get_output()
     while not str(blank_amount).isdigit():
         blank_amount = TextWindow(self.stdscr, message = message).get_output()
     self.type_ahead_amount = int(blank_amount)
Пример #3
0
    def word_breakdown(self):
        '''prompts user for a word'''
        message = 'Enter the word you would like to practice on: '
        word = TextWindow(self.stdscr, message=message).get_output()
        while len(word) < 2 or len(word.split()) != 1:
            word = TextWindow(self.stdscr, message=message).get_output()

        message = 'Enter the amount of times you would like to repeat word parts: '
        amount = TextWindow(self.stdscr, message=message).get_output()
        while not str(amount).isdigit():
            amount = TextWindow(self.stdscr, message=message).get_output()
        return self.get_word_breakdown(word, int(amount))
Пример #4
0
    def _add_new_text(self):
        '''ask for a file name and a text body'''
        while True:
            title_message = 'First, Enter the Title of the Literature and F4 when done: '
            title_window = TextWindow(self.stdscr,
                                      message=title_message,
                                      termination_trigger='f4')
            file_name = title_window.get_output()
            if len(file_name) > 1 and len(file_name) < 35:
                break

        while True:
            text_message = 'Now, Enter the Text for the Literature and F4 when done: '
            text_window = TextWindow(self.stdscr,
                                     message=text_message,
                                     termination_trigger='f4')
            content = text_window.get_output()
            if content:
                break
        self._write_literature(file_name, content)
Пример #5
0
 def get_text_from_clipboard(stdscr):
     return TextWindow(stdscr, message = 'Paste Clipboard and F4 when done: ').get_output()
Пример #6
0
 def get_text_from_url(stdscr):
     url = TextWindow(stdscr, message = 'Enter a URL and F4 when done: ').get_output()
     text = scrape_url(url)
     return text
Пример #7
0
def main(stdscr):
    text = TextWindow(stdscr, 'clipboard')
Пример #8
0
 def word_by_length(self):
     message = 'Enter the length of words to type: '
     length = TextWindow(self.stdscr, message=message).get_output()
     while not str(length).isdigit() and 0 < length < 16:
         length = TextWindow(self.stdscr, message=message).get_output()
     return self.get_word_by_length(int(length))
Пример #9
0
 def _get_text_from_clipboard(self):
     '''gets the clipboard from the user as input text'''
     cb_message = 'Paste Clipboard and F4 when done: '
     clipboard_window = TextWindow(self.stdscr, message = cb_message, termination_trigger = 'f4')
     return clipboard_window.get_output()