added app definition for push to project

This commit is contained in:
Jakub Trllo 2023-01-05 18:09:00 +01:00
parent 3650ac489a
commit 3eed7b8de0
3 changed files with 41 additions and 60 deletions

View file

@ -0,0 +1,41 @@
import click
from qtpy import QtWidgets, QtCore
from openpype.tools.push_to_project.window import PushToContextSelectWindow
@click.command()
@click.option("--project", help="Source project name")
@click.option("--version", help="Source version id")
def main(project, version):
"""Run PushToProject tool to integrate version in different project.
Args:
project (str): Source project name.
version (str): Version id.
"""
app = QtWidgets.QApplication.instance()
if not app:
# 'AA_EnableHighDpiScaling' must be set before app instance creation
high_dpi_scale_attr = getattr(
QtCore.Qt, "AA_EnableHighDpiScaling", None
)
if high_dpi_scale_attr is not None:
QtWidgets.QApplication.setAttribute(high_dpi_scale_attr)
app = QtWidgets.QApplication([])
attr = getattr(QtCore.Qt, "AA_UseHighDpiPixmaps", None)
if attr is not None:
app.setAttribute(attr)
window = PushToContextSelectWindow()
window.show()
window.controller.set_source(project, version)
app.exec_()
if __name__ == "__main__":
main()

View file

@ -1135,28 +1135,3 @@ class ProjectPushItemProcess:
finally:
self._status.set_finished()
def main():
# NOTE For development purposes
project_name = ""
version_id = ""
dst_project_name = ""
dst_asset_id = ""
dst_task_name = ""
version = None
variant = ""
comment = ""
item = ProjectPushItem(
project_name,
version_id,
dst_project_name,
dst_asset_id,
dst_task_name,
variant,
version,
dst_version=1
)
item_process = ProjectPushItemProcess(item)
item_process.process()

View file

@ -705,38 +705,3 @@ class PushToContextSelectWindow(QtWidgets.QWidget):
def _on_select_click(self):
self._controller.submit()
def main():
app = QtWidgets.QApplication.instance()
if not app:
# 'AA_EnableHighDpiScaling' must be set before app instance creation
high_dpi_scale_attr = getattr(
QtCore.Qt, "AA_EnableHighDpiScaling", None
)
if high_dpi_scale_attr is not None:
QtWidgets.QApplication.setAttribute(high_dpi_scale_attr)
app = QtWidgets.QApplication([])
for attr_name in (
"AA_UseHighDpiPixmaps",
):
attr = getattr(QtCore.Qt, attr_name, None)
if attr is not None:
app.setAttribute(attr)
# TODO find way how to get these
project_name = None
version_id = None
# Show window dialog
window = PushToContextSelectWindow()
window.controller.set_source(project_name, version_id)
window.show()
app.exec_()
if __name__ == "__main__":
main()