From d4ba525c9df4d6c951d9633f50e0f32e4511a967 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 15 Apr 2016 19:05:12 +0800 Subject: [PATCH] gui,browser: save state in home folder --- RELEASE_NOTES.rst | 2 ++ artiq/frontend/artiq_browser.py | 10 ++++++++-- artiq/frontend/artiq_dashboard.py | 10 ++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 9ed10217b..860b2f4bb 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -34,6 +34,8 @@ unreleased [2.x] Experiments no longer need to do it explicitly. * The result folders are formatted "%Y-%m-%d/%H instead of "%Y-%m-%d/%H-%M". (i.e. grouping by day and then by hour, instead of by day and then by minute) +* GUI tools save their state file in the user's home directory instead of the + current directory. unreleased [1.0rc3] diff --git a/artiq/frontend/artiq_browser.py b/artiq/frontend/artiq_browser.py index 06d823c9a..347e08946 100755 --- a/artiq/frontend/artiq_browser.py +++ b/artiq/frontend/artiq_browser.py @@ -15,10 +15,16 @@ from artiq.browser import datasets, files def get_argparser(): + if os.name == "nt": + default_db_file = os.path.expanduser("~\\artiq_browser.pyon") + else: + default_db_file = os.path.expanduser("~/.artiq_browser.pyon") + parser = argparse.ArgumentParser(description="ARTIQ Browser") parser.add_argument( - "--db-file", default="artiq_browser.pyon", - help="database file for local browser settings") + "--db-file", default=default_db_file, + help="database file for local browser settings " + "(default: %(default)s)") parser.add_argument("PATH", nargs="?", help="browse path or file") verbosity_args(parser) return parser diff --git a/artiq/frontend/artiq_dashboard.py b/artiq/frontend/artiq_dashboard.py index 49c0838c9..08e77203d 100755 --- a/artiq/frontend/artiq_dashboard.py +++ b/artiq/frontend/artiq_dashboard.py @@ -18,6 +18,11 @@ from artiq.dashboard import (experiments, shortcuts, explorer, def get_argparser(): + if os.name == "nt": + default_db_file = os.path.expanduser("~\\artiq_dashboard.pyon") + else: + default_db_file = os.path.expanduser("~/.artiq_dashboard.pyon") + parser = argparse.ArgumentParser(description="ARTIQ Dashboard") parser.add_argument( "-s", "--server", default="::1", @@ -29,8 +34,9 @@ def get_argparser(): "--port-control", default=3251, type=int, help="TCP port to connect to for control") parser.add_argument( - "--db-file", default="artiq_dashboard.pyon", - help="database file for local GUI settings") + "--db-file", default=default_db_file, + help="database file for local GUI settings " + "(default: %(default)s)") verbosity_args(parser) return parser