From f4a51f50e21b65c368fd8656f8ac9349b2fd639b Mon Sep 17 00:00:00 2001 From: Stephen L Date: Sun, 21 Jan 2024 23:53:51 +0100 Subject: [PATCH] feat: display a console message with the absolute path where the actogram is saved + bump v0.4.1 Signed-off-by: Stephen L. --- pyproject.toml | 2 +- src/webactogram/webactogram.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1b0f22a..e62276c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta" [project] # beware if using setuptools: setup.py still gets executed, and even if pyproject.toml fields take precedence, if there is any code error in setup.py, building will fail! name = "webactogram" # renamed from online-actogram according to PEP 423 https://peps.python.org/pep-0423/#pick-meaningful-names -version = "0.4.0" # see PEP 440 https://peps.python.org/pep-0440/#pre-releases and https://packaging.python.org/en/latest/guides/single-sourcing-package-version/ +version = "0.4.1" # see PEP 440 https://peps.python.org/pep-0440/#pre-releases and https://packaging.python.org/en/latest/guides/single-sourcing-package-version/ description = "Actogram from browsers history, may help to screen sleep-wake patterns & disorders!" authors = [ {name = "Barrett F. Davis", email = "barrettfdavis@gmail.com"}, diff --git a/src/webactogram/webactogram.py b/src/webactogram/webactogram.py index 61991ce..6a4c63a 100644 --- a/src/webactogram/webactogram.py +++ b/src/webactogram/webactogram.py @@ -764,6 +764,7 @@ def export_actogram_png(self): orientation = 'horizontal' if self.act.landscape else 'vertical' # orientation pngfilepath = 'actograms/actogram_' + orientation +'_' + dt.today().date().isoformat() + '.png' # png file path fig.savefig(pngfilepath, dpi=self.plot.DPI) # save the figure as a png + print('Saved actogram in: ' + os.path.abspath(pngfilepath)) # print the absolute path to the png file if self.act.show: self.show_image_with_matplotlib(pngfilepath) @@ -779,8 +780,10 @@ def export_csv(self, filename): size_most_recent = os.path.getsize(most_recent) if os.path.getsize('temp.csv') >= size_most_recent: - self.act.df.to_csv('actograms/' + filename + '.csv') + csv_filepath = 'actograms/' + filename + '.csv' + self.act.df.to_csv(csv_filepath) os.remove('temp.csv') + print('Saved actogram in: ' + os.path.abspath(csv_filepath)) ## Main entry point (with arguments parser)