本文整理汇总了Python中GNUScreen.gen_all_windows_full方法的典型用法代码示例。如果您正苦于以下问题:Python GNUScreen.gen_all_windows_full方法的具体用法?Python GNUScreen.gen_all_windows_full怎么用?Python GNUScreen.gen_all_windows_full使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GNUScreen
的用法示例。
在下文中一共展示了GNUScreen.gen_all_windows_full方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __move_all_windows
# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import gen_all_windows_full [as 别名]
def __move_all_windows(self,shift,group,kill=False):
homewindow=int(self.homewindow)
# create wrap group for existing windows
if not self.bNoGroupWrap:
self.screen('-t \"%s\" //group' % ('%s_%s'%(group,self.__unique_ident)) )
self.group(False,self.none_group)
self.wrap_group_id=self.number()
# move windows by shift and put them in a wrap group
#for cwin,cgroupid,ctype,ctty in sc.gen_all_windows_fast(self.pid):
for cwin,cgroupid,cgroup,ctty,ctype,ctypestr,ctitle,cfilter,cscroll,ctime in sc.gen_all_windows_full(self.pid):
iwin=int(cwin)
if iwin==homewindow:
homewindow=iwin+shift
self.homewindow=str(homewindow)
cgroupid,cgroup = self.get_group(cwin)
if not self.bNoGroupWrap and cgroup==self.none_group:
self.select(self.wrap_group_id)
self.group(False,group,str(cwin))
command='%s -p %s -X number +%d' % (self.sc,cwin,shift)
if not self.bNoGroupWrap and str(cwin)==str(self.wrap_group_id):
out('Moving wrap group %s to %d'%(cwin,iwin+shift))
self.wrap_group_id=str(iwin+shift)
else:
out('Moving window %s to %d'%(cwin,iwin+shift))
os.system(command)
self.select('%d'%(homewindow))
示例2: dump
# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import gen_all_windows_full [as 别名]
def dump(ss,showpid=True,reverse=True,sort=False,groupids=[]):
from sys import stdout
bShow=True
windows=[]
if groupids:
windows=subwindows(ss.pid,groupids)[1]
for cwin,cgroupid,cgroup,ctty,ctype,ctypestr,ctitle,cfilter,cscroll,ctime in sc.gen_all_windows_full(ss.pid,reverse,sort):
if groupids:
if cwin in windows:
bShow=True
else:
bShow=False
if bShow:
print("----------------------------------------")
lines=[]
lines.append("%s TYPE %s\n"%(cwin,ctypestr))
if cgroupid=='-1':
groupstr='-1'
else:
groupstr=cgroupid+' '+cgroup
lines.append("%s GRP %s\n"%(cwin,groupstr))
lines.append("%s TITL %s\n"%(cwin,ctitle))
if cfilter!='-1':
lines.append("%s EXEC %s\n"%(cwin,cfilter))
if ctype==0:
lines.append("%s TTY %s\n"%(cwin,ctty))
if showpid:
try:
pids=sc.get_tty_pids(ctty)
except:
lines.append ("%s No access\n"%cwin)
pass
for pid in pids:
try:
cwd,exe,cmd=sc.get_pid_info(pid)
lines.append ("%s PID %s CWD %s\n"%(cwin,pid,cwd))
lines.append ("%s PID %s EXE %s\n"%(cwin,pid,exe))
cmd=cmd.split('\0')[:-1]
lines.append ("%s PID %s CMD %s\n"%(cwin,pid,cmd))
try:
if cmd[0].endswith('screen-session-primer') and cmd[1]=='-p':
lines[0]=lines[0][:-1]+" / primer\n"
elif cmd[0] in ('vi','vim','viless','vimdiff'):
lines[0]=lines[0][:-1]+" / VIM\n"
except:
pass
except:
lines.append ("%s PID > %s < No permission\n"%(cwin,pid))
map(stdout.write,lines)
示例3: __move_all_windows
# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import gen_all_windows_full [as 别名]
def __move_all_windows(self, shift, group, kill=False):
homewindow = int(self.homewindow)
# create a wrap group for existing windows
if not self.bNoGroupWrap:
self.wrap_group_id = self.screen('-t "%s" //group' % ("%s_%s" % (group, self.__unique_ident)))
self.group(False, self.none_group, self.wrap_group_id)
# move windows by shift and put them in a wrap group
# for cwin,cgroupid,ctype,ctty in sc.gen_all_windows_fast(self.pid):
for (
cwin,
cgroupid,
cgroup,
ctty,
ctype,
ctypestr,
ctitle,
cfilter,
cscroll,
ctime,
cmdargs,
) in sc.gen_all_windows_full(self.pid, sc.require_dumpscreen_window(self.pid, True)):
iwin = int(cwin)
if iwin == homewindow:
homewindow = iwin + shift
self.homewindow = str(homewindow)
if not self.bNoGroupWrap and cgroup == self.none_group:
self.select(self.wrap_group_id)
self.group(False, group, str(cwin))
command = "%s -p %s -X number +%d" % (self.sc, cwin, shift)
if not self.bNoGroupWrap and str(cwin) == str(self.wrap_group_id):
out("Moving wrap group %s to %d" % (cwin, iwin + shift))
self.wrap_group_id = str(iwin + shift)
else:
out("Moving window %s to %d" % (cwin, iwin + shift))
os.system(command)
self.select("%d" % homewindow)
示例4: __save_screen
# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import gen_all_windows_full [as 别名]
def __save_screen(self):
errors = []
homewindow = self.homewindow
group_wins = {}
group_groups = {}
excluded_wins = []
excluded_groups = []
scroll_wins = []
scroll_groups = []
cwin = -1
ctty = None
cppids = {}
rollback = (None, None, None)
ctime = self.time()
findir = sc.datadir
os.symlink(os.path.join(findir), os.path.join(self.basedir, self.savedir))
# sc_cwd=self.command_at(True,'hardcopydir') # it only works interactively
# should be modified to properly restore hardcopydir(:dumpscreen settings)
self.command_at(
False, "eval 'hardcopydir \"%s\"' 'at \"\#\" hardcopy -h' 'hardcopydir \"%s\"'" % (findir, self.homedir)
)
mru_w = [homewindow + "\n"]
for (
cwin,
cgroupid,
cgroup,
ctty,
ctype,
ctypestr,
ctitle,
cfilter,
cscroll,
badctime,
cmdargs,
) in sc.gen_all_windows_full(self.pid, sc.datadir, False, False):
mru_w.append("%s\n" % cwin)
cpids = None
cpids_data = None
if ctypestr[0] == "g":
pass
elif ctypestr[0] == "z":
cpids = []
else:
# get sorted pids associated with the window
try:
cpids = sc.get_tty_pids(ctty)
cpids_data = []
ncpids = []
for pid in cpids:
try:
pidinfo = sc.get_pid_info(pid)
(exehead, exetail) = os.path.split(pidinfo[1])
if exetail in self.blacklist:
blacklist = True
else:
blacklist = False
cpids_data.append(pidinfo + tuple([blacklist]))
ncpids.append(pid)
except Exception, x:
if cwin != homewindow:
errors.append("%s PID %s: Unable to access ( %s )" % (cwin, pid, str(x)))
cpids = ncpids
except Exception, x:
errors.append("%s Unable to access %s ( %s )" % (cwin, str(ctty), str(x)))
cpids = []
示例5: dump
# 需要导入模块: import GNUScreen [as 别名]
# 或者: from GNUScreen import gen_all_windows_full [as 别名]
def dump(ss, datadir, showpid=True, reverse=True, sort=False, groupids=[]):
from sys import stdout
bShow = True
windows = []
sum_process_total = 0
sum_win = 0
sum_zombie = 0
sum_basic = 0
sum_group = 0
sum_telnet = 0
sum_primer = 0
sum_vim = 0
if groupids:
(groups, windows) = subwindows(ss.pid, datadir, groupids)
try:
for (
cwin,
cgroupid,
cgroup,
ctty,
ctype,
ctypestr,
ctitle,
cfilter,
cscroll,
ctime,
cmdargs,
) in sc.gen_all_windows_full(ss.pid, datadir, reverse, sort):
if groupids:
if cwin in windows:
bShow = True
else:
bShow = False
if bShow:
sum_win += 1
if ctype == -1:
sum_zombie += 1
elif ctype == 0:
sum_basic += 1
elif ctype == 1:
sum_group += 1
elif ctype == 2:
sum_telnet += 1
print "----------------------------------------"
lines = []
lines.append("%s TYPE %s\n" % (cwin, ctypestr))
if cgroupid == "-1":
groupstr = "-1"
else:
groupstr = cgroupid + " " + cgroup
lines.append("%s GRP %s\n" % (cwin, groupstr))
lines.append("%s TITL %s\n" % (cwin, ctitle))
cmdargs = cmdargs.split('\0')
pcmdargs = cmdargs[0]
if cmdargs[1] != '':
pcmdargs += " " + (" ").join(["\"%s\"" % v for v in
cmdargs[1:-1]])
lines.append("%s CARG %s\n" % (cwin, pcmdargs))
if cfilter != "-1":
lines.append("%s EXEC %s\n" % (cwin, cfilter))
if ctype == 0:
lines.append("%s TTY %s\n" % (cwin, ctty))
if showpid:
try:
pids = sc.get_tty_pids(ctty)
for pid in pids:
sum_process_total += 1
try:
(cwd, exe, cmd) = sc.get_pid_info(pid)
lines.append("%s PID %s CWD %s\n" % (cwin,
pid, cwd))
lines.append("%s PID %s EXE %s\n" % (cwin,
pid, exe))
cmd = cmd.split('\0')
pcmd = cmd[0]
if cmd[1] != '':
pcmd += " "+" ".join(["\"%s\"" % v for v in cmd[1:-1]])
lines.append("%s PID %s CMD %s\n" % (cwin,
pid, pcmd))
if cmd[0].endswith('screen-session-primer') and cmd[1] == '-p':
sum_primer += 1
lines[0] = lines[0][:-1] + " / primer\n"
elif cmd[0] in ('vi', 'vim', 'viless', 'vimdiff'):
sum_vim += 1
lines[0] = lines[0][:-1] + " / VIM\n"
except OSError,x:
lines.append("%s PID %s Unable to access pid data ( %s )\n" %
(cwin, pid, str(x)))
except Exception,x:
lines.append("%s Unable to access PIDs associated with tty ( %s )\n" %
(cwin,str(x)))
try:
map(stdout.write, lines)
except:
break
print 'WINDOWS: %d\t[ %d basic | %d group | %d zombie | %d telnet ]' % \
#.........这里部分代码省略.........