Skip to content

Commit

Permalink
read usage from readme
Browse files Browse the repository at this point in the history
  • Loading branch information
HDembinski committed May 31, 2021
1 parent 404ad91 commit daaefc0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# monolens

<!-- description begin -->
View part of your screen in monochrome colors or in simulated protanopia, deuteranopia, or tritanopia.
<!-- description end -->

[<img src="https://img.shields.io/pypi/v/monolens.svg">](https://pypi.org/project/monolens)

Expand All @@ -14,15 +16,14 @@ command with or `pipx run monolens`.
# Usage

<!-- usage begin -->

- Drag the lens around by holding a Mouse button down inside the window
- To quit, press Escape, Q, or double click on the lens
- Resize the lens by pressing up, down, left, right
- Press Tab to switch between monochrome view and simulated protanopia, deuteranopia, tritanopia
- Press I to switch view label on/off
- To move the lens to another screen, press M
- On OSX, you need to give Monolens permission to make screenshots, which is safe.

On OSX, you need to give Monolens permission to make screenshots, which is safe.
<!-- usage end -->

# Known limitations
Expand Down
29 changes: 11 additions & 18 deletions monolens/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def main():
from .util import DEBUG
import sys
import signal
import re

QtCore.QCoreApplication.setOrganizationName("Monolens")
QtCore.QCoreApplication.setApplicationName("Monolens")
Expand All @@ -19,24 +20,16 @@ def main():
if "--reset" in app.arguments()[1:]:
settings.clear()

# TODO would be great to read this from README.md
print(
"Monolens allows you to view part of your screen in monochrome or simulated "
"colorblindness.",
"""
Usage
- Drag the lens around by holding a Mouse button down inside the window
- To quit, press Escape, Q, or double click on the lens
- Resize the lens by pressing up, down, left, right
- Press Tab to switch between monochrome view and simulated
protanopia, deuteranopia, tritanopia
- Press I to switch view label on/off
- To move the lens to another screen, press M
On OSX, you need to give Monolens permission to make screenshots, which is safe.
""",
)
with open("README.md") as f:
tx = f.read()
tag = "<!-- {0} begin -->\n(.+?)\n<!-- {0} end -->"
m = re.search(tag.format("description"), tx, re.DOTALL)
assert m
print(m.group(1))
print("\nUsage:\n")
m = re.search(tag.format("usage"), tx, re.DOTALL)
assert m
print(m.group(1))

if DEBUG:
print("settings:")
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = attr: monolens._version.version
author = Hans Dembinski
author_email = [email protected]
description = View part of your screen in monochrome colors or in simulated protanopia, deuteranopia, or tritanopia
license_file = LICENSE
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/hdembinski/monolens
Expand All @@ -21,6 +22,9 @@ install_requires =
pyside6
numpy
numba
include_package_data = true
package_data =
monolens = README.md

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit daaefc0

Please sign in to comment.