Olha o que eu fiz pra você, fofa fofinha:)
Oqueprecedeéoresultadodaexecuçãodepython3live-line-filter.py/proc/cpuinfo
comosfiltrosquevocêvênacapturadetelaacima.
NoUbuntu,vocêpodeinstalaropython3-pyqt4paraobteroPyQt(queénecessário).
live-line-filter.py:
fromPyQt4importQtimportsysimportfileinputimportreclassLiveLineFilterApplication(Qt.QApplication):def__init__(self,args):Qt.QApplication.__init__(self,args)self.addWidgets()self.unfilteredlines=[xforxinfileinput.input()]self.slotRefilter()self.exec_()defaddWidgets(self):self.w=Qt.QWidget()self.layout=Qt.QVBoxLayout(self.w)self.input=Qt.QTextEdit(".*", None)
self.input.textChanged.connect(self.slotRefilter)
self.textedit = Qt.QTextEdit("pending", None)
self.textedit.setReadOnly(True)
self.layout.addWidget(self.input)
self.layout.addWidget(self.textedit)
self.w.show()
def slotRefilter(self):
filters = self.input.toPlainText().strip()
matches = self.unfilteredlines
for filt in filters.split("\n"):
if filt == "": continue
r = re.compile(filt)
matches = [x for x in matches if r.search(x)]
self.textedit.setText("".join(matches))
if __name__ == "__main__":
app = LiveLineFilterApplication(sys.argv)
Alternativas: