def start(ctx, mock=False, clean=False): """start the w3modmanager application""" from tests.framework import _mockdata, _root import w3modmanager import w3modmanager.__main__ _testdata = _root.joinpath('testdata') if clean: print('cleaning up testdata...') rmtree(_testdata, ignore_errors=True) git = which('git') if git: hash = subprocess.run([git, 'rev-parse', '--short=7', 'HEAD'], capture_output=True).stdout if hash: w3modmanager.VERSION_HASH = str(hash, 'utf-8').strip() date = subprocess.run([git, 'show', '-s', '--format=%cI', 'HEAD'], capture_output=True).stdout if date: date = datetime.fromisoformat(str( date, 'utf-8').strip()).astimezone(timezone.utc).isoformat() date = date[:10].replace('-', '.') w3modmanager.VERSION = date if mock: from PySide2.QtCore import QSettings print('setting up testdata...') copy_tree(str(_mockdata), str(_testdata)) QSettings.setDefaultFormat(QSettings.IniFormat) QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, str(_testdata.joinpath('settings'))) w3modmanager.__main__.main(_testdata.joinpath('programs'), _testdata.joinpath('documents')) else: w3modmanager.__main__.main()
def __init__(self, *args, **kwargs): """Create the settings object and set some of its own settings. """ super(Settings, self).__init__(*args, **kwargs) QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, CONFIG_DIR) self.settings = QSettings(CONFIG_FILE_PATH, QSettings.IniFormat) self.read_settings()