summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2012-09-16 22:44:33 +0200
committerFlorian Bruhin <git@the-compiler.org>2012-09-16 22:44:33 +0200
commit335ff6819ad949b719657cdbcd33f4cb3ab30bff (patch)
treecb5ca1516d5ef2cc3c2fafcc42021ad2fce33e9a
parent8ef85ca3cfeaff8cc10b7520240df06b1b28fb74 (diff)
downloadxojgrep-335ff6819ad949b719657cdbcd33f4cb3ab30bff.tar.gz
xojgrep-335ff6819ad949b719657cdbcd33f4cb3ab30bff.zip
Add TXTFile
-rw-r--r--xojgrep.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/xojgrep.py b/xojgrep.py
index e6fe465..7a1b5f3 100644
--- a/xojgrep.py
+++ b/xojgrep.py
@@ -113,6 +113,21 @@ class PDFFile:
if text:
content.append((pn, [text]))
return content
-
+
+
+class TXTFile:
+ def __init__(self, filename):
+ self.txtfile = open(filename, 'r')
+
+ def __del__(self):
+ self.txtfile.close()
+
+ def getcontent(self):
+ content = []
+ for (ln, line) in enumerate(self.txtfile):
+ content.append((ln, [line]))
+ return content
+
+
if __name__ == '__main__':
sys.exit(main())