當前位置: 首頁>>代碼示例>>Python>>正文


Python GNUScreen.gen_all_windows方法代碼示例

本文整理匯總了Python中GNUScreen.gen_all_windows方法的典型用法代碼示例。如果您正苦於以下問題:Python GNUScreen.gen_all_windows方法的具體用法?Python GNUScreen.gen_all_windows怎麽用?Python GNUScreen.gen_all_windows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GNUScreen的用法示例。


在下文中一共展示了GNUScreen.gen_all_windows方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sort

# 需要導入模塊: import GNUScreen [as 別名]
# 或者: from GNUScreen import gen_all_windows [as 別名]
def sort(session,min,max,key=None):
    ss=ScreenSaver(session,'/dev/null','/dev/null')
    wins=[]
    wins_trans={}
    groups={}
    cgroup=None
    for win,type,title in sc.gen_all_windows(min,max,session):
        iwin=int(win)
        group=ss.get_group(win)

        lastval=(group,iwin,type,title)
        try:
            groups[group].append(lastval)
        except:
            groups[group]=[lastval]
            
    win_biggest=lastval[1]
    for i in range(0,win_biggest+1):
        wins_trans[i]=i

    i=0
    for group,props in groups.items():
        props.sort(key=lambda wins:wins[3].lower())
        #print( str(len(props))+' : '+group + ' : ' + str(props))
        for group,win,type,title in props:
            if wins_trans[win]!=i:
                #print("win %d(%d)(%s) as %d"%(wins_trans[win],win,group,i))
                ss.number(str(i),str(wins_trans[win]))
                tmp=wins_trans[win]
                wins_trans[win]=wins_trans[i]
                wins_trans[i]=tmp
            i+=1
    return
開發者ID:testacc,項目名稱:screen-session,代碼行數:35,代碼來源:tools.py

示例2: dump

# 需要導入模塊: import GNUScreen [as 別名]
# 或者: from GNUScreen import gen_all_windows [as 別名]
def dump(ss,minwin,maxwin):
    for win,type,title in sc.gen_all_windows(minwin,maxwin,ss.pid):
        if type==0:
            type_string="basic"
        elif type==1:
            type_string="group"
        elif type==-1:
            type_string="zombie"
        else:
            type_string="unknown"

        print("%s %s"%(win,type_string))
        print("%s %s"%(win,title))
        filter=ss.get_exec(win)
        if filter!=-1:
            print("%s %s"%(win,filter))
        tty=ss.tty(win)
        print("%s %s"%(win,tty))
        if type==0:
            try:
                pids=sc.get_tty_pids(tty)
            except:
                print ("%s No access"%win)
                pass
            for pid in pids:
                try:
                    print ("%s %s %s"%(win,pid,sc.get_pid_info(pid)))
                except:
                    print ("%s No permission"%(win))
        print("\n")
開發者ID:testacc,項目名稱:screen-session,代碼行數:32,代碼來源:tools.py

示例3: renumber

# 需要導入模塊: import GNUScreen [as 別名]
# 或者: from GNUScreen import gen_all_windows [as 別名]
def renumber(session,min,max):
    ss=ScreenSaver(session,'/dev/null','/dev/null')
    wins=[]
    wins_trans={}
    for win,type,title in sc.gen_all_windows(min,max,session):
        iwin=int(win)
        wins.append((ss.get_group(win),iwin,type))

    win_biggest=wins[len(wins)-1][1]
    for i in range(0,win_biggest+1):
        wins_trans[i]=i

    wins.sort(key=lambda wins:wins[0])

    i=0
    for group,win,type in wins:
        if wins_trans[win]!=i:
            #print("win %d(%d)(%s) as %d"%(wins_trans[win],win,group,i))
            ss.number(str(i),str(wins_trans[win]))
            tmp=wins_trans[win]
            wins_trans[win]=wins_trans[i]
            wins_trans[i]=tmp
        i+=1
開發者ID:testacc,項目名稱:screen-session,代碼行數:25,代碼來源:tools.py

示例4: kill_zombie

# 需要導入模塊: import GNUScreen [as 別名]
# 或者: from GNUScreen import gen_all_windows [as 別名]
def kill_zombie(session,min,max):
    ss=ScreenSaver(session,'/dev/null','/dev/null')

    for win,type,title in sc.gen_all_windows(min,max,session):
        if type==-1:
            ss.kill(win)
開發者ID:testacc,項目名稱:screen-session,代碼行數:8,代碼來源:tools.py


注:本文中的GNUScreen.gen_all_windows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。