Skip to content

Commit 5ef4f80

Browse files
[MRG] Print survey link upon first launch of GUI or first import (#1158)
* Print survey link upon first launch of GUI or first import * ref: rename survey, change to module install path * doc: add recognition of user to changelog * ref: move survey func into init --------- Co-authored-by: Austin E. Soplata <me@asoplata.com> Co-authored-by: Austin E. Soplata <asoplata@users.noreply.github.com>
1 parent 6a04c4c commit 5ef4f80

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

doc/whats_new.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,18 @@ merged into `master`! Use `git log` instead and cross-reference instead. -->
3131
### People who contributed to this release:
3232

3333
- [Tushar Jamdade][]
34+
- [Karthikeya Kodlai][]
3435

3536
### Changelog
3637

38+
- Add support for printing a welcome message that asks the user to fill out the HNN
39+
survey, which is printed to the standard output after (and only after) the first time
40+
the `hnn_core` module is imported. Whether or not the message is displayed is
41+
determined by the presence of a new file created in the module after first run.
42+
by [Karthikeya Kodlai][] in {gh}`1158`. This was their first PR, thanks Karthikeya!
43+
3744
- Add progressive minimal install and test to Github Actions,
38-
by [Tushar Jamdade][] in {gh}`1214`.
45+
by [Tushar Jamdade][] in {gh}`1214`. This was their first PR, thanks Tushar!
3946

4047
## 0.5.0 Release Notes
4148

@@ -1254,4 +1261,5 @@ v0.4 represents a major milestone in development of `hnn_core` and the HNN ecosy
12541261
[Maira Usman]: https://github.com/Myrausman
12551262
[Chetan Kandpal]: https://github.com/Chetank99
12561263
[NEURON]: https://nrn.readthedocs.io
1257-
[Tushar Jamdade]: https://github.com/Tusharjamdade
1264+
[Karthikeya Kodlai]: https://github.com/sketch123456
1265+
[Tushar Jamdade]: https://github.com/Tusharjamdade

hnn_core/__init__.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,34 @@
2020
)
2121

2222
__version__ = "0.5.1.dev0"
23+
24+
25+
import json
26+
from pathlib import Path
27+
from textwrap import dedent
28+
29+
30+
def _print_survey_link():
31+
"""Print the survey link, unless the "seen" file already exists."""
32+
storage_dir = Path(__file__).parent
33+
storage_file = storage_dir / "survey_seen.json"
34+
35+
if not storage_file.exists():
36+
print(
37+
dedent("""
38+
-------------------------------------------------------------------------------------------------------
39+
Thank you for installing HNN-Core! Please fill out our survey at:
40+
41+
https://docs.google.com/forms/d/e/1FAIpQLSfN2F4IkGATs6cy1QBO78C6QJqvm9y14TqsCUsuR4Rrkmr1Mg/viewform
42+
43+
Filling out our survey REALLY helps us to provide support and maintenance for HNN-Core.
44+
45+
This message should only display once, after you have first installed HNN-Core. Happy modeling!
46+
-------------------------------------------------------------------------------------------------------
47+
""")
48+
)
49+
with open(storage_file, "w") as f:
50+
json.dump({"survey_seen": True}, f)
51+
52+
53+
_print_survey_link()

0 commit comments

Comments
 (0)