Skip to content

Commit 019945d

Browse files
committed
Code / docs cleanup
* Add anaconda.org URL to README * Fix minor error in README * Document passing a .py file as COLORMAP, clean up unnecessary comment * Relocate `__name__ == "__main__"` check to `cli` module
1 parent ca5a028 commit 019945d

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ resulting visualizations and use the editor tool `on this website
1414
<https://bids.github.io/colormap/>`_.
1515

1616
Downloads:
17-
https://pypi.python.org/pypi/viscm/
17+
* https://pypi.python.org/pypi/viscm/
18+
* https://anaconda.org/conda-forge/viscm/
1819

1920
Code and bug tracker:
2021
https://github.com/matplotlib/viscm
@@ -29,4 +30,4 @@ Dependencies:
2930
* NumPy
3031

3132
License:
32-
MIT, see LICENSE.txt for details.
33+
MIT, see `LICENSE <LICENSE>`__ for details.

viscm/cli.py

+8-13
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,13 @@
22

33
import matplotlib.pyplot as plt
44

5-
from . import gui
5+
from viscm import gui
66

77

88
def cli():
99
import argparse
1010
argv = sys.argv[1:]
1111

12-
# Usage:
13-
# python -m viscm
14-
# python -m viscm edit
15-
# python -m viscm edit <file.py>
16-
# (file.py must define some appropriate globals)
17-
# python -m viscm view <file.py>
18-
# (file.py must define a global named "test_cm")
19-
# python -m viscm view "matplotlib builtin colormap"
20-
# python -m viscm view --save=foo.png ...
21-
2212
parser = argparse.ArgumentParser(
2313
prog="python -m viscm",
2414
description="A colormap tool.",
@@ -30,8 +20,9 @@ def cli():
3020
nargs="?")
3121
parser.add_argument("colormap", metavar="COLORMAP",
3222
default=None,
33-
help="A .json file saved from the editor, or "
34-
"the name of a matplotlib builtin colormap",
23+
help="A .json file saved from the editor, a .py file containing"
24+
" a global named `test_cm`, or the name of a matplotlib"
25+
" builtin colormap",
3526
nargs="?")
3627
parser.add_argument("--uniform-space", metavar="SPACE",
3728
default="CAM02-UCS",
@@ -109,3 +100,7 @@ def cli():
109100
signal.signal(signal.SIGINT, signal.SIG_DFL)
110101

111102
app.exec_()
103+
104+
105+
if __name__ == "__main__":
106+
cli()

viscm/gui.py

-4
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,3 @@ def loadviewer(self):
12251225
newwindow.resize(800, 600)
12261226

12271227
newwindow.show()
1228-
1229-
1230-
if __name__ == "__main__":
1231-
main()

0 commit comments

Comments
 (0)