def handle(self, text_window: PaneControl,
            text_pos: TextPosition) -> TextPosition:
     if text_pos[0:2] in (' "', '("', '>"'):
         text_window.SendKeys('{Right}{Shift}({Right})„', waitTime=0)
         text_pos.text = text_pos.text.replace(text_pos[1], '„', 1)
         text_pos += 2
     elif text_pos[-2:0] in (' "', '("', '>"'):
         text_window.SendKeys('{Shift}({Left})„', waitTime=0)
         text_pos.text = text_pos.text.replace(text_pos[-2], '„', 1)
     return text_pos
 def handle(self, text_window: PaneControl,
            text_pos: TextPosition) -> TextPosition:
     if text_pos[-1] == '\n':
         if text_pos[0] not in ('$', '|'):
             text_window.SendKeys('$>', waitTime=0)
             text_pos.insert('$>')
             text_pos += 2
             if text_pos[0] in ('-', '—'):
                 text_window.SendKeys('{Shift}({Right 2})— {Left 2}',
                                      waitTime=0)
     return text_pos
 def handle(self, text_window: PaneControl,
            text_pos: TextPosition) -> TextPosition:
     if text_pos[0:2] in ('" ', '".', '",'):
         text_window.SendKeys('{Shift}({Right})”', waitTime=0)
         text_pos.text = text_pos.text.replace(text_pos[0], '”', 1)
         text_pos += 1
     return text_pos
Example #4
0
 def handle(self, text_window: PaneControl,
            text_pos: TextPosition) -> TextPosition:
     if text_pos[0:3] in (' - ', '>- ', '>-\t'):
         new_dash = text_pos[0] + '— '
         text_window.SendKeys('{Shift}({Right 3})' + new_dash, waitTime=0)
         text_pos.text = text_pos.text.replace(text_pos[0:3], new_dash, 1)
         text_pos += 3
     return text_pos
Example #5
0
 def handle(self, text_window: PaneControl,
            text_pos: TextPosition) -> TextPosition:
     keys = [self.precode + key for key in self.dict.keys()]
     if text_pos[0:2] in keys:
         n = self.__count_chars(text_pos)
         text_window.SendKeys('{Shift}({Right ' + str(1 + n) + '})',
                              waitTime=0)
         chars_new = ''
         for char in text_pos[1:1 + n]:
             chars_new += self.dict[char]
         text_window.SendKeys(chars_new + '{Left}', waitTime=0)
         text_pos.text = text_pos.text.replace(text_pos[0:1 + n],
                                               chars_new, 1)
         text_pos += n - 1
     return text_pos
def text_position_initialise(
        text_window: PaneControl,
        copy_button_control: ButtonControl) -> TextPosition:
    text_window.SetFocus()
    sleep(0.5)
    text_window.SendKeys('{Ctrl}{Home}')
    sleep(0.5)
    text_window.SendKeys('{Shift}{Ctrl}{End}')
    copy_button_control.Click(simulateMove=False, waitTime=1)
    sleep(0.5)
    text_window.SendKeys('{Left}', waitTime=0)

    text = pyperclip.paste()
    text = re.sub('\r\n', '\n', text)
    text = re.sub('\n+', '\n', text)
    text = re.sub('—  ', '— ', text)

    return TextPosition(text, 0, text_window=text_window)
Example #7
0
 def handle(self, text_window: PaneControl,
            text_pos: TextPosition) -> TextPosition:
     if text_pos[0:3] in SKR.keys():
         text_window.SendKeys('{Shift}({Right 3})', waitTime=0)
         char_abb = text_pos[0:3]
         is_italic = self.it_access.State == 16
         text_window.SendKeys(SKR[char_abb], waitTime=0)
         while self.it_access.State == 16:
             time.sleep(0.001)
         if is_italic:
             text_window.SendKeys('{Shift}({Left})', waitTime=0)
             self.it_invoke.Invoke()
             text_window.SendKeys('{Right}', waitTime=0)
             while self.it_access.State == 0:
                 time.sleep(0.001)
         text_pos.text = text_pos.text.replace(char_abb, SKR[char_abb], 1)
         text_pos += 1
     return text_pos