Files
o3de/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/azpy/shared/ui/qt_settings.py
T
Jonny Galloway b779f358d0 Refactor DCCsi to work better with O3DE changes (#4226)
* moving files in refactor/re-org

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* dev env refactor/re-org

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* moving/re-org so we can deprate the SDK nomiclature

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* moving/re-org so we can deprate the SDK nomiclature

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Refactoring env so I can replace SDK with Tools folder

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* re-org and prune, from SKD to Tools

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Removing old .bat files from SDK

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* updated how to retreive PYTHONHOME

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Can't use/set PYTHONHOME with DCC Tools

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* small refactor

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* repaired a missed typo (causes error)

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Added missing EntityId.h include to FocusModeInterface.h

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* refactor additional LY to O3DE tags

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Some design scaffold file stubs

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* stubbing in scaffold file pattern

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Removal of corrupted prefabs

Signed-off-by: Benjamin Black <benblac@amazon.com>

* refactored config_utils to maintain py2.7 support for maya 2020

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* refactored config_utils to maintain py2.7 support for maya 2020

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* pruning and cleanup

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* .env is for local dev overrides

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* .env is for local dev overrides

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* clean up init and logging patterns

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* Core refactoring, config.py functional standalone

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* cleaned up some bad logging, fixed up boostrap

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* fixed validation errors

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* fix logging issue, tiddy up

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* tiddy up maya for .bat bootstraping and launch

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

* name stub, fix validation

Signed-off-by: Jonny Gallowy <gallowj@amazon.com>

Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
Co-authored-by: Benjamin Black <benblac@amazon.com>
2021-10-21 17:03:49 -07:00

82 lines
2.4 KiB
Python

# coding:utf-8
#!/usr/bin/python
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# -------------------------------------------------------------------------
"""qt_settings.py: Manages a QSettings for a tool"""
# built in's
import os
import logging as _logging
# 3rd Party (we may provide)
from unipath import Path
from dynaconf import settings
# azpy extensions
import azpy.config_utils
_config = azpy.config_utils.get_dccsi_config()
# ^ this is effectively an import and retreive of <dccsi>\config.py
# init lumberyard Qy/PySide2 access
_config.init_o3de_pyside(settings.O3DE_DEV)
# now we can import lumberyards PySide2
import PySide2.QtCore as QtCore
import PySide2.QtWidgets as QtWidgets
# -------------------------------------------------------------------------
# global space debug flag
_DCCSI_GDEBUG = settings.DCCSI_GDEBUG
# global space debug flag
_DCCSI_DEV_MODE = settings.DCCSI_DEV_MODE
_MODULE_PATH = Path(__file__)
_ORG_TAG = 'Amazon_Lumberyard'
_APP_TAG = 'DCCsi'
_TOOL_TAG = 'azpy.shared.ui.qt_settings'
_TYPE_TAG = 'test'
_MODULENAME = _TOOL_TAG
_LOGGER = _logging.getLogger(_MODULENAME)
_LOGGER.debug('Something invoked :: {0}.'.format(_MODULENAME))
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
def createSettings(org='Amazon_Lumberyard', app='DCCsi',
tool='azpy', type='default'):
"""Sets up a settings .ini
Returns a QSettings instance"""
settings_folder = '{org}//{app}'.format(org=org, app=app)
settings_name = '{tool}-{type}'.format(tool=tool, type=type)
settings = QtCore.QSettings(QtCore.QSettings.IniFormat,
QtCore.QSettings.UserScope,
settings_folder, settings_name)
return settings
# -------------------------------------------------------------------------
if __name__ == '__main__':
"""Run this file as main"""
import sys
app = QtWidgets.QApplication(sys.argv)
app.setOrganizationName(_ORG_TAG)
app.setApplicationName('{app}:{tool}'.format(app=_APP_TAG, tool=_TOOL_TAG))
test_esttings = createSettings(_ORG_TAG, _APP_TAG, _TOOL_TAG, _TYPE_TAG)
_LOGGER.info(test_esttings)
_LOGGER.info(test_esttings.fileName())