Exemple #1
0
def redirect_stdout(area):
    try:
        sys.stdout.remove(area)
    except ValueError:
        pass
    sys.stdout.append(Stdout(area))
    set_status_msg('Output redirected to %s' % area.index('insert'))
Exemple #2
0
def redirect_stdout(area):
    try:
        sys.stdout.remove(area)
    except ValueError:
        pass
    sys.stdout.append(Stdout(area))
    set_status_msg('Output redirected to %s' % area.index('insert'))
Exemple #3
0
    def start_debug_args(self, area):
        ask  = Ask(area)
        ARGS = 'python -u -m pdb %s %s' % (area.filename, ask.data)
        ARGS = shlex.split(ARGS)

        self.kill_debug_process()
        self.create_process(ARGS)
        
        set_status_msg('Debug started ! Args: %s' % ask.data)
Exemple #4
0
    def del_data(self, area):
        """

        """

        self.data[-1] = self.data[-1][:-1]
        if not self.data[-1] and len(self.data) > 1: self.data.pop()

        set_status_msg('Pattern:%s' % '.+?'.join(self.data))
        area.tag_remove('sel', *self.start_range(area))
        area.pick_next_down('sel', self.make_pattern(), *self.start_range(area))
Exemple #5
0
def save_quit(area):
    """
    It saves the contents of the text area then quits.
    """

    try:
        area.save_data()
    except Exception:
        set_status_msg('It failed to save data.')
    else:
        area.quit()
Exemple #6
0
def save(area):
    """
    It just saves the text area contents into the    
    actual opened file.
    """

    try:
        area.save_data()
    except Exception:
        set_status_msg('It failed to save data.')
    else:
        set_status_msg('Data saved.')
Exemple #7
0
    def add_data(self, area, char):
        """

        """

        try:
            char = chr(char)
        except ValueError:
            return
        else:
            self.data[-1] = self.data[-1] + char

        set_status_msg('Pattern:%s' % '.+?'.join(self.data))
        area.tag_remove('sel', *self.start_range(area))
        area.pick_next_down('sel', self.make_pattern(), *self.start_range(area))
Exemple #8
0
def install(area):
    area.install(
        (-1, '<FocusIn>', lambda event: update_mode(event.widget)),
        (-1, '<FocusIn>', lambda event: update_cursor_pos(event.widget)),
        (-1, '<Control-F9>', lambda event: root.status.switch()),
        (-1, '<Escape>', lambda event: set_status_msg('')),
        (-1, '<<SaveData>>',
         lambda event: root.title('Vy %s' % event.widget.filename)),
        (-1, '<<LoadData>>',
         lambda event: root.title('Vy %s' % event.widget.filename)),
        (-1, '<<ClearData>>',
         lambda event: root.title('Vy %s' % event.widget.filename)),
        (-1, '<FocusIn>',
         lambda event: root.title('Vy %s' % event.widget.filename)),
        (-1, '<<SaveData>>',
         lambda event: root.note.tab(get_area_tab_index(event.widget),
                                     text=basename(event.widget.filename))),
        (-1, '<<LoadData>>',
         lambda event: root.note.tab(get_area_tab_index(event.widget),
                                     text=basename(event.widget.filename))),
        (-1, '<<ClearData>>',
         lambda event: root.note.tab(get_area_tab_index(event.widget),
                                     text=basename(event.widget.filename))),
        (-1, '<FocusIn>', lambda event: root.note.tab(
            root.note.select(), text=basename(event.widget.filename))))
Exemple #9
0
def save_as(area):
    """
    It pops a asksaveasfilename window to save the contents of
    the text area.
    """

    filename = asksaveasfilename()

    # If the user presses cancel it returns ''.

    if not filename: 
        return

    try:
        area.save_data_as(filename)
    except Exception:
        set_status_msg('It failed to save data.')
    else:
        set_status_msg('Data saved.')
Exemple #10
0
def load_tab():
    """
    It pops a askopenfilename window to drop
    the contents of a file into another tab's text area.
    """

    filename = askopenfilename()

    # If i don't check it ends up cleaning up
    # the text area when one presses cancel.

    if not filename:
        return

    try:
        root.note.load([[filename]])
    except Exception:
        set_status_msg('It failed to load.')
    else:
        set_status_msg('File loaded.')
