forked from M-Labs/artiq
browser/dashboard: use appdirs, closes #438
This commit is contained in:
parent
340d65fec7
commit
bb706c1fe2
|
@ -10,7 +10,8 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
from quamash import QEventLoop
|
from quamash import QEventLoop
|
||||||
|
|
||||||
from artiq import __artiq_dir__ as artiq_dir
|
from artiq import __artiq_dir__ as artiq_dir
|
||||||
from artiq.tools import verbosity_args, atexit_register_coroutine
|
from artiq.tools import (verbosity_args, atexit_register_coroutine,
|
||||||
|
get_user_config_dir)
|
||||||
from artiq.gui import state, applets, models, log
|
from artiq.gui import state, applets, models, log
|
||||||
from artiq.browser import datasets, files, experiments
|
from artiq.browser import datasets, files, experiments
|
||||||
|
|
||||||
|
@ -19,10 +20,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
if os.name == "nt":
|
default_db_file = os.path.join(get_user_config_dir(), "artiq_browser.pyon")
|
||||||
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 = argparse.ArgumentParser(description="ARTIQ Browser")
|
||||||
parser.add_argument("--db-file", default=default_db_file,
|
parser.add_argument("--db-file", default=default_db_file,
|
||||||
|
|
|
@ -10,7 +10,8 @@ from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
from quamash import QEventLoop
|
from quamash import QEventLoop
|
||||||
|
|
||||||
from artiq import __artiq_dir__ as artiq_dir, __version__ as artiq_version
|
from artiq import __artiq_dir__ as artiq_dir, __version__ as artiq_version
|
||||||
from artiq.tools import *
|
from artiq.tools import (atexit_register_coroutine, verbosity_args,
|
||||||
|
get_user_config_dir)
|
||||||
from artiq.protocols.pc_rpc import AsyncioClient
|
from artiq.protocols.pc_rpc import AsyncioClient
|
||||||
from artiq.protocols.broadcast import Receiver
|
from artiq.protocols.broadcast import Receiver
|
||||||
from artiq.gui.models import ModelSubscriber
|
from artiq.gui.models import ModelSubscriber
|
||||||
|
@ -20,10 +21,8 @@ from artiq.dashboard import (experiments, shortcuts, explorer,
|
||||||
|
|
||||||
|
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
if os.name == "nt":
|
default_db_file = os.path.join(get_user_config_dir(),
|
||||||
default_db_file = os.path.expanduser("~\\artiq_dashboard.pyon")
|
"artiq_dashboard.pyon")
|
||||||
else:
|
|
||||||
default_db_file = os.path.expanduser("~/.artiq_dashboard.pyon")
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ Dashboard")
|
parser = argparse.ArgumentParser(description="ARTIQ Dashboard")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
|
@ -14,6 +14,9 @@ import numpy as np
|
||||||
|
|
||||||
from artiq.language.environment import is_experiment
|
from artiq.language.environment import is_experiment
|
||||||
from artiq.protocols import pyon
|
from artiq.protocols import pyon
|
||||||
|
from artiq.appdirs import user_config_dir
|
||||||
|
from artiq._version import get_versions
|
||||||
|
artiq_version = get_versions()['version']
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["parse_arguments", "elide", "short_format", "file_import",
|
__all__ = ["parse_arguments", "elide", "short_format", "file_import",
|
||||||
|
@ -243,3 +246,10 @@ def get_windows_drives():
|
||||||
drives.append(letter)
|
drives.append(letter)
|
||||||
bitmask >>= 1
|
bitmask >>= 1
|
||||||
return drives
|
return drives
|
||||||
|
|
||||||
|
|
||||||
|
def get_user_config_dir():
|
||||||
|
major = artiq_version.split(".")[0]
|
||||||
|
dir = user_config_dir("artiq", "m-labs", major)
|
||||||
|
os.makedirs(dir, exist_ok=True)
|
||||||
|
return dir
|
||||||
|
|
Loading…
Reference in New Issue