当前位置: 首页>>代码示例>>Python>>正文


Python GNUScreen.parse_windows方法代码示例

本文整理汇总了Python中GNUScreen.parse_windows方法的典型用法代码示例。如果您正苦于以下问题:Python GNUScreen.parse_windows方法的具体用法?Python GNUScreen.parse_windows怎么用?Python GNUScreen.parse_windows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GNUScreen的用法示例。


在下文中一共展示了GNUScreen.parse_windows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: kill_current_group

# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import parse_windows [as 别名]
def kill_current_group(ss,bKillHomeWindow=False,other_wins=[],homewindow=-1):
    if homewindow<0:
        cwin,ctitle=ss.get_number_and_title()
        homewindow=int(cwin)
    else:
        homewindow=int(homewindow)
    protected=tuple([(homewindow)]+other_wins)
    print (protected)
    cgroup=ss.get_group()
    print ('removing windows from group %s'%cgroup)
    while True:
        wins=sc.parse_windows(sc.get_windows(ss.pid))[0]
        print( wins)
        if len(wins)<=len(protected):
            break
        for w in wins:
            if w not in protected:
                print('removing %s'%w)
                ss.kill(w)
    for w in other_wins:
        ss.kill(w)
    for w in protected:
        if w != homewindow:
            print('removing protected %s'%w)
            ss.kill(w)
    if bKillHomeWindow:
        print('removing homewindow %s'%homewindow)
        ss.kill(homewindow)
开发者ID:testacc,项目名称:screen-session,代码行数:30,代码来源:tools.py

示例2: kill_group

# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import parse_windows [as 别名]
def kill_group(session,win):
    print ('killing group %s'%win)
    ss=ScreenSaver(session,'/dev/null','/dev/null')
    tty=ss.tty(win)
    if tty!="telnet":
        print('This window is not a group. Aborting.')
        return
    ss.select(win)
    wins=sc.parse_windows(sc.get_windows(session))[0]
    print wins
    for w in wins:
       print('killing %s'%w)
开发者ID:testacc,项目名称:screen-session,代码行数:14,代码来源:tools.py

示例3: out

# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import parse_windows [as 别名]

def out(str, active=False):
    if active:
        sys.stdout.write(str + "\n")


bPrint = False


session = "%s" % sys.argv[1]
out("session = " + session, bPrint)
session_arg = "-S %s" % session

cwin = sc.get_current_window(session)
windows_old = sc.parse_windows(sc.get_windows(session))[0]
out(str(windows_old), bPrint)

f = os.popen("screen %s -Q @tty" % session_arg)
ctty = f.readline()
f.close()
out(ctty, bPrint)
pids = sc.get_tty_pids(ctty)
# pids=sc.sort_by_ppid(pids)
thepid = pids[len(pids) - 1]
thedir = sc.get_pid_info(thepid)[0]

out(thedir, bPrint)

os.chdir(thedir)
开发者ID:testacc,项目名称:screen-session,代码行数:31,代码来源:screen-in-dir.py

示例4: open

# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import parse_windows [as 别名]
if __name__ == "__main__":
    sys.stdout = open(logfile, "w")
    sys.stderr = sys.stdout
    session = sys.argv[1]
    win = (
        subprocess.Popen("screen -S %s -Q @number" % (session), shell=True, stdout=subprocess.PIPE)
        .communicate()[0]
        .strip()
        .split(" ", 1)[0]
    )
    print("win before get_regions_count: " + win)
    # regions_c=get_regions_count_no_layout(session,)
    regions_c = get_regions_count(session, dumpfile)

    ident = subprogram + " " + inputfile
    global win_history
    win_history = get_win_history(session, regions_c)
    w1 = sc.parse_windows(sc.get_windows(session))[0]
    start_subprograms(session, subprogram, inputfile, regions_c, 5)
    w2 = sc.parse_windows(sc.get_windows(session))[0]
    print(w1)
    print(w2)
    wins = sc.find_new_windows(w1, w2)
    print(wins)

    signal.signal(signal.SIGUSR1, handler)
    time.sleep(4)

    cleanup()
开发者ID:testacc,项目名称:screen-session,代码行数:31,代码来源:screen-display-regions.py


注:本文中的GNUScreen.parse_windows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。