Permalink
Browse files

Reorganized project for consistency with distutils. Created setup.py

  • Loading branch information...
1 parent aca12ff commit a81bf1db5ea87cf11c71968b35db3a8956a5616d @firecat53 firecat53 committed Jan 16, 2013
Showing with 225 additions and 168 deletions.
  1. +3 −0 .gitignore
  2. +26 −0 LICENSE.txt
  3. +0 −46 README
  4. +59 −0 README.txt
  5. +41 −0 bin/tabview
  6. +18 −0 setup.py
  7. +1 −0 tabview/README.txt
  8. 0 tabview/__init__.py
  9. +77 −122 { → tabview}/tabview.py
View
@@ -0,0 +1,3 @@
+*.un~
+*.pyc
+build/
View
@@ -0,0 +1,26 @@
+Scott Hansen <firecat four one five three at gmail dot com>
+
+Based on code contributed by A.M. Kuchling <amk at amk dot ca>
+
+Copyright (c) 2013, Scott Hansen
+
+Copyright (c) 2010, Andrew M. Kuchling
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
View
46 README
@@ -1,46 +0,0 @@
-tabview.py -- View a CSV file in a spreadsheet-like display.
-Posted by Scott Hansen <firecat4153 at gmail dot com>
-
-Original code forked from:
-http://www.amk.ca/files/simple/tabview.txt
-Contributed by A.M. Kuchling <amk@amk.ca>
-
-The highlighted position is shown in the top-left corner of the screen; below
-it are shown the contents of that cell.
-
-Requires: Python 3+
-
-Usage:
- From command line: ./tabview.py <filename>
- From python command line to view an object:
- import tabview
- a = [["a","b","c"], ["d","e","f"]]
- tabview.view(a)
- From python command line to view a file:
- import tabview
- data = tabview.process_file(filename)
- tabview.view(data)
-
-Keybindings:
-
- F1 : Show this list of keybindings
- Cursor keys or
- h,j,k,l : Move the highlighted cell, scrolling if required.
- Q or q : Quit
- Home or ^ : Move to the start of this line
- End or $ : Move to the end of this line
- PgUp/PgDn
- or J/K : Move a page up or down
- H,L : Page left or right
- g : Goto top of current column
- [num]G : Goto line <num> or bottom of current column
- if num not given
- Insert or m : Memorize this position
- Delete or ' : Return to memorized position (if any)
- Enter : View full cell contents in pop-up window.
- / : Search
- n : Next search result
- p : Previous search result
- t : Toggle fixed header row
- s : Sort the table by the current column (ascending)
- S : Sort the table by the current column (descending)
View
@@ -0,0 +1,59 @@
+Tabview
+=========
+
+View a CSV file in a spreadsheet-like display.
+
+Posted by Scott Hansen <firecat4153@gmail.com>
+
+Original code forked from:
+http://www.amk.ca/files/simple/tabview.txt
+Contributed by A.M. Kuchling <amk@amk.ca>
+
+The highlighted position is shown in the top-left corner of the screen; next to
+it are shown the contents of that cell.
+
+Requires:
+---------
+
+Python 3+
+
+Usage:
+------
+
+* From command line: `tabview.py <filename>`
+* From python command line to view an object::
+
+ import tabview
+ a = [["a","b","c"], ["d","e","f"]]
+ tabview.view(a)
+
+* From python command line to view a file::
+
+ import tabview
+ data = tabview.process_file(filename)
+ tabview.view(data)
+
+Keybindings:
+---------------
+
+======================== =================================================
+*F1 or ?* Show this list of keybindings
+*Cursor keys or h,j,k,l* Move the highlighted cell, scrolling if required.
+*Q or q* Quit
+*Home or ^* Move to the start of this line
+*End or $* Move to the end of this line
+*PgUp/PgDn or J/K* Move a page up or down
+*H,L* Page left or right
+*g* Goto top of current column
+*[num]G* Goto line <num> or bottom of current column
+ if num not given
+*Insert or m* Memorize this position
+*Delete or '* Return to memorized position (if any)
+*Enter* View full cell contents in pop-up window.
+*/* Search
+*n* Next search result
+*p* Previous search result
+*t* Toggle fixed header row
+*s* Sort the table by the current column (ascending)
+*S* Sort the table by the current column (descending)
+============ =================================================
View
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+""" tabview -- View a tab-delimited file in a spreadsheet-like display.
+ Scott Hansen <firecat four one five three at gmail dot com>
+ Based on code contributed by A.M. Kuchling <amk at amk dot ca>
+
+ Usage:
+ From command line: ./tabview.py <filename>
+ From python command line to view an object:
+ import tabview
+ a = [["a","b","c"], ["d","e","f"]]
+ tabview.view(a)
+ From python command line to view a file:
+ import tabview
+ data = tabview.process_file(filename)
+ tabview.view(data)
+
+"""
+import argparse
+from tabview.tabview import process_file, readme, view
+
+def arg_parse():
+ """Parse filename and show help. Assumes README is in the same
+ directory as tabview.py
+
+ """
+ parser = argparse.ArgumentParser(formatter_class=
+ argparse.RawDescriptionHelpFormatter,
+ description="".join(readme()))
+ import pdb; pdb.set_trace
+ parser.add_argument('filename')
+ parser.add_argument('--encoding', '-e', help="Encoding, if required. "
+ "If the file is UTF-8 or Latin-1(iso8859-1) it should "
+ "be detected automatically. If not, you can pass "
+ "'CP720', or 'iso8859_2', for example.")
+ return parser.parse_args()
+
+if __name__ == '__main__':
+ args = arg_parse()
+ data = process_file(args.filename, args.encoding)
+ view(data)
View
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+
+setup(
+ name = "tabview",
+ version = "1.0",
+ description = "A curses command-line CSV and list (tabular data) viewer",
+ long_description = open('README.txt').read(),
+ author = "Scott Hansen",
+ author_email = "firecat4153@gmail.com",
+ url = "https://github.com/firecat53/tabview",
+ packages = ['tabview'],
+ scripts = ['bin/tabview'],
+ package_data = {'tabview': ['README.txt']},
+ data_files = [('share/doc/tabview',
+ ['README.txt', 'LICENSE.txt'])]
+)
View
View
No changes.
Oops, something went wrong.

0 comments on commit a81bf1d

Please sign in to comment.