#!/usr/bin/env python # file: subwindows.py # author: Artur Skonecki # website: http://adb.cba.pl # description: print windows inside groups import sys import tools session=sys.argv[1] try: groupids=sys.argv[2] groupids=sys.argv[2:] except: groupids=['all'] groups,windows=tools.subwindows(session,groupids) print ('groups: %s'%(" ".join(["%s"%v for v in groups]))) print ('windows: %s'%(" ".join(["%s"%v for v in windows])))
scrollback_filename = os.path.join(findir, "hardcopy." + cwin) sys.stdout.write("%s %s; " % (cwin, ctypestr)) errors += self.__save_win(cwin, ctypestr, cpids_data, ctime, rollback) rollback = (None, None, None) out("") # remove ignored scrollbacks if "all" in self.scroll: for f in glob.glob(os.path.join(findir, "hardcopy.*")): open(f, "w") elif self.scroll: import tools (scroll_groups, scroll_wins) = tools.subwindows(self.pid, sc.datadir, self.scroll) out("Scrollback excluded groups: %s" % str(scroll_groups)) out("All scrollback excluded windows: %s" % str(scroll_wins)) for w in scroll_wins: util.remove(os.path.join(findir, "hardcopy.%s" % w)) # remove ignored windows if self.excluded: import tools (excluded_groups, excluded_wins) = tools.subwindows(self.pid, sc.datadir, self.excluded) out("Excluded groups: %s" % str(excluded_groups)) out("All excluded windows: %s" % str(excluded_wins)) bpath1 = os.path.join(findir, "win_") bpath2 = os.path.join(findir, "hardcopy.")
scrollback_filename = os.path.join(findir, "hardcopy." + cwin) sys.stdout.write("%s %s; " % (cwin, ctypestr)) errors += self.__save_win(cwin, ctypestr, cpids_data, ctime, rollback) rollback = (None, None, None) out("") # remove ignored scrollbacks if 'all' in self.scroll: for f in glob.glob(os.path.join(findir, "hardcopy.*")): open(f, "w") elif self.scroll: import tools (scroll_groups, scroll_wins) = tools.subwindows(self.pid, sc.datadir, self.scroll) out('Scrollback excluded groups: %s' % str(scroll_groups)) out('All scrollback excluded windows: %s' % str(scroll_wins)) for w in scroll_wins: util.remove(os.path.join(findir, "hardcopy.%s" % w)) # remove ignored windows if self.excluded: import tools (excluded_groups, excluded_wins) = tools.subwindows(self.pid, sc.datadir, self.excluded) out('Excluded groups: %s' % str(excluded_groups)) out('All excluded windows: %s' % str(excluded_wins)) bpath1 = os.path.join(findir, "win_") bpath2 = os.path.join(findir, "hardcopy.")
# subwindows.py : recursively print windows contained in a group # # Copyright (C) 2010-2011 Artur Skonecki http://github.com/skoneka # # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import sys import tools import util session = (sys.argv)[1] windows = util.expand_numbers_list((sys.argv)[2:]) (groups, subwindows) = tools.subwindows( session, tools.require_dumpscreen_window(session, False), windows) print 'groups: %s' % (" ").join(["%s" % v for v in groups]) print 'windows: %s' % (" ").join(["%s" % v for v in subwindows]) tools.cleanup()