本文整理汇总了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
示例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")
示例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
示例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)