ayon-core/common/ayon_common/ui_utils.py
Jakub Trllo 2791aa84bb AYON: Bundle distribution (#5209)
* modified distribution to use bundles

* use bundles in modules discovery logic

* removed unused import

* added support for bundle settings getter

* added script launch mechanism to ayon start script

* show login UI through subprocess

* removed silent mode

* removed unused variable

* match env variables to ayon launcher

* moved ui lib function to ayon common

* raise custom exception on missing bundle name

* implemented missing bundle window to show issues with bundles

* implemented helper function to show dialog about issues with bundle

* handle issues with bundles

* removed unused import

* dont convert passed addons infor

* access keys only in server getters

* fix accessed attribute

* fix test

* fixed missing 'message' variable

* removed duplicated data

* removed unnecessary 'sha256' variable

* use lstrip instead of replacement

* use f-string

* move import to the top of file

* added some dosctrings

* change type

* use f-string

* fix grammar

* set default settings variant in global connection creation

* reuse new function

* added init file

* safe access to optional keys

* removed unnecessary condition

* modified print messages on issues with bundles

* Changed message in missing bundle window

* updated ayon_api to 0.3.2
2023-07-11 18:13:53 +02:00

36 lines
1 KiB
Python

import sys
from qtpy import QtWidgets, QtCore
def set_style_property(widget, property_name, property_value):
"""Set widget's property that may affect style.
Style of widget is polished if current property value is different.
"""
cur_value = widget.property(property_name)
if cur_value == property_value:
return
widget.setProperty(property_name, property_value)
widget.style().polish(widget)
def get_qt_app():
app = QtWidgets.QApplication.instance()
if app is not None:
return app
for attr_name in (
"AA_EnableHighDpiScaling",
"AA_UseHighDpiPixmaps",
):
attr = getattr(QtCore.Qt, attr_name, None)
if attr is not None:
QtWidgets.QApplication.setAttribute(attr)
if hasattr(QtWidgets.QApplication, "setHighDpiScaleFactorRoundingPolicy"):
QtWidgets.QApplication.setHighDpiScaleFactorRoundingPolicy(
QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
)
return QtWidgets.QApplication(sys.argv)