Example #1
0
def do_special_view_file(tab):
    fullfilename = os.path.join(tab.path, tab.sorted[tab.file_i])

    prog = None
    if tab.pane.app.prefs.options['cygwin']:
        prog = 'cygstart'
    else:
        ext = os.path.splitext(fullfilename)[1].lower()[1:]
        for type, exts in tab.pane.app.prefs.filetypes.items():
            if ext in exts:
                prog = tab.pane.app.prefs.progs[type]
                break

    if prog:
        sys.stdout = sys.stderr = '/dev/null'
        if tab.pane.app.prefs.options['detach_terminal_at_exec']:
            utils.run_detached(prog, fullfilename)
            curses.curs_set(0)
        else:
            curses.endwin()
            os.system('%s \"%s\"' % (prog, fullfilename))
            curses.curs_set(0)
            sys.stdout = sys.__stdout__
            sys.stderr = sys.__stderr__

    elif not prog:
        if wcall.err_runprog():
            view_file(tab)

    tab.pane.app.regenerate()
Example #2
0
def do_special_view_file(tab):
    fullfilename = os.path.join(tab.path, tab.sorted[tab.file_i])
            
    prog = None    
    if tab.pane.app.prefs.options['cygwin']:
        prog = 'cygstart'
    else:
        ext = os.path.splitext(fullfilename)[1].lower()[1:]
        for type, exts in tab.pane.app.prefs.filetypes.items():
            if ext in exts:
                prog = tab.pane.app.prefs.progs[type]
                break
            
    
    if prog:
        sys.stdout = sys.stderr = '/dev/null'
        if tab.pane.app.prefs.options['detach_terminal_at_exec']:
            utils.run_detached(prog, fullfilename)
            curses.curs_set(0)
        else:
            curses.endwin()
            os.system('%s \"%s\"' % (prog, fullfilename))
            curses.curs_set(0)
            sys.stdout = sys.__stdout__
            sys.stderr = sys.__stderr__
            
    elif not prog:
        if wcall.err_runprog():
            view_file(tab)            
            

    tab.pane.app.regenerate()
Example #3
0
def do_execute_file(tab):
    filename = tab.sorted[tab.file_i]
    filename = os.path.join(tab.path, filename)
    sys.stdout = sys.stderr = '/dev/null'
    curses.endwin()
    if tab.pane.app.prefs.options['detach_terminal_at_exec']:
        utils.run_detached(filename)
        curses.curs_set(0)
    else:
        os.system('"%s"' % filename)
        curses.curs_set(0)
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__
Example #4
0
def do_execute_file(tab):
    filename = tab.sorted[tab.file_i]
    filename = os.path.join(tab.path, filename)
    sys.stdout = sys.stderr = '/dev/null'
    curses.endwin()
    if tab.pane.app.prefs.options['detach_terminal_at_exec']:
        utils.run_detached(filename)
        curses.curs_set(0)
    else:
        os.system('"%s"' % filename)
        curses.curs_set(0)
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__