Ejemplo n.º 1
0
def do_something_on_file(tab):
    cmd = wcall.entry_dosmthing(tab.path)
    if cmd:
        selections = __get_selections_list(tab)
        for f in selections:
            __cmd_file(tab, cmd, f)
        tab.selections = []
Ejemplo n.º 2
0
def do_something_on_file(tab):
    cmd = wcall.entry_dosmthing(tab.path)
    if cmd:
        selections = __get_selections_list(tab)
        for f in selections:
            __cmd_file(tab, cmd, f)
        tab.selections = []
Ejemplo n.º 3
0
def findgrep(tab):
    fs, pat = wcall.dentry_findgrep(tab.path)
    if fs == None or fs == '':
        return
    path = os.path.dirname(fs)
    fs = os.path.basename(fs)

    if path in [None, '']:
        path = tab.path
    if path[0] != os.sep:
        path = os.path.join(tab.path, path)

    tab.app.display()  #clear screen from previos dialog
    st, m = wcall.win_searching(tab.pane.app, path, fs, pat)
    if st == -1:
        return

    par = ''
    while 1:
        cmd, par = wcall.win_search_list(m, par)
        f, line = '', 0
        if par:
            if pat:
                try:
                    line = int(par.split(':')[0])
                except ValueError:
                    f = os.path.join(path, par)
                else:
                    f = os.path.join(path, par[par.find(':') + 1:])
            else:
                f = os.path.join(path, par)
        if cmd == 0:  # goto file
            __goto(f, tab)
            break
        elif cmd == 1:  # panelize
            __panelize(tab, path, m)
            break
        elif cmd == 2:  # view
            __view_edit(tab.app, utils.insert_backslash(f), line, 0)
        elif cmd == 3:  # edit
            __view_edit(tab.app, utils.insert_backslash(f), line, 1)
        elif cmd == 4:
            cmd2 = wcall.entry_dosmthing(tab.path)
            __cmd_file(tab, cmd2, f)
        else:
            break
Ejemplo n.º 4
0
def findgrep(tab):
    fs, pat = wcall.dentry_findgrep(tab.path)
    if fs == None or fs == '':
        return
    path = os.path.dirname(fs)
    fs = os.path.basename(fs)

    if path in [None, '']:
        path = tab.path
    if path[0] != os.sep:
        path = os.path.join(tab.path, path)

    tab.app.display() #clear screen from previos dialog
    st, m = wcall.win_searching(tab.pane.app, path, fs, pat)
    if st ==-1:
        return

    par = ''
    while 1:
        cmd, par = wcall.win_search_list(m, par)
        f, line = '', 0
        if par:
            if pat:
                try:
                    line = int(par.split(':')[0])
                except ValueError:
                    f = os.path.join(path, par)
                else:
                    f = os.path.join(path, par[par.find(':')+1:])
            else:
                f = os.path.join(path, par)
        if cmd == 0:             # goto file
            __goto(f, tab)
            break
        elif cmd == 1:           # panelize
            __panelize(tab, path, m)
            break
        elif cmd == 2:           # view
            __view_edit(tab.app, utils.insert_backslash(f), line, 0)
        elif cmd == 3:           # edit
            __view_edit(tab.app, utils.insert_backslash(f), line, 1)
        elif cmd == 4:
            cmd2 = wcall.entry_dosmthing(tab.path)
            __cmd_file(tab, cmd2, f)
        else:
            break