Exemple #11
0
def load_tab():
    """
    It pops a askopenfilename window to drop
    the contents of a file into another tab's text area.
    """

    filename = askopenfilename()

    # If i don't check it ends up cleaning up
    # the text area when one presses cancel.

    if not filename: 
        return

    try:
        root.note.load([ [filename] ])
    except Exception:
        set_status_msg('It failed to load.')
    else:
        set_status_msg('File loaded.')
Exemple #12
0
def load(area):
    """
    It pops a askopenfilename to find a file to drop
    the contents in the focused text area.
    """

    filename = askopenfilename()

    # If i don't check it ends up cleaning up
    # the text area when one presses cancel.

    if not filename: 
        return

    try:
        area.load_data(filename)
    except Exception:
        set_status_msg('It failed to load.')
    else:
        set_status_msg('File loaded.')
Exemple #13
0
def install(area):
    area.install((-1, '<FocusIn>', lambda event: update_mode(event.widget)),
           (-1, '<FocusIn>', lambda event: update_cursor_pos(event.widget)),
           (-1, '<Control-F9>', lambda event: root.status.switch()),
           (-1, '<Escape>', lambda event: set_status_msg('')),

           (-1, '<<SaveData>>', lambda event: root.title('Vy %s' % event.widget.filename)),
           (-1, '<<LoadData>>', lambda event: root.title('Vy %s' % event.widget.filename)),
           (-1, '<<ClearData>>', lambda event: root.title('Vy %s' % event.widget.filename)),
           (-1, '<FocusIn>', lambda event: root.title('Vy %s' % event.widget.filename)),

           (-1, '<<SaveData>>', lambda event: root.note.tab(get_area_tab_index(event.widget), text=basename(event.widget.filename))),
           (-1, '<<LoadData>>', lambda event: root.note.tab(get_area_tab_index(event.widget), text=basename(event.widget.filename))),
           (-1, '<<ClearData>>', lambda event: root.note.tab(get_area_tab_index(event.widget), text=basename(event.widget.filename))),
           (-1, '<FocusIn>', lambda event: root.note.tab(root.note.select(), text=basename(event.widget.filename))))
Exemple #14
0
def set_target(area):
    area.active()
    set_status_msg('Target set !')
Exemple #15
0
 def start_mode(self, area):
     self.data = ['']
     set_status_msg('')
     area.chmode('QUICK_SEARCH')
Exemple #16
0
    def start_debug(self, area):
        self.kill_debug_process()
        self.create_process(['python', '-u', '-m', 'pdb', area.filename])

        set_status_msg('Debug started !')
Exemple #17
0
 def terminate_process(self):
     self.kill_debug_process()
     set_status_msg('Debug finished !')
Exemple #18
0
def drop_start_mark(area):
    area.start_block_selection()
    set_status_msg('Dropped block selection mark.')
Exemple #19
0
def clip_ph(area):
    """ Sends filename path to clipboard. """
    area.clipboard_clear()
    area.clipboard_append(area.filename)
    set_status_msg('File path copied to the clipboard.')
Exemple #20
0
    def restart(self):
        self.child.kill()
        self.start()

        set_status_msg('Process killed and started !')
Exemple #21
0
    def restart(self):
        self.child.kill()
        self.start()

        set_status_msg('Process killed and started !')
Exemple #22
0
 def no_match(self, area):
     set_status_msg('No pattern found!')
     area.chmode('NORMAL')
Exemple #23
0
def set_target(area):
    area.active()
    set_status_msg('Target set !')
Exemple #24
0
def clip_ph(area):
    """ Sends filename path to clipboard. """
    area.clipboard_clear()
    area.clipboard_append(area.filename)
    set_status_msg('File path copied to the clipboard.')
Exemple #25
0
def drop_selection_mark(area):
    area.start_selection()
    set_status_msg('Dropped selection mark.')
Exemple #26
0
def drop_start_mark(area):
    area.start_block_selection()
    set_status_msg('Dropped block selection mark.')
Exemple #27
0
def drop_selection_mark(area):
    area.start_selection()
    set_status_msg("Dropped selection mark.")