From 3eed7b8de0b8a0963d1eba13b704cece21e5429b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Thu, 5 Jan 2023 18:09:00 +0100 Subject: [PATCH] added app definition for push to project --- openpype/tools/push_to_project/app.py | 41 +++++++++++++++++++ .../push_to_project/control_integrate.py | 25 ----------- openpype/tools/push_to_project/window.py | 35 ---------------- 3 files changed, 41 insertions(+), 60 deletions(-) create mode 100644 openpype/tools/push_to_project/app.py diff --git a/openpype/tools/push_to_project/app.py b/openpype/tools/push_to_project/app.py new file mode 100644 index 0000000000..9ca5fd83e9 --- /dev/null +++ b/openpype/tools/push_to_project/app.py @@ -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() diff --git a/openpype/tools/push_to_project/control_integrate.py b/openpype/tools/push_to_project/control_integrate.py index e4ae9decd3..fec9b9ddd2 100644 --- a/openpype/tools/push_to_project/control_integrate.py +++ b/openpype/tools/push_to_project/control_integrate.py @@ -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() diff --git a/openpype/tools/push_to_project/window.py b/openpype/tools/push_to_project/window.py index 99a77caa9e..a68f0f5340 100644 --- a/openpype/tools/push_to_project/window.py +++ b/openpype/tools/push_to_project/window.py @@ -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() \ No newline at end of